/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>
typedef long long LL;
using namespace std;
int num[1005][1005];
void init(){
num[0][0] = 1;
num[0][1] = 1;
num[1][0] = 1;
num[1][1] = 2;
int len = 1;
for (int i = 2; i <= 1000; i++){
for (int j = 1; j <= len; j++){
num[i][j] += num[i - 1][j] * 2;
if(num[i][j] >= 10){
num[i][j] -= 10;
num[i][j + 1]++;
}
}
if(num[i][len + 1]){
num[i][0] = ++len;
}else{
num[i][0] = len;
}
}
}
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
init();
int t, n;
scanf("%d", &t);
while(t--){
scanf("%d", &n);
for (int i = num[n][0]; i >= 1; i--){
printf("%d", num[n][i]);
}
printf("\n");
}
return 0;
}
/**/