NEWLANG - Minimum and maximum numbers

no tags 

Given N and K, find the smallest and the largest positive integers, each with exactly N digits and having exactly K distinct digits (0 - 9). Leading zeroes are not allowed !

Input

First line contains T, the number of test cases (about 200). Each of the next T lines contains 'N K', where 1 <= N <= 18 and 1 <= K <= 10. Input is given such that the answer will always exist.

Output

For each test case, output the two numbers, separated by a space, in a new line. 

Example

Input:
2
1 1
3 3

Output:
1 9
102 987

hide comments
Azamat Ahmedov: 2011-02-09 03:48:48

What is the K?
Please definite.


Added by:Siddharth Kothari
Date:2010-10-25
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Anil Kishore