while True:

    n = eval(input())

    if n == 0: break

    P = set(tuple(map(int, input().split())) for i in range(n))

    ans = 0

    for xi, yi in P:

        for xj, yj in P:

            q = (xj - yj + yi, yj + xj - xi)

            r = (xi - yj + yi, yi + xj - xi)

            if q in P and r in P:

                ans = max(ans, (xi - xj) ** 2 + (yi - yj) ** 2)

    print(ans)
while True:

    n = eval(input())

    if n == 0: break

    P = [(list(map(int, input().split()))) for i in range(n)]

    S = set(map(tuple, P))

    ans = 0

    for i in range(n - 1):

        xi, yi = P[i]

        for j in range(i + 1, n):

            xj, yj = P[j]

            q = (xj - yj + yi, yj + xj - xi)

            r = (xi - yj + yi, yi + xj - xi)

            if q in S and r in S:

                ans = max(ans, (xi - xj) ** 2 + (yi - yj) ** 2)

    print(ans)
while True:
    n = eval(input())
    if n == 0:
        break
    P = set(tuple(map(int, input().split())) for i in range(n))
    ans = 0
    for xi, yi in P:
        for xj, yj in P:
            q = (xj - yj + yi, yj + xj - xi)
            r = (xi - yj + yi, yi + xj - xi)
            if q in P and r in P:
                ans = max(ans, (xi - xj) ** 2 + (yi - yj) ** 2)
    print(ans)

while True:
    n = eval(input())
    if n == 0:
        break
    P = [(list(map(int, input().split()))) for i in range(n)]
    S = set(map(tuple, P))
    ans = 0
    for i in range(n - 1):
        xi, yi = P[i]
        for j in range(i + 1, n):
            xj, yj = P[j]
            q = (xj - yj + yi, yj + xj - xi)
            r = (xi - yj + yi, yi + xj - xi)
            if q in S and r in S:
                ans = max(ans, (xi - xj) ** 2 + (yi - yj) ** 2)
    print(ans)

-    P = set(tuple(map(int, input().split())) for i in range(n)) +    P = [(list(map(int, input().split()))) for i in range(n)] +    S = set(map(tuple, P)) -    for xi, yi in P: -        for xj, yj in P: +    for i in range(n - 1): +        xi, yi = P[i] +        for j in range(i + 1, n): +            xj, yj = P[j] -            if q in P and r in P: +            if q in S and r in S: