import sys def I(): return int(sys.stdin.readline().rstrip()) N = I() for _ in range(N): p = I() print((p-1)**2+1)