# 打表代码:
import math
us = dict()
nb = 9
for i in range(int(math.sqrt(10**(nb+1)))):
x = i * i
t = int(math.sqrt(x))
if t * t == x and len(str(x)) == nb:
tmp = str(x)
slist = []
for j in tmp:
slist.append(int(j))
slist = sorted(slist)
tmp = ""
for j in slist:
tmp += str(j)
us[tmp] = []
ulist = []
for i in range(int(math.sqrt(10**(nb+1)))):
x = i * i
t = int(math.sqrt(x))
if t * t == x and len(str(x)) == nb:
tmp = str(x)
slist = []
for j in tmp:
slist.append(int(j))
slist = sorted(slist)
tmp = ""
for j in slist:
tmp += str(j)
us[tmp].append(x)
cnt = 0
for k in list(us.keys()):
if len(us[k]) >= nb:
print(us[k])
# 答案代码:
import math
ans = dict()
for i in range(100):
ans[i] = []
ts = 1
ts = int(input())
def init():
ans[1] = [1]
ans[3] = [169,961,196]
ans[5] = [16900, 96100, 19600, 10609, 90601]
for i in range(7,100,2):
for j in ans[i - 2]:
ans[i].append(j * 100)
x = str(ans[i - 2][len(ans[i - 2]) - 1])
y = str(ans[i - 2][len(ans[i - 2]) - 2])
tmp = ""
for j in range(len(x)):
tmp += x[j]
if j + 1 < len(x) and x[j] == '0' and x[j + 1] != '0':
tmp += str(0)
ans[i].append(int(tmp))
tmp = ""
for j in range(len(y)):
tmp += y[j]
if j + 1 < len(y) and y[j] == '0' and y[j + 1] != '0':
tmp += str(0)
ans[i].append(int(tmp))
init()
while ts != 0:
ts -= 1
n = int(input())
for i in range(n):
print(ans[n][i])