Problem G - Matchsticks

Time limit: 2 seconds

Matchsticks are ideal tools to represent numbers. A common way to represent the ten decimal digits with matchsticks is the following:

This is identical to how numbers are displayed on an ordinary alarm clock. With a given number of matchsticks you can generate a wide range of numbers. We are wondering what the smallest and largest numbers are that can be created by using all your matchsticks.

Input

On the first line one positive number: the number of testcases, at most 100. After that per testcase:

Output

Per testcase:

Sample Input

4
3
6
7
15

Sample Output

7 7
6 111
8 711
108 7111111
The 2008 ACM Northwestern European Programming Contest