Classical A+B Problem
Time limit4sMemory limit1024 MB
Given a number n written as a sum of two repdigits, the task is to output any such pair of repdigits a and b.
- Level
Easy3 of 10
- Topics
- Math, Implementation, Brute force
- Solved
- No attempts yet
Statement
An integer is called a repdigit if it is positive and its decimal representation consists of repeated instances of the same digit. For example, , , , and are repdigits, while , , , and are not.
You are given a positive integer . It is known that can be represented as , where and are repdigits. Find any such representation.
Input
The first line contains the number of test cases (). Each test case is a single line containing an integer without leading zeros (). It is guaranteed that can be represented as , where and are repdigits. The total number of digits in over all test cases does not exceed .
Output
For each test case, print two integers and such that and both and are repdigits. If there are multiple solutions, print any of them.