require 'matrix'
class Vector
	include Comparable
	def <=>(other)
		to_a <=> other.to_a
	end
end

loop {
	n = gets.to_i
	break if n == 0
	points = (1..n).map{ Vector[*gets.split.map(&:to_i)]}.sort
	hash = {}
	points.each{|v| hash[v] = 0}
	
	max = 0
	for i in 0..points.size-1
		u = points[i]
		for j in i+1..points.size-1
			v = points[j]
			dir = (u[1] <= v[1] ? :clock : :anti)
			d = v - u
			a = (u[0]-v[0])**2 + (u[1]-v[1])**2
			next if a <= max
			d = (dir == :clock ? Vector[d[1], -d[0]] : Vector[-d[1], d[0]])
			u, v = v, v + d
			next unless hash[v]
			d = (dir == :clock ? Vector[d[1], -d[0]] : Vector[-d[1], d[0]])
			u, v = v, v + d
			if hash[v]
				max = a
			end
		end
	end
	p max
}