Chandan gave his son a  cube with side N. The N X N X N cube is made up of small 1 X 1 X 1 cubes.

Chandan's son is extremely notorious just like him. So he dropped the cube inside a tank filled with Coke. The cube got totally immersed in that tank. His son was somehow able to take out the cube from the tank. But sooner his son realized that the cube had gone all dirty because of the coke. Since Chandan did not like dirty stuffs so his son decided to scrap off all the smaller cubes that got dirty in the process. A cube that had coke on any one of its six faces was considered to be dirty and scrapped off. After completing this cumbersome part his son decided to calculate  volume of the scrapped off material.
Since Chandan's son is weak in maths he is unable to do it alone.

Help him in calculating the required volume.

Input:

The first line contains T denoting the number of test cases. Then T lines follow each line contains N that is the side of cube.

Output:

For each case output the required volume.

Constraints:

1 ≤ T ≤ 100
1 ≤ N ≤ 10^9
Note:

There is no hole or space between 2 smaller cubes.

SAMPLE INPUT
2
1
3

SAMPLE OUTPUT
1
26

Explanation

For the first test case : There is only 1 small cube in a 1 x 1 x 1 cube. This cube gets coke on all of its 6 faces so it needs to be scrapped off. Volume of material that gets scrapped is 1 x 1 x 1 = 1.
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t=input();
while  t > 0 : 
	c=input()
	if c!=1:
		print (c*c*c)-(c-2)*(c-2)*(c-2)
		t=t-1
	else:
		print 1
		t=t-1