Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. 

Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. The map contains mines with valuable resources, located at some points with integer coordinates. The sizes of mines are relatively small, i.e. they can be treated as points. The city should be built in such a way that all the mines are inside or on the border of the city square. 

Building a city takes large amount of money depending on the size of the city, so you have to build the city with the minimum area. Given the positions of the mines find the minimum possible area of the city.


-----Input-----

The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers x_{i} and y_{i} — the coordinates of the corresponding mine ( - 10^9 ≤ x_{i}, y_{i} ≤ 10^9). All points are pairwise distinct.


-----Output-----

Print the minimum area of the city that can cover all the mines with valuable resources.


-----Examples-----
Input
2
0 0
2 2

Output
4

Input
2
0 0
0 3

Output
9

Source: codeforces | Difficulty: EASY
Tags: Complete search

Greedy algorithms


Solutions:
n = int(input())
lis = []
for i in range(n):
	lis.append(input().split())
for i in range(n):
	for j in range(2):
		lis[i][j] = int(lis[i][j])
lis0 = []
lis1 = []
for i in range(n):
	lis0.append(lis[i][0])
	lis1.append(lis[i][1])
if n == 1:
	print(1)
else:
	m = max(max(lis0) - min(lis0), max(lis1) - min(lis1))
	print(m ** 2)


from sys import *
inp = lambda : stdin.readline()
m = 10000000000.0

def main():
	n = int(inp())
	(px, nx, py, ny) = (-m, m, -m, m)
	for i in range(n):
		(a, b) = map(int, inp().split())
		(px, nx, py, ny) = (max(px, a), min(nx, a), max(py, b), min(ny, b))
	print(max(px - nx, py - ny) ** 2)
main()


n = int(input())
(minx, miny, maxx, maxy) = (1000000000, 10000000000, -10000000000, -1000000000)
for i in range(n):
	(x, y) = map(int, input().split())
	minx = min(minx, x)
	miny = min(miny, y)
	maxx = max(maxx, x)
	maxy = max(maxy, y)
sidex = maxx - minx
sidey = maxy - miny
ans = max(sidex, sidey)
print(ans * ans)


def shag(x, y, xmin, ymin):
	(a, b) = list(map(int, input().split()))
	x = max(a, x)
	y = max(b, y)
	xmin = min(a, xmin)
	ymin = min(b, ymin)
	return (x, y, xmin, ymin)
k = int(input())
(x, y) = list(map(int, input().split()))
xmin = x
ymin = y
for i in range(1, k, 1):
	(x, y, xmin, ymin) = shag(x, y, xmin, ymin)
print(pow(max(x - xmin, y - ymin), 2))


def main():
	n = int(input())
	mines = []
	(minx, miny, maxx, maxy) = (1000000000.0, 11000000000.0, -1000000000.0, -1000000000.0)
	for _ in range(n):
		(x, y) = map(int, input().split())
		minx = min(minx, x)
		maxx = max(maxx, x)
		miny = min(miny, y)
		maxy = max(maxy, y)
	sidex = maxx - minx
	sidey = maxy - miny
	res = max(sidex, sidey) ** 2
	print(res)
main()


n = int(input())
x = []
y = []
for i in range(n):
	(a, b) = list(map(int, input().split()))
	x.append(a)
	y.append(b)
x.sort()
y.sort()
print(max(x[-1] - x[0], y[-1] - y[0]) ** 2)


import sys
casos = int(input())
minx = 1000000001
miny = 1000000001
maxx = -1000000001
maxy = -1000000001
for i in range(casos):
	line = input()
	v = [int(x) for x in line.split()]
	minx = min(minx, v[0])
	miny = min(miny, v[1])
	maxx = max(maxx, v[0])
	maxy = max(maxy, v[1])
resp = max(maxx - minx, maxy - miny)
print(resp * resp)


n = int(input())
mina = 10000000000.0
maxa = -10000000000.0
minb = 10000000000.0
maxb = -10000000000.0
for _ in range(n):
	(a, b) = map(int, input().split())
	mina = min(mina, a)
	maxa = max(maxa, a)
	minb = min(minb, b)
	maxb = max(maxb, b)
result = max(abs(maxa - mina), abs(maxb - minb))
print(result * result)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	if not i:
		a = b = x
		u = v = y
	(a, b) = (min(a, x), max(b, x))
	(u, v) = (min(u, y), max(v, y))
print(max(b - a, v - u) ** 2)


n = int(input())
maxx = maxy = -10 ** 10
minx = miny = 10 ** 10
for i in range(n):
	(x, y) = map(int, input().split())
	if x > maxx:
		maxx = x
	if y > maxy:
		maxy = y
	if y < miny:
		miny = y
	if x < minx:
		minx = x
print(max(maxx - minx, maxy - miny) ** 2)


(a, b) = ([], [])
for _ in range(int(input())):
	l = list(map(int, input().split()))
	a.append(l[0])
	b.append(l[1])
print(max(max(a) - min(a), max(b) - min(b)) ** 2)


ps = map(lambda _: tuple(map(int, str.split(input()))), range(int(input())))
lx = rx = ty = by = None
foo = lambda v, cv, f: cv if v is None else f(v, cv)
for (x, y) in ps:
	lx = foo(lx, x, min)
	rx = foo(rx, x, max)
	by = foo(by, y, min)
	ty = foo(ty, y, max)
print(max(abs(lx - rx), abs(by - ty)) ** 2)


n = int(input())
(x1, y1) = map(int, input().split())
(x2, y2) = (x1, y1)
for i in range(n - 1):
	(x, y) = map(int, input().split())
	(x1, x2) = (min(x1, x), max(x2, x))
	(y1, y2) = (min(y1, y), max(y2, y))
print(max(x2 - x1, y2 - y1) ** 2)


n = int(input())
(N, M) = (10000000000, -10000000000)
(lx, rx, dy, uy) = (N, M, N, M)
for i in range(n):
	(x, y) = map(int, input().split())
	lx = min(lx, x)
	rx = max(rx, x)
	dy = min(dy, y)
	uy = max(uy, y)
t = max(rx - lx, uy - dy)
print(t * t)


a1 = []
a2 = []
x = int(input())
for i in range(x):
	(a, b) = map(int, input().split(' '))
	a1.append(a)
	a2.append(b)
print(max(max(a1) - min(a1), max(a2) - min(a2)) ** 2)


n = int(input())
minX = 1000000005
minY = minX
maxX = -1000000005
maxY = maxX
for i in range(n):
	(t, t2) = map(int, input().split())
	minY = min(minY, t2)
	maxY = max(maxY, t2)
	minX = min(minX, t)
	maxX = max(maxX, t)
print(max(maxX - minX, maxY - minY) ** 2)


n = int(input())
a = d = 10 ** 10
b = c = -1 * 10 ** 10
for i in range(n):
	(x, y) = map(int, input().split())
	a = min(a, x)
	b = max(b, x)
	c = max(c, y)
	d = min(d, y)
print(max((b - a) ** 2, (c - d) ** 2))


n = int(input())
min_x = 10 ** 9 + 1
min_y = 10 ** 9 + 1
max_x = -10 ** 9 - 1
max_y = -10 ** 9 - 1
for i in range(n):
	(x, y) = map(int, input().split())
	if x > max_x:
		max_x = x
	if x < min_x:
		min_x = x
	if y > max_y:
		max_y = y
	if y < min_y:
		min_y = y
print(max(max_x - min_x, max_y - min_y) ** 2)


n = int(input())
max_r = 0
(x, y) = map(int, input().split())
minX = x
maxX = x
minY = y
maxY = y
for i in range(n - 1):
	(x, y) = map(int, input().split())
	minX = min(minX, x)
	maxX = max(maxX, x)
	minY = min(minY, y)
	maxY = max(maxY, y)
print(max(maxX - minX, maxY - minY) ** 2)


n = int(input())
(dx, dy) = (0, 0)
points = set()
for i in range(n):
	(x, y) = map(int, input().split())
	for (a, b) in points:
		dx = max(dx, abs(x - a))
		dy = max(dy, abs(y - b))
	points.add((x, y))
print(max(dx, dy) ** 2)


n = int(input())
x = []
y = []
for i in range(n):
	(a, b) = list(map(int, input().rstrip().split()))
	x += [a]
	y += [b]
x1 = max(x) - min(x)
y1 = max(y) - min(y)
s = max(x1, y1)
print(s * s)


n = int(input())
X = []
Y = []
for i in range(n):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
X.sort()
Y.sort()
s = max(X[n - 1] - X[0], Y[n - 1] - Y[0])
print(s * s)


from fractions import gcd
from sys import stdin
lines = list([_f for _f in stdin.read().split('\n') if _f])

def parseline(line):
	return list(map(int, line.split()))
lines = list(map(parseline, lines))
(n,) = lines[0]
INF = 10 ** 9 + 1
maxx = -INF
maxy = -INF
minx = INF
miny = INF
for (xi, yi) in lines[1:n + 1]:
	maxx = max(maxx, xi)
	minx = min(minx, xi)
	maxy = max(maxy, yi)
	miny = min(miny, yi)
print(max(maxx - minx, maxy - miny) ** 2)


n = int(input())
(x, y) = ([], [])
for i in range(n):
	(x1, y1) = input().split()
	x.append(int(x1))
	y.append(int(y1))
maxx = max(x) - min(x)
maxy = max(y) - min(y)
if maxy > maxx:
	print(maxy * maxy)
else:
	print(maxx * maxx)


(x, y) = zip(*[map(int, input().split()) for i in range(int(input()))])
print(max((max(i) - min(i) for i in [x, y])) ** 2)


n = int(input())
xa = []
ya = []
for _ in range(n):
	(x, y) = map(int, input().split())
	xa.append(x)
	ya.append(y)
print(max(max(xa) - min(xa), max(ya) - min(ya)) ** 2)


n = int(input())
(min_x, min_y) = (10 ** 10, 10 ** 10)
(max_x, max_y) = (-10 ** 10, -10 ** 10)
for i in range(n):
	coord = list(map(int, input().split()))
	if coord[0] < min_x:
		min_x = coord[0]
	if coord[0] > max_x:
		max_x = coord[0]
	if coord[1] < min_y:
		min_y = coord[1]
	if coord[1] > max_y:
		max_y = coord[1]
print(max(max_x - min_x, max_y - min_y) ** 2)


n = int(input())
(l, r) = (10 ** 9, -10 ** 9)
(b, t) = (10 ** 9, -10 ** 9)
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	l = min(x, l)
	r = max(x, r)
	b = min(y, b)
	t = max(y, t)
print(max(r - l, t - b) ** 2)


import time, math, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count

def solve():
	n = II()
	li = []
	for i in range(n):
		li.append(L())
	l1 = sorted(li, key=lambda x: x[0])
	l2 = sorted(li, key=lambda x: x[1])
	left = abs(l1[0][0] - l1[-1][0])
	right = abs(l2[0][1] - l2[-1][1])
	print(max(left, right) ** 2)
solve()


n = int(input(''))
a = []
b = []
for i in range(n):
	(x, y) = input('').split()
	a.append(int(x))
	b.append(int(y))
max = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] - a[j]) ** 2 > max:
			max = (a[i] - a[j]) ** 2
			d = {'a': max}
		if (b[i] - b[j]) ** 2 > max:
			max = (b[i] - b[j]) ** 2
			d = {'a': max}
print(d['a'])


n = int(input())
(min_x, min_y, max_x, max_y) = (10 ** 9, 10 ** 9, -10 ** 9, -10 ** 9)
for _ in range(n):
	(x, y) = (int(num) for num in input().split(' '))
	(min_x, min_y) = (min(x, min_x), min(y, min_y))
	(max_x, max_y) = (max(x, max_x), max(y, max_y))
print(max(max_x - min_x, max_y - min_y) ** 2)


n = int(input())
(xpos, ypos) = ([], [])
for x in range(n):
	string = input()
	numbers = string.split()
	xpos.append(int(numbers[0]))
	ypos.append(int(numbers[1]))
print(max(max(xpos) - min(xpos), max(ypos) - min(ypos)) ** 2)


n = int(input())
x = []
y = []
for i in range(n):
	(p, q) = list(map(int, input().split()))
	x.append(p)
	y.append(q)
dx = max(x) - min(x)
dy = max(y) - min(y)
print(max(dx, dy) ** 2)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input().rstrip())
min_x = 10 ** 9 + 7
max_x = -1 * (10 ** 9 + 7)
min_y = 10 ** 9 + 7
max_y = -1 * (10 ** 9 + 7)
for _ in range(n):
	(x, y) = list(map(int, input().rstrip().split()))
	min_x = min(min_x, x)
	max_x = max(max_x, x)
	min_y = min(min_y, y)
	max_y = max(max_y, y)
m1 = max(max_x - min_x, max_y - min_y)
print(m1 ** 2)


n = int(input())
x = []
y = []
for i in range(n):
	(x1, y1) = input().split()
	x1 = int(x1)
	y1 = int(y1)
	x.append(x1)
	y.append(y1)
mx = max(x)
mnx = min(x)
my = max(y)
mny = min(y)
d1 = abs(mx - mnx)
d2 = abs(my - mny)
d3 = max(d1, d2)
print(d3 * d3)


n = int(input())
x = []
y = []
for i in range(n):
	(xi, yi) = [int(i) for i in input().split()]
	x.append(xi)
	y.append(yi)
a = max(max(y) - min(y), max(x) - min(x))
print(a * a)


n = int(input())
(xl, yl) = map(int, input().split())
(xr, yr) = map(int, input().split())
if xl > xr:
	(xl, xr) = (xr, xl)
if yl > yr:
	(yl, yr) = (yr, yl)
for i in range(n - 2):
	(x, y) = map(int, input().split())
	xl = min(xl, x)
	xr = max(xr, x)
	yl = min(yl, y)
	yr = max(yr, y)
print(max(yr - yl, xr - xl) ** 2)


n = input()
n = int(n)
m = [input().split() for i in range(n)]
m0 = [int(m[i][0]) for i in range(n)]
m1 = [int(m[i][1]) for i in range(n)]
ans = max(max(m0) - min(m0), max(m1) - min(m1))
print(ans * ans)


n = int(input())
INF = 99 ** 9
x_l = INF
x_h = -INF
y_l = INF
y_h = -INF
for i in range(n):
	(x, y) = map(int, input().split())
	x_l = min(x, x_l)
	x_h = max(x, x_h)
	y_l = min(y, y_l)
	y_h = max(y, y_h)
xx = x_h - x_l
yy = y_h - y_l
print(max(xx, yy) ** 2)


import sys
import math
n = int(sys.stdin.readline())
xmin = ymin = 1000000001
xmax = ymax = -1000000001
for i in range(n):
	(x, y) = [int(x) for x in sys.stdin.readline().split()]
	if x > xmax:
		xmax = x
	if y > ymax:
		ymax = y
	if x < xmin:
		xmin = x
	if y < ymin:
		ymin = y
t = max(int(math.fabs(xmax - xmin)), int(math.fabs(ymax - ymin)))
print(t ** 2)


number_of_mines = int(input())
x_coords = []
y_coords = []
for _ in range(number_of_mines):
	(x, y) = (int(value) for value in input().split())
	x_coords.append(x)
	y_coords.append(y)
print(max(abs(max(x_coords) - min(x_coords)), abs(max(y_coords) - min(y_coords))) ** 2)


n = int(input())
tmp = [int(i) for i in input().split()]
left = tmp[0]
right = tmp[0]
up = tmp[1]
down = tmp[1]
for i in range(1, n):
	tmp = [int(i) for i in input().split()]
	if left > tmp[0]:
		left = tmp[0]
	if right < tmp[0]:
		right = tmp[0]
	if up < tmp[1]:
		up = tmp[1]
	if down > tmp[1]:
		down = tmp[1]
print(pow(max(right - left, up - down), 2))


n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	a.append(x)
	b.append(y)
s = max(a) - min(a)
t = max(b) - min(b)
if s > t:
	print(s * s)
else:
	print(t * t)


import sys
input = sys.stdin.readline

def I():
	return input().strip()

def II():
	return int(input().strip())

def LI():
	return [*map(int, input().strip().split())]
import copy, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter, OrderedDict
from operator import itemgetter
import itertools
for _ in range(1):
	n = II()
	z = 0
	l1 = []
	l2 = []
	for i in range(n):
		(x, y) = LI()
		l1.append(x)
		l2.append(y)
	print(max(max(l1) - min(l1), max(l2) - min(l2)) ** 2)


n = int(input())
(X1, Y1, X2, Y2) = (10 ** 9 * 2, 10 ** 9 * 2, -10 ** 9 * 2, -10 ** 9 * 2)
for i in range(n):
	(x, y) = map(int, input().split())
	(X1, Y1, X2, Y2) = (min(X1, x), min(Y1, y), max(X2, x), max(Y2, y))
print(max(X2 - X1, Y2 - Y1) ** 2)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
nb_mines = RI()
(x_coord, y_coord) = ([], [])
for _ in range(nb_mines):
	(x, y) = RMI()
	x_coord.append(x)
	y_coord.append(y)
candidate_x = max(x_coord) - min(x_coord)
candidate_y = max(y_coord) - min(y_coord)
sides = max(candidate_x, candidate_y)
print(sides ** 2)


n = int(input())
(l, r, u, d) = (int(10000000000.0), -int(10000000000.0), -int(10000000000.0), int(10000000000.0))
for i in ' ' * n:
	(x, y) = map(int, input().split())
	l = min(l, y)
	r = max(y, r)
	u = max(u, x)
	d = min(d, x)
print(max((r - l) ** 2, (u - d) ** 2))


n = int(input())
(l, r, u, d) = (10 ** 10, -10 ** 10, 10 ** 10, -10 ** 10)
for i in range(n):
	(a, b) = map(int, input().split())
	l = min(a, l)
	r = max(a, r)
	u = min(u, b)
	d = max(d, b)
print(max(d - u, r - l) ** 2)


n = int(input())
mx = 10000000000
my = 10000000000
vx = -10000000000
vy = -10000000000
for i in range(n):
	(a, b) = map(int, input().split())
	mx = min(mx, a)
	vx = max(vx, a)
	my = min(my, b)
	vy = max(vy, b)
print(max(vx - mx, vy - my) * max(vx - mx, vy - my))


import sys
n = int(sys.stdin.readline())
mx = -1234567890
my = -1234567890
nx = 1234567890
ny = 1234567890
for i in range(n):
	(x, y) = map(int, sys.stdin.readline().split())
	mx = max(mx, x)
	my = max(my, y)
	nx = min(nx, x)
	ny = min(ny, y)
print(max(mx - nx, my - ny) ** 2)


def splIn():
	return list(map(int, input().split()))

def zz1dif(z, z2):
	if z >= 0:
		return z2 - z
	elif z2 <= 0:
		return abs(z) - abs(z2)
	else:
		return abs(z) + abs(z2)
n = int(input())
firstxy = splIn()
xmin = firstxy[0]
xmax = firstxy[0]
ymin = firstxy[1]
ymax = firstxy[1]
for i in range(n - 1):
	xy = splIn()
	if xy[0] > xmax:
		xmax = xy[0]
	if xy[0] < xmin:
		xmin = xy[0]
	if xy[1] > ymax:
		ymax = xy[1]
	if xy[1] < ymin:
		ymin = xy[1]
z1 = zz1dif(xmin, xmax)
z2 = zz1dif(ymin, ymax)
maxSize = max(z1, z2)
result = maxSize * maxSize
print(result)


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
n = INT()
l1 = []
l2 = []
for i in range(n):
	(x, y) = MAP()
	l1.append(x)
	l2.append(y)
minx = min(l1)
miny = min(l2)
maxx = max(l1)
maxy = max(l2)
k = max(maxx - minx, maxy - miny)
print(k ** 2)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def intArr():
	return map(int, input().split())

def In():
	return int(input())

def main():
	n = In()
	x = [0] * n
	y = [0] * n
	for i in range(n):
		(x[i], y[i]) = intArr()
	print(pow(max(max(x) - min(x), max(y) - min(y)), 2))
main()


n = int(input())
(x, y) = input().split(' ')
(x, y) = (int(x), int(y))
min_y = y
max_y = y
min_x = x
max_x = x
for x in range(n - 1):
	(x, y) = input().split(' ')
	(x, y) = (int(x), int(y))
	if x > max_x:
		max_x = x
	if x < min_x:
		min_x = x
	if y > max_y:
		max_y = y
	if y < min_y:
		min_y = y
print(max(max_y - min_y, max_x - min_x) ** 2)


import array

def solution():
	size = int(input())
	intervals = array_to_int(input().split(' '))
	minx = intervals[0]
	maxx = intervals[0]
	miny = intervals[1]
	maxy = intervals[1]
	for i in range(size - 1):
		intervals = array_to_int(input().split(' '))
		if intervals[0] > maxx:
			maxx = intervals[0]
		elif intervals[0] < minx:
			minx = intervals[0]
		if intervals[1] > maxy:
			maxy = intervals[1]
		elif intervals[1] < miny:
			miny = intervals[1]
	a = maxx - minx
	b = maxy - miny
	if a == 0:
		print(b ** 2)
	elif b == 0:
		print(a ** 2)
	else:
		if a > b:
			b = a
		elif b > a:
			a = b
		print(a * b)

def count_of_one(number):
	result = 0
	while number:
		result += number % 2
		number //= 2
	return result

def to_mixed_frac(first, second):
	while True:
		for i in range(2, first + 1):
			if first % i == 0 and second % i == 0:
				first //= i
				second //= i
				break
		else:
			break
	return str(first) + '/' + str(second)

def array_to_int(array):
	for i in range(len(array)):
		array[i] = int(array[i])
	return array

def join0(array):
	result = ''
	for i in array:
		result += str(i)
	return result

def replace(string, new_ch, index):
	new_str = ''
	for i in range(len(string)):
		if i == index:
			new_str += new_ch
		else:
			new_str += string[i]
	return new_str
solution()


(a, b) = ([], [])
for i in range(int(input())):
	(x, y) = input().split()
	a.append(int(x))
	b.append(int(y))
print(max(max(a) - min(a), max(b) - min(b)) ** 2)


a = int(input())
(l, r, u, d) = (int(10000000000.0), -int(10000000000.0), -int(10000000000.0), int(10000000000.0))
for _ in ' ' * a:
	(x, y) = map(int, input().split())
	l = min(l, y)
	r = max(y, r)
	u = max(u, x)
	d = min(d, x)
print(max((r - l) ** 2, (u - d) ** 2))


mode = 'filee'
if mode == 'file':
	f = open('test.txt', 'r')
g = []
h = []
if mode == 'file':
	n = int(f.readline())
else:
	n = int(input())
for z in range(n):
	if mode == 'file':
		[x, y] = [int(x) for x in f.readline().split()]
	else:
		[x, y] = [int(x) for x in input().split()]
	g.append(x)
	h.append(y)
print(max(max(g) - min(g), max(h) - min(h)) ** 2)
if mode == 'file':
	f.close()


a = int(input(''))
XlistOfCoordinates = []
YlistOfCoordinates = []
for value in range(a):
	y = input('').split(' ')
	XlistOfCoordinates.append(int(y[0]))
	YlistOfCoordinates.append(int(y[1]))
print(max(max(XlistOfCoordinates) - min(XlistOfCoordinates), max(YlistOfCoordinates) - min(YlistOfCoordinates)) ** 2)


n = int(input())
x = []
y = []
for _ in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
x.sort()
y.sort()
cnt = max(x[-1] - x[0], y[-1] - y[0])
print(cnt * cnt)


def main():
	n = int(input())
	(xs, ys) = ([], [])
	for _ in range(n):
		(x, y) = map(int, input().split())
		xs.append(x)
		ys.append(y)
	print(max(max(xs) - min(xs), max(ys) - min(ys)) ** 2)
main()


def main():
	n = int(input())
	(lx, ly) = ([], [])
	for _ in range(n):
		(x, y) = map(int, input().split())
		lx.append(x)
		ly.append(y)
	print(max((max(l) - min(l) for l in (lx, ly))) ** 2)
main()


max_x = max_y = 0
min_x = min_y = 10 ** 9
xs = []
ys = []
for i in range(int(input())):
	(x, y) = map(int, input().split())
	xs.append(x)
	ys.append(y)
print(max(max(xs) - min(xs), max(ys) - min(ys)) ** 2)


def solve(ps):
	return max(max(ps, key=lambda x: x[0])[0] - min(ps, key=lambda x: x[0])[0], max(ps, key=lambda x: x[1])[1] - min(ps, key=lambda x: x[1])[1]) ** 2
n = int(input())
ps = [list(map(int, input().split())) for i in range(n)]
print(solve(ps))


n = int(input())
X = []
Y = []
for i in range(n):
	(x, y) = input().split()
	X.append(int(x))
	Y.append(int(y))
maxx = max(X)
maxy = max(Y)
minx = min(X)
miny = min(Y)
x1 = abs(maxx - minx)
y1 = abs(maxy - miny)
print(max(x1, y1) ** 2)


from copy import copy
n = int(input())
ox = []
oy = []
xmax = -10000000000000000000
xmin = 10 ** 10
ymax = -1000000000000000000
ymin = 10 ** 10
for i in range(n):
	(x, y) = map(int, input().split())
	if x > xmax:
		xmax = copy(x)
	if x < xmin:
		xmin = copy(x)
	if y > ymax:
		ymax = copy(y)
	if y < ymin:
		ymin = copy(y)
dx = xmax - xmin
dy = ymax - ymin
a = max(dy, dx)
print(a ** 2)


from __future__ import division, print_function
from io import BytesIO, IOBase
import os, sys, math, heapq, copy
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
from functools import cmp_to_key
from itertools import permutations, combinations, combinations_with_replacement
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 1000000007

def get_int():
	return int(sys.stdin.readline().strip())

def get_str():
	return sys.stdin.readline().strip()

def get_float():
	return float(sys.stdin.readline().strip())

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_strs():
	return map(str, sys.stdin.readline().strip().split())

def get_floats():
	return map(float, sys.stdin.readline().strip().split())

def list_ints():
	return list(map(int, sys.stdin.readline().strip().split()))

def list_strs():
	return list(map(str, sys.stdin.readline().strip().split()))

def list_floats():
	return list(map(float, sys.stdin.readline().strip().split()))
n = get_int()
sr = sc = math.inf
er = ec = -math.inf
for i in range(n):
	(x, y) = get_ints()
	sr = min(sr, x)
	sc = min(sc, y)
	er = max(er, x)
	ec = max(ec, y)
length = max(er - sr, ec - sc)
print(length * length)


def main():
	count = int(input())
	(x1, y1) = map(int, input().split())
	(x2, y2) = (x1, y1)
	for i in range(count - 1):
		(x, y) = map(int, input().split())
		x1 = min(x1, x)
		x2 = max(x2, x)
		y1 = min(y1, y)
		y2 = max(y2, y)
	dx = abs(x1 - x2)
	dy = abs(y1 - y2)
	dm = max(dx, dy)
	return dm ** 2
print(main())


n = int(input())
(px, py) = ([], [])
for i in range(n):
	(x, y) = list(map(int, input().split()))
	px.append(x)
	py.append(y)
print(max(max(px) - min(px), max(py) - min(py)) ** 2)


n = int(input())
minX = 10 ** 10
maxX = -10 ** 10
minY = 10 ** 10
maxY = -10 ** 10
for i in range(n):
	mine = list(map(int, input().split()))
	minX = min(mine[0], minX)
	maxX = max(mine[0], maxX)
	minY = min(mine[1], minY)
	maxY = max(mine[1], maxY)
print(max(maxX - minX, maxY - minY) ** 2)


n = int(input())
xx = []
yy = []
for i in range(n):
	(x, y) = map(int, input().split())
	xx.append(x)
	yy.append(y)
dx = max(xx) - min(xx)
dy = max(yy) - min(yy)
print(max(dx, dy) ** 2)


minx = 10 ** 10
maxx = -10 ** 10
miny = 10 ** 10
maxy = -10 ** 10
n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	minx = min(minx, x)
	maxx = max(maxx, x)
	miny = min(miny, y)
	maxy = max(maxy, y)
a = max(maxx - minx, maxy - miny)
print(a * a)


n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
x.sort()
y.sort()
res = max(x[-1] - x[0], y[-1] - y[0]) ** 2
print(res)


def precious(lst1, lst2):
	(l1, l2) = (sorted(lst1), sorted(lst2))
	return max(l1[len(l1) - 1] - l1[0], l2[len(lst2) - 1] - l2[0]) * max(l1[len(l1) - 1] - l1[0], l2[len(lst2) - 1] - l2[0])
n = int(input())
(a, b) = (list(), list())
for i in range(n):
	(s, t) = [int(j) for j in input().split()]
	a.append(s)
	b.append(t)
print(precious(a, b))


n = int(input())
(x, y) = ([], [])
for j in range(n):
	(xj, yj) = [int(j) for j in input().split()]
	x.append(xj)
	y.append(yj)
x_min = x[0]
y_min = y[0]
x_max = x[0]
y_max = y[0]
for j in range(1, n):
	x_min = min(x_min, x[j])
	y_min = min(y_min, y[j])
	x_max = max(x_max, x[j])
	y_max = max(y_max, y[j])
l = x_max - x_min
r = y_max - y_min
print(max(l, r) ** 2)


n = int(input())
(pointx, pointy) = ([], [])
for i in range(n):
	(x, y) = map(int, input().split())
	pointx.append(x)
	pointy.append(y)
ans = max(max(pointx) - min(pointx), max(pointy) - min(pointy))
print(ans * ans)


n = int(input())
p = []
s = []
for i in range(n):
	(x, y) = map(int, input().split())
	p.append(x)
	s.append(y)
p.sort()
s.sort()
p = p[-1] - p[0]
s = s[-1] - s[0]
print(max(p, s) ** 2)


import traceback
import math
from collections import defaultdict
from functools import lru_cache
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def geti():
	return int(input())

def gets():
	return input()

def getil():
	return list(map(int, input().split()))

def getsl():
	return input().split()

def get2d(nrows, ncols, n=0):
	return [[n] * ncols for r in range(nrows)]
inf = float('inf')
mod = 10 ** 9 + 7

def main():
	N = geti()
	(a, b) = ([], [])
	for _ in range(N):
		(x, y) = getil()
		a.append(x)
		b.append(y)
	lx = max(a) - min(a)
	ly = max(b) - min(b)
	return max(lx, ly) ** 2
try:
	ans = main()
	print(ans)
except Exception as e:
	traceback.print_exc()


n = int(input())
X = []
Y = []
for i in range(n):
	(x, y) = [int(s) for s in input().split()]
	X.append(x)
	Y.append(y)
height = max(Y) - min(Y)
width = max(X) - min(X)
print(max(height, width) ** 2)


n = int(input())
(x, y) = map(int, input().split())
xmin = x
xmax = x
ymin = y
ymax = y
for i in range(n - 1):
	(x, y) = map(int, input().split())
	xmin = min(xmin, x)
	xmax = max(xmax, x)
	ymin = min(ymin, y)
	ymax = max(ymax, y)
print(max(ymax - ymin, xmax - xmin) ** 2)


a = int(input())
(x, y) = map(int, input().split())
minx = x
maxx = x
miny = y
maxy = y
for i in range(a - 1):
	(x, y) = map(int, input().split())
	minx = min(minx, x)
	maxx = max(maxx, x)
	miny = min(miny, y)
	maxy = max(maxy, y)
print(max(maxx - minx, maxy - miny) ** 2)


mx = -10 ** 10
mix = 10 ** 10
my = mx
miy = mix
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	mx = max(mx, a)
	mix = min(mix, a)
	my = max(my, b)
	miy = min(miy, b)
ans = max(mx - mix, my - miy)
print(ans * ans)


n = int(input())
paling_kanan = -1000000000
paling_kiri = 1000000000
paling_atas = -1000000000
paling_bawah = 1000000000
sisi_x = 0
sisi_y = 0
sisi_kota = 1
for i in range(n):
	(x, y) = map(int, input().split())
	paling_kiri = min(paling_kiri, x)
	paling_kanan = max(paling_kanan, x)
	paling_atas = max(paling_atas, y)
	paling_bawah = min(paling_bawah, y)
	sisi_x = paling_kanan - paling_kiri
	sisi_y = paling_atas - paling_bawah
if sisi_x >= sisi_y:
	sisi_kota = sisi_x
else:
	sisi_kota = sisi_y
luas_minimal = sisi_kota ** 2
print(luas_minimal)


lim = 10 ** 9
n = int(input())
(lx, rx, dy, uy) = (lim, -lim, lim, -lim)
for _ in range(n):
	(x, y) = map(int, input().split())
	lx = min(lx, x)
	rx = max(rx, x)
	dy = min(dy, y)
	uy = max(uy, y)
print(max(uy - dy, rx - lx) ** 2)


n = int(input())
xs = []
ys = []
for i in range(n):
	(x, y) = map(int, input().split())
	xs.append(x)
	ys.append(y)
print(max(max(xs) - min(xs), max(ys) - min(ys)) ** 2)


n = int(input())
l = []
mix = 1000000000
miy = 1000000000
max = -1000000000
may = -1000000000
for i in range(n):
	l.append(list(map(int, input().split())))
	if l[i][0] < mix:
		mix = l[i][0]
	if l[i][0] > max:
		max = l[i][0]
	if l[i][1] < miy:
		miy = l[i][1]
	if l[i][1] > may:
		may = l[i][1]
if abs(max - mix) > abs(may - miy):
	print((max - mix) ** 2)
else:
	print((may - miy) ** 2)


n = int(input())
x = []
y = []
for i in range(n):
	(p, q) = map(int, input().split())
	x += [p]
	y += [q]
l = max(x) - min(x)
w = max(y) - min(y)
print(max(l, w) ** 2)