def main():

  while True:

    n = int(eval(input()))

    if not n:

      break

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

    dic = set()

    for t in ps:

      dic.add((t[0],t[1]))

    ans = 0

  

    for i in range(n):

      for j in range(n):

        p1 = ps[i]

        p2 = ps[j]

        p1x = p1[0]

        p1y = p1[1]

        p2x = p2[0]

        p2y = p2[1]

        vx = p2x - p1x

        vy = p2y - p1y

        if (p1x + vy, p1y - vx) in dic and (p2x + vy, p2y - vx) in dic:

          ans = max(ans, vx ** 2 + vy ** 2)

    



    print(ans)

main()  







def main():

  while True:

    n = int(eval(input()))

    if not n:

      break

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

    dic = set()

    for t in ps:

      dic.add((t[0],t[1]))

    ans = 0

  

    for i in range(n):

      p1 = ps[i]

      p1x = p1[0]

      p1y = p1[1]

      for j in range(n):

        p2 = ps[j]

        p2x = p2[0]

        p2y = p2[1]

        vx = p2x - p1x

        vy = p2y - p1y

        if (p1x + vy, p1y - vx) in dic and (p2x + vy, p2y - vx) in dic:

          ans = max(ans, vx ** 2 + vy ** 2)

    



    print(ans)

main()  







def main():
    while True:
        n = int(eval(input()))
        if not n:
            break
        ps = [list(map(int, input().split())) for i in range(n)]
        dic = set()
        for t in ps:
            dic.add((t[0], t[1]))
        ans = 0
        for i in range(n):
            for j in range(n):
                p1 = ps[i]
                p2 = ps[j]
                p1x = p1[0]
                p1y = p1[1]
                p2x = p2[0]
                p2y = p2[1]
                vx = p2x - p1x
                vy = p2y - p1y
                if (p1x + vy, p1y - vx) in dic and (p2x + vy, p2y - vx) in dic:
                    ans = max(ans, vx**2 + vy**2)
        print(ans)


main()

def main():
    while True:
        n = int(eval(input()))
        if not n:
            break
        ps = [list(map(int, input().split())) for i in range(n)]
        dic = set()
        for t in ps:
            dic.add((t[0], t[1]))
        ans = 0
        for i in range(n):
            p1 = ps[i]
            p1x = p1[0]
            p1y = p1[1]
            for j in range(n):
                p2 = ps[j]
                p2x = p2[0]
                p2y = p2[1]
                vx = p2x - p1x
                vy = p2y - p1y
                if (p1x + vy, p1y - vx) in dic and (p2x + vy, p2y - vx) in dic:
                    ans = max(ans, vx**2 + vy**2)
        print(ans)


main()

+            p1 = ps[i] +            p1x = p1[0] +            p1y = p1[1] -                p1 = ps[i] -                p1x = p1[0] -                p1y = p1[1]