import java.util.Scanner;
public class Main
{
public static int find[]=new int[100001];
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
while (sc.hasNext())
{
int x=sc.nextInt();
while(x-->0) {
int a=sc.nextInt();
System.out.println(a*2*a-a+1);
}
}
}
}