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
ram = [1729, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 327763, 314496, 320264, 402597, 373464, 439101, 443889, 513856, 513000, 515375, 525824, 558441, 684019, 593047, 704977, 805688, 842751, 885248, 886464, 1009736, 920673, 1016496, 955016, 984067, 994688, 1061424, 1073375, 1075032, 1080891, 1092728, 1195112, 1260441, 1323712, 1533357, 1331064, 1370304, 1407672, 1609272, 1566728, 1734264, 1728216, 1729000, 1774656, 1845649, 2048391, 2101248, 2301299, 2418271, 2622104, 2585375, 2515968, 2562112, 3220776, 2691451, 3242197, 2864288, 2987712, 2991816, 3375001, 3375008, 3511872, 3512808, 3551112, 3587409, 3628233, 3798613, 3813992, 4110848, 4033503, 4104000, 4123000, 4206592, 4174281, 4467528, 4342914, 5472152, 4505949, 4511808, 4624776, 4931101, 4607064, 4673088]
t = int(raw_input())
for tt in range(t) :
    n = int(raw_input())
    print ram[n-1]