# Arup Guha
# 3/5/2022
# Solution to 2022 UCF HS Problem: The Queen's Reign

# Get number of cases.
nC = int(input())

# Go through each case.
for loop in range(nC):

    # Get the input.
    n = int(input())

    # Take the whole board and subtract out n for each of the 8 queen
    # directions and then 1 more for the center square.
    print((2*n+1)*(2*n+1) - 8*n - 1)
