dist [x0,y0] [x1,y1] = (x1-x0)^2 + (y1-y0)^2

ans' (p:[]) = []
ans' (p:ps) =
  let m = minimum $ map (dist p) ps
  in
    m:(ans' ps)

ans p = minimum $ ans' p

main = do
  _ <- getLine
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  print o
                                                  

