ALONE - FOREVER ALONE

Numbers can be classified as IAR numbers and FA numbers.

Numbers in which all digits are equal to either adjacent digit are called In-A-Relationship numbers. For example: 11, 22, 111, 9922888 and 777788822 are IAR numbers.

Numbers featuring lonely digits are called Forever-Alone (FA) numbers. For example: in 22122 digit 1 is alone and in 123 all digits are alone.

Given K, your task is to find the Kth In-A-Relationship (IAR) number.

Input

The first line contains number of test cases T (T <= 50)

Then T test cases follow.

Each line contains one integer K (1 <= K <= 5*10^6)

Output

For each test case, print the Kth IAR number.

Sample

Input:
5
1
2
3
10
12

output:
11
22
33
111
333

Added by:cegprakash
Date:2013-01-23
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: BF GOSU
Resource:problem setter: rishi_kumar

hide comments
2013-07-27 21:40:42 cegprakash
Vijai ;)
2013-04-22 00:25:29 Vijai Shankar Natarajan
Languages: All except: BF
LOL :D
2013-01-24 17:23:07 cegprakash
"Wrong answer" clearly means your solution is wrong. Your code compiled perfectly.
2013-01-24 17:19:34 KAVITHA
@cegprakash
I did coding in code blocks ,c++ and i got correct output for jumping balls....after i submitted it showed me as "Wrong answer"....could u pls help me what language should be selected ??
2013-01-24 15:26:28 cegprakash
No
2013-01-24 15:07:40 looper
is the last digit adjacent to first digit ?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.