13
1
2
3
4
5
6
7
8
9
10
11
12
13 5
1
2
3
4
5
1729
4104
13832
20683
32832
39312
40033
46683
64232
65728
110656
110808
134379 1729
4104
13832
20683
32832
def numbers(N):
	my_number = 0
	v = {}
	c = {}
	i = 0
	while my_number < N:
		c[i] = i * i * i
		for j in xrange(i):
			s = c[j] + c[i]
			if s in v:
				my_number += 1
				yield(s)
			v[s] = (j,i)
		i += 1

my = []

def m(N):
	for x in numbers(N):
		my.append(x)
		
m(100)	
	
T = int(raw_input())
for _ in xrange(T):
	N = int(raw_input())
	print my[N-1]