All numbers in this task are non-negative integers.
When refering to their digits, we are using their standard base-10 representations.
Given is a number \(d\). Find any two numbers with a difference \(d\) and the same digit sum, or report that no such pair of numbers exists.
The first line of the input file contains the number \(t\) of test cases. The specified number of test cases follows, one after another.
Each test case consists of a single line containing a single number \(d\).
For each test case output a single line containing either a pair of space-separated numbers \(x\) and \(y\) with the desired properties, or the word “NONE” (quotes for clarity) if there is no solution.
The numbers in your output may have up to 50 digits. (It is guaranteed that if a solution exists, there is one that fits into this limit comfortably.)
Input file: N1.in
Constraints:
Input file: N2.in
Constraints:
Input file: N3.in
Constraints:
input3 45 47 57168 | output60 15 NONE 684528 741696 |
Note that if a solution exists, the two numbers with a difference \(d\) and the same digit sum can be printed in either order.