Good Numbers
Easy Accuracy: 71.48% Submissions: 914 Points: 2

A number is called good if it contains only 1's and 2's. Given an integer N, the task is to find Nth good number

Note: Some good numbers are 1, 2, 11, 12, 21, 22 ........

Input:
1. The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
2. The first line of each test case contains a single integer N.


Output: For each test case, print the Nth good number
Constraints:
1. 1 <= T <= 100

2. 1 <= N <= 104

Example:
Input:

2
5
10000

Output:
21
1122211121112

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.


to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Good Numbers

Output Window