提示: 欢迎访问OurACM平台。
Problem 1074 Nancy's Birthday

Accept: 50    Submit: 197
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

Nancy has bought a lottery. The lottery numbers are positive integers. The prized lottery numbers are determined by randomizing two integers m and k (m>=0, k>=1). Any lottery number that contains m 0's can be prized, and the kth number is the first prize if all the prized numbers are sorted in an ascending order. Nancy won the first prize with a lucky number, for the number of digits and the leftmost digit in the first prized number happen to make up the date of Nancy's birthday. Can you work out Nancy's birthday?

Input

The first line in the input is an integer N representing the number of test cases. The following N lines are N test cases. Each line contains two integers separated by one space , where the first integer is m and the second is k (0<=m<=10,1<=k<=10^12).

Output

For each test case, output a line containing two integers separated by one space, where the first integer is the number of digits in the first prized number and the second integer is the leftmost digit in the first prized number.

Sample Input

2 1 5 2 15

Sample Output

2 5 4 1

Source

FJNUPC 2005

Submit  Back  Status  Discuss