import Control.Monad (replicateM)
import qualified Data.Set as Set

type Coord = (Int,Int)

main = do
    n <- readLn
    if n == 0 then return () else do
        cds <- replicateM n (getLine >>= return . coord . map read . words)
        print $ solve cds
        main

    where
    coord [x,y] = (x,y)

solve :: [Coord] -> Int
solve cds = cds' `seq` maximum' $ map area $ filter (formSquare cds') $
                [(cd0,cd1)|cd0<-cds, cd1<-cds, normDir cd0 cd1]
    where
    cds' = foldr Set.insert Set.empty cds

    maximum' [] = 0
    maximum' xs = maximum xs

    area ((x0,y0),(x1,y1)) = (x1-x0)^2 + (y1-y0)^2

    normDir (x0,y0) (x1,y1) = x0 < x1 && y0 <= y1

    formSquare cds' (cd0,cd1) =
            (cd2 `Set.member` cds') && (cd3 `Set.member` cds')
        where
        (cd2,cd3) = otherside (cd0,cd1)

    otherside ((x0,y0),(x1,y1)) = ((x0+x',y0+y'),(x1+x',y1+y'))
        where
        x' = y0 - y1
        y' = x1 - x0