for _ in range(int(input())):
    p = int(input())
    print((p - 1) ** 2 if p > 2 else 2)