require "set"

class Point
  def initialize(x, y)
    @x = x
    @y = y
  end
  attr_reader :x, :y

  def hash
    n = (self.x + self.y + 1)
    n * (n + 1) / 2 + self.y
  end

  def eql?(other)
    self.x == other.x and self.y == other.y
  end
end

class Square
  include Comparable

  def initialize(point_a = nil, point_b = nil)
    if point_b
      @area = (point_a.x - point_b.x)**2 + (point_a.y - point_b.y)**2
    else
      @area = 0
    end
  end
  attr_reader :area

  def <=>(other)
    self.area <=> other.area
  end
end

def check_square(points, point_a, point_b)
  diff_x = point_a.x - point_b.x
  diff_y = point_a.y - point_b.y

  p1 = Point.new(point_a.x + diff_y, point_a.y - diff_x)
  p2 = Point.new(point_b.x + diff_y, point_b.y - diff_x)
  p3 = Point.new(point_a.x - diff_y, point_a.y + diff_x)
  p4 = Point.new(point_b.x - diff_y, point_b.y + diff_x)

  if points.include? p1 and points.include? p2
    return Square.new(p1, p2)
  end

  if points.include? p3 and points.include? p4
    return Square.new(p3, p4)
  end

  nil
end

def main_calc(points)
  max_square = Square.new
  enum_a = points.each

  (points.length-1).times do |i|
    point_a = enum_a.next
    enum_b = points.each
    i.times { enum_b.next }

    (points.length-i-2).times do
      point_b = enum_b.next
      if square = check_square(points, point_a, point_b)
        max_square = square if max_square < square
      end
    end
  end

  max_square.area
end

output = []
open("nput.txt") do |f|
  loop do 
    count = f.readline.chomp.to_i
    break if count == 0

    points = Set.new
    count.times do
      line = f.readline.chomp
      x, y = line.split(" ").map(&:to_i)
      points# << Point.new(x, y)
    end
    output# << main_calc(points) 
  end
end

open("output.txt", "w") do |f|
  f.write output.join("\n")
end