import sys
input = sys.stdin.readline
def solve(n):
count, res = n//3, n % 3
ans = []
for _ in range(count):
if res == 1:
ans.append("1")
ans.append("2")
else:
ans.append("2")
ans.append("1")
if res > 0:
ans.append(str(res))
print(int("".join(ans)))
for _ in range(int(input())):
n = int(input())
solve(n)
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
if(n%3==0){
int d=n/3;
while(d--){
cout << "21";
}
}
else if(n%3==1){
int d=n/3;
while(d--){
cout << "12";
}
cout <<"1";
}
else if(n%3==2){
int d=n/3;
while(d--){
cout << "21";
}
cout <<"2";
}
cout << endl;
}
return 0;
}
1151B - Dima and a Bad XOR | 1435B - A New Technique |
1633A - Div 7 | 268A - Games |
1062B - Math | 1294C - Product of Three Numbers |
749A - Bachgold Problem | 1486B - Eastern Exhibition |
1363A - Odd Selection | 131B - Opposites Attract |
490C - Hacking Cypher | 158B - Taxi |
41C - Email address | 1373D - Maximum Sum on Even Positions |
1574C - Slay the Dragon | 621A - Wet Shark and Odd and Even |
1395A - Boboniu Likes to Color Balls | 1637C - Andrew and Stones |
1334B - Middle Class | 260C - Balls and Boxes |
1554A - Cherry | 11B - Jumping Jack |
716A - Crazy Computer | 644A - Parliament of Berland |
1657C - Bracket Sequence Deletion | 1657B - XY Sequence |
1009A - Game Shopping | 1657A - Integer Moves |
230B - T-primes | 630A - Again Twenty Five |