Keko has $N$ dots in a 2-D coordinate plane. He wants to measure the gap between the most distant two dots. To make the problem easier, Keko decided to change each dot's $\boldsymbol{x}$ or $y$ coordinate to zero.   

Help Keko calculate the distance!

Input Format

The first line contains an integer, $N$, the number of dots. 

The next $N$ lines each contain the integer coordinates of the dots in $(x,y)$ fashion.  

Constraints 

$2\leq N\leq10^6$ 

$-10^9\leq x_i,\ y_i\leq10^9$

It is guaranteed that all dots are distinct, and either their $\boldsymbol{x}$ or $y$ coordinate is equal to $0$.  

Output Format

Print the distance between the most distant dots with an absolute error of, at most, $\mathbf{10^{-6}}$.

Sample Input
4
-1 0
1 0
0 1
0 -1

Sample Output
2.000000

Explanation

In the sample, the most distant dots are located at $(-1,0)$ and $(1,0)$. 

The distance between them is $2$.

Difficulty: EASY

Solutions:
import math
N = int(input())
x_axis = []
y_axis = []
for _ in range(N):
	(x, y) = map(int, input().split())
	if x == 0:
		y_axis.append(y)
	if y == 0:
		x_axis.append(x)
x_axis.sort()
y_axis.sort()
if not x_axis:
	print(y_axis[-1] - y_axis[0])
elif not y_axis:
	print(x_axis[-1] - x_axis[0])
else:
	(xmin, xmax) = (x_axis[0], x_axis[-1])
	(ymin, ymax) = (y_axis[0], y_axis[-1])
	d = max((xmin * xmin + ymin * ymin, xmax * xmax + ymin * ymin, xmin * xmin + ymax * ymax, xmax * xmax + ymax * ymax))
	d = max(math.sqrt(d), x_axis[-1] - x_axis[0], y_axis[-1] - y_axis[0])
	print(d)


import math

def dist(x, y):
	return math.sqrt(x ** 2 + y ** 2)
n = int(input())
(Xl, Xr, Yd, Yt) = (1000000001, -1000000001, 1000000001, -1000000001)
for t in range(n):
	(x, y) = list(map(int, input().split()))
	if x == 0:
		if Yd > y:
			Yd = y
		if Yt < y:
			Yt = y
	if y == 0:
		if Xl > x:
			Xl = x
		if Xr < x:
			Xr = x
l = [Xr - Xl, Yt - Yd, dist(Xl, Yd), dist(Xl, Yt), dist(Xr, Yd), dist(Xr, Yt)]
print(max(l))


from math import sqrt
N = int(input())
(x, y) = [int(p) for p in input().split()]
x_min = x
x_max = x
y_min = y
y_max = y
for pt in range(N - 1):
	(x, y) = [int(p) for p in input().split()]
	if x < x_min:
		x_min = x
	if x > x_max:
		x_max = x
	if y < y_min:
		y_min = y
	if y > y_max:
		y_max = y
straigt_dists = max(y_max - y_min, x_max - x_min)
bigx = max(abs(x_min), abs(x_max))
bigy = max(abs(y_min), abs(y_max))
bigdist = max(sqrt(bigy ** 2 + bigx ** 2), straigt_dists)
print(bigdist)


n = int(input())
maxUp = -1 * 10 ** 9
maxDown = 10 ** 9
maxRight = -1 * 10 ** 9
maxLeft = 10 ** 9
for i in range(n):
	inp = list(map(int, input().split(' ')))
	if inp[0] == 0:
		if inp[1] > maxUp:
			maxUp = inp[1]
		if inp[1] < maxDown:
			maxDown = inp[1]
	else:
		if inp[0] > maxRight:
			maxRight = inp[0]
		if inp[0] < maxLeft:
			maxLeft = inp[0]
check0 = abs(maxUp - maxDown)
check1 = abs(maxRight - maxLeft)
check2 = (maxUp ** 2 + maxRight ** 2) ** 0.5
check3 = (maxUp ** 2 + maxLeft ** 2) ** 0.5
check4 = (maxDown ** 2 + maxRight ** 2) ** 0.5
check5 = (maxDown ** 2 + maxLeft ** 2) ** 0.5
print(max(max(check0, check1), max(max(check2, check3), max(check4, check5))))


import math
nod = int(input())
biggestX = -10 ** 9
smallestX = 10 ** 9
biggestY = -10 ** 9
smallestY = 10 ** 9
for i in range(0, nod):
	temp = input().split()
	x = int(temp[0])
	y = int(temp[1])
	biggestX = max(biggestX, x)
	biggestY = max(biggestY, y)
	smallestX = min(smallestX, x)
	smallestY = min(smallestY, y)
maxd = max(biggestX - smallestX, biggestY - smallestY, math.sqrt(smallestX ** 2 + smallestY ** 2), math.sqrt(biggestX ** 2 + biggestY ** 2), math.sqrt(smallestX ** 2 + biggestY ** 2), math.sqrt(biggestX ** 2 + smallestY ** 2))
print(maxd)


import math
xmax = -1000000000
xmin = 1000000000
ymax = -1000000000
ymin = 1000000000
for i in range(int(input())):
	(x, y) = input().split(' ')
	(x, y) = (int(x), int(y))
	if x > xmax:
		xmax = x
	if x < xmin:
		xmin = x
	if y > ymax:
		ymax = y
	if y < ymin:
		ymin = y
maxdistance = 0
if xmax - xmin > maxdistance:
	maxdistance = xmax - xmin
if ymax - ymin > maxdistance:
	maxdistance = ymax - ymin
if math.sqrt(ymax ** 2 + xmax ** 2) > maxdistance:
	maxdistance = math.sqrt(ymax ** 2 + xmax ** 2)
if math.sqrt(ymax ** 2 + xmin ** 2) > maxdistance:
	maxdistance = math.sqrt(ymax ** 2 + xmin ** 2)
if math.sqrt(ymin ** 2 + xmax ** 2) > maxdistance:
	maxdistance = math.sqrt(ymin ** 2 + xmax ** 2)
if math.sqrt(ymin ** 2 + xmin ** 2) > maxdistance:
	maxdistance = math.sqrt(ymin ** 2 + xmin ** 2)
print(maxdistance)


from math import sqrt
N = int(input().strip())
(negX, posX, negY, posY) = (0, 0, 0, 0)
for _ in range(N):
	[x, y] = [int(_) for _ in input().strip().split()]
	(negX, posX) = (min(negX, x), max(posX, x))
	(negY, posY) = (min(negY, y), max(posY, y))
	dist = max(posX - negX, posY - negY, sqrt(posX * posX + posY * posY), sqrt(posX * posX + negY * negY), sqrt(negX * negX + posY * posY), sqrt(negX * negX + negY * negY))
print(dist)


def main():
	n = int(input())
	maxX = -10000000000000
	maxY = -10000000000000
	minX = 10000000000000
	minY = 10000000000000
	for i in range(n):
		(x, y) = map(int, input().split())
		if x < minX:
			minX = x
		elif x > maxX:
			maxX = x
		if y < minY:
			minY = y
		elif y > maxY:
			maxY = y
	max1 = max(maxX - minX, maxY - minY)
	max2 = max((maxX ** 2 + maxY ** 2) ** 0.5, (minX ** 2 + minY ** 2) ** 0.5)
	max3 = max((maxX ** 2 + minY ** 2) ** 0.5, (minX ** 2 + maxY ** 2) ** 0.5)
	max4 = max(max2, max3)
	print(max(max1, max4))
	return 0
main()


import math

def main():
	n = int(input())
	max_Posy = max_Posx = min_Negy = min_Negx = 0
	for _ in range(n):
		(x, y) = list(map(int, input().split()))
		if x < 0:
			min_Negx = min(min_Negx, x)
		else:
			max_Posx = max(max_Posx, x)
		if y < 0:
			min_Negy = min(min_Negy, y)
		else:
			max_Posy = max(max_Posy, y)
	distance = max(max_Posx - min_Negx, max_Posy - min_Negy)
	distance = max(distance, math.sqrt(min_Negx ** 2 + max_Posy ** 2))
	distance = max(distance, math.sqrt(min_Negx ** 2 + min_Negy ** 2))
	distance = max(distance, math.sqrt(max_Posx ** 2 + max_Posy ** 2))
	distance = max(distance, math.sqrt(max_Posx ** 2 + min_Negy ** 2))
	print(distance)
main()


xmin = 0
xmax = 0
ymin = 0
ymax = 0
n = int(input())
for i in range(n):
	s = input()
	x = int(s.split()[0])
	y = int(s.split()[1])
	if x > xmax:
		xmax = x
	if x < xmin:
		xmin = x
	if y > ymax:
		ymax = y
	if y < ymin:
		ymin = y
d1 = abs(xmax - xmin)
d2 = abs(ymax - ymin)
if d2 > d1:
	d1 = d2
y = max(abs(ymin), ymax)
x = max(abs(xmin), xmax)
d3 = (x ** 2 + y ** 2) ** 0.5
if d3 > d1:
	d1 = d3
print(d1)


import math
n = int(input())
x = []
y = []
for i in range(n):
	dot = input().strip().split()
	if dot[0] == '0':
		y.append(int(dot[1]))
	else:
		x.append(int(dot[0]))
xmin = x[0]
xmax = x[0]
for elem in x:
	if elem < xmin:
		xmin = elem
	if elem > xmax:
		xmax = elem
ymin = y[0]
ymax = y[0]
for elem in y:
	if elem < ymin:
		ymin = elem
	if elem > ymax:
		ymax = elem
ydis = ymax - ymin
xdis = xmax - xmin
if xmin < 0:
	xmin = -xmin
if ymin < 0:
	ymin = -ymin
xabs = max(xmin, xmax)
yabs = max(ymin, ymax)
xydis = math.sqrt(xabs * xabs + yabs * yabs)
print(max(ydis, xdis, xydis))


from math import sqrt

def checkmost(most, newval):
	if most is None:
		return newval
	else:
		return newval if newval > most else most

def checkleast(least, newval):
	if least is None:
		return newval
	else:
		return newval if newval < least else least

def distxy(x, y):
	return sqrt(x * x + y * y)
n = int(input().strip())
umost = None
dmost = None
lmost = None
rmost = None
for _ in range(n):
	(x, y) = map(int, input().strip().split())
	if x == 0:
		umost = checkmost(umost, y)
		dmost = checkleast(dmost, y)
	if y == 0:
		lmost = checkleast(lmost, x)
		rmost = checkmost(rmost, x)
dists = [umost - dmost, rmost - lmost, distxy(umost, lmost), distxy(umost, rmost), distxy(dmost, lmost), distxy(dmost, rmost)]
mostdist = max(dists)
print('%.6f' % mostdist)


import sys
import math
t = int(input().strip())
x_max = -10 ** 9
x_min = 10 ** 9
y_max = -10 ** 9
y_min = 10 ** 9
for i in range(t):
	(_x, _y) = input().strip().split(' ')
	x = int(_x)
	y = int(_y)
	x_max = max(x, x_max)
	y_max = max(y, y_max)
	x_min = min(x, x_min)
	y_min = min(y, y_min)
d_x = abs(x_max - x_min)
d_y = abs(y_max - y_min)
d_diag = math.sqrt(max(x_max ** 2, x_min ** 2) + max(y_max ** 2, y_min ** 2))
result = max(d_x, max(d_y, d_diag))
print('{:06f}'.format(result))


(max_x, min_x, max_y, min_y) = (0, 0, 0, 0)
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x > max_x:
		max_x = x
	elif x < min_x:
		min_x = x
	if y > max_y:
		max_y = y
	elif y < min_y:
		min_y = y
print('{:.6f}'.format(max([max_x - min_x, max_y - min_y, (max([max_x, -min_x]) ** 2 + max([max_y, -min_y]) ** 2) ** 0.5])))


__author__ = 'Ward'
import math
N = int(input())
X = Y = False
(x, y) = map(int, input().split())
Up = Down = y
Left = Right = x
if x == 0:
	Y = True
if y == 0:
	X = True
for i in range(0, N - 1):
	(x, y) = map(int, input().split())
	Up = max(Up, y)
	Down = min(Down, y)
	Right = max(Right, x)
	Left = min(Left, x)
	if x == 0:
		Y = True
	if y == 0:
		X = True
ans = max(Up - Down, Right - Left)
if X and Y:
	ans = max(ans, math.sqrt(max(abs(Up), abs(Down)) ** 2 + max(abs(Left), abs(Right)) ** 2))
print(ans)


import math
N = int(input())
coordinates = [int(arr_temp) for arr_temp in input().strip().split(' ')]
lowX = coordinates[0]
highX = coordinates[0]
lowY = coordinates[1]
highY = coordinates[1]
while N > 1:
	coordinates = [int(arr_temp) for arr_temp in input().strip().split(' ')]
	X = coordinates[0]
	Y = coordinates[1]
	if X == 0:
		if Y < lowY:
			lowY = Y
		if Y > highY:
			highY = Y
	if Y == 0:
		if X < lowX:
			lowX = X
		if X > highX:
			highX = X
	N -= 1
maxDistX = highX - lowX
maxDistY = highY - lowY
if highX > -1 * lowX:
	maxAbsX = highX
else:
	maxAbsX = lowX
if highY > -1 * lowY:
	maxAbsY = highY
else:
	maxAbsY = lowY
maxDistXY = math.sqrt(maxAbsX * maxAbsX + maxAbsY * maxAbsY)
print(max([maxDistX, maxDistY, maxDistXY]))


n = int(input())
d = []
(max_x, max_y, min_x, min_y) = (-1000000000, -1000000000, 1000000000, 1000000000)
while n:
	(X, Y) = list(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
	n -= 1
d.append(max_x - min_x)
d.append(max_y - min_y)
(d1, d2, d3, d4) = (pow(max_x, 2), pow(min_x, 2), pow(max_y, 2), pow(min_y, 2))
d.append((d1 + d3) ** 0.5)
d.append((d1 + d4) ** 0.5)
d.append((d2 + d3) ** 0.5)
d.append((d2 + d4) ** 0.5)
print(round(max(d), 6))


import math
n = int(input())
arr1 = []
arr2 = []
for i in range(0, n):
	(a, b) = map(int, input().split())
	if a == 0:
		arr1.append(b)
	else:
		arr2.append(a)
arr1.sort()
arr2.sort()
max1 = 0
w = abs(arr1[0] - arr1[len(arr1) - 1])
x = abs(arr2[0] - arr2[len(arr2) - 1])
y = max(abs(arr2[0]), abs(arr2[len(arr2) - 1]))
z = max(abs(arr1[0]), abs(arr1[len(arr1) - 1]))
if w > x:
	max1 = w
else:
	max1 = x
if max1 < math.sqrt(y ** 2 + z ** 2):
	max1 = math.sqrt(y ** 2 + z ** 2)
print('{0:.6f}'.format(max1))


max_x = 0
max_y = 0
min_x = 0
min_y = 0
for i in range(int(input())):
	dot = list(map(int, input().split()))
	if dot[0] != 0:
		if dot[0] > max_x:
			max_x = dot[0]
			continue
		elif dot[0] < min_x:
			min_x = dot[0]
			continue
	elif dot[1] > max_y:
		max_y = dot[1]
		continue
	elif dot[1] < min_y:
		min_y = dot[1]
		continue
print(max(max_x - min_x, max_y - min_y, (max_x ** 2 + min_y ** 2) ** 0.5, (min_x ** 2 + max_y ** 2) ** 0.5, (max_x ** 2 + max_y ** 2) ** 0.5, (min_x ** 2 + min_y ** 2) ** 0.5))


t = int(input())

def distance_formula(a, b):
	(ax, ay) = a
	(bx, by) = b
	return ((bx - ax) ** 2 + (by - ay) ** 2) ** 0.5
xxx = []
yyy = []
for i in range(t):
	(x, y) = input().split()
	xxx.append(int(x))
	yyy.append(int(y))
maxDiff = 0
xmin = min(xxx)
xmax = max(xxx)
ymin = min(yyy)
ymax = max(yyy)
if xmax - xmin > maxDiff:
	maxDiff = xmax - xmin
if ymax - ymin > maxDiff:
	maxDiff = ymax - ymin
a = distance_formula((xmax, 0), (0, ymin))
if a > maxDiff:
	maxDiff = a
b = distance_formula((xmax, 0), (0, ymax))
if b > maxDiff:
	maxDiff = b
c = distance_formula((xmin, 0), (0, ymax))
if c > maxDiff:
	maxDiff = c
d = distance_formula((xmin, 0), (0, ymin))
if d > maxDiff:
	maxDiff = d
print(maxDiff)


import math
n = int(input())
arr1 = []
arr2 = []
for i in range(0, n):
	(a, b) = map(int, input().split())
	if a == 0:
		arr1.append(b)
	else:
		arr2.append(a)
arr1.sort()
arr2.sort()
max1 = 0
w = abs(arr1[0] - arr1[len(arr1) - 1])
x = abs(arr2[0] - arr2[len(arr2) - 1])
y = max(abs(arr2[0]), abs(arr2[len(arr2) - 1]))
z = max(abs(arr1[0]), abs(arr1[len(arr1) - 1]))
if w > x:
	max1 = w
else:
	max1 = x
if max1 < math.sqrt(y ** 2 + z ** 2):
	max1 = math.sqrt(y ** 2 + z ** 2)
print('{0:.6f}'.format(max1))


from math import sqrt
n = int(input())
(x, y) = (0, 0)
(xmin, xmax, ymin, ymax) = (10 ** 9, -10 ** 9, 10 ** 9, -10 ** 9)
for i in range(n):
	(u, v) = map(int, input().split())
	if xmin > u:
		xmin = u
	if xmax < u:
		xmax = u
	if ymin > v:
		ymin = v
	if ymax < v:
		ymax = v
	if u < 0:
		u = -u
	if v < 0:
		v = -v
	if x < u:
		x = u
	if y < v:
		y = v
ans = xmax - xmin
if ans < ymax - ymin:
	ans = ymax - ymin
if ans < sqrt(x * x + y * y):
	ans = sqrt(x * x + y * y)
print(ans)


from math import sqrt
N = int(input())
maxx = 0
maxy = 0
minx = 10 ** 9 + 1
miny = 10 ** 9 + 1
for _ in range(N):
	(x, y) = map(int, input().split())
	maxx = max(maxx, x)
	maxy = max(maxy, y)
	minx = min(minx, x)
	miny = min(miny, y)
maxabsx = max(abs(maxx), abs(minx))
maxabsy = max(abs(maxy), abs(miny))
c1 = sqrt(maxabsx ** 2 + maxabsy ** 2)
c2 = maxx - minx
c3 = maxy - miny
print(max(max(c1, c2), c3))


import math
n = int(input())
v1 = []
v2 = []
for i in range(0, n):
	(x, y) = map(int, input().split())
	if x == 0:
		v1.append(y)
	else:
		v2.append(x)
v1.sort()
v2.sort()
dst = 0
a = abs(v1[0] - v1[len(v1) - 1])
b = abs(v2[0] - v2[len(v2) - 1])
c = max(abs(v2[0]), abs(v2[len(v2) - 1]))
d = max(abs(v1[0]), abs(v1[len(v1) - 1]))
if a > b:
	dst = a
else:
	dst = b
if dst < math.sqrt(c ** 2 + d ** 2):
	dst = math.sqrt(c ** 2 + d ** 2)
print('{0:.6f}'.format(dst))


from math import sqrt

def main():
	N = int(input())
	dots = set()
	for i in range(N):
		(x, y) = [int(i) for i in input().split(' ')]
		dots.add((x, y))
	dot = dots.pop()
	xmax = xmin = dot[0]
	ymax = ymin = dot[1]
	for dot in dots:
		xmax = max(xmax, dot[0])
		xmin = min(xmin, dot[0])
		ymax = max(ymax, dot[1])
		ymin = min(ymin, dot[1])
	result = xmax - xmin
	result = max(ymax - ymin, result)
	result = max(sqrt(pow(max(xmax, abs(xmin)), 2) + pow(max(ymax, abs(ymin)), 2)), result)
	print(result)
main()


import math

def dist(a, b):
	return math.sqrt(a ** 2 + b ** 2)
n = int(input().strip())
for i in range(n):
	arr = [int(x) for x in input().strip().split(' ')]
	try:
		big = (max(arr[0], big[0]), max(arr[1], big[1]))
		small = (min(arr[0], small[0]), min(arr[1], small[1]))
	except NameError:
		big = (arr[0], arr[1])
		small = (arr[0], arr[1])
print(max(big[0] - small[0], big[1] - small[1], dist(big[0], big[1]), dist(small[0], small[1]), dist(big[0], small[1]), dist(small[0], big[1])))


from math import sqrt
n = int(input())
x = []
y = []
for i in range(0, n):
	tmp = [int(z) for z in input().split(' ')]
	x.append(tmp[0])
	y.append(tmp[1])
mix = min(x) ** 2
mxx = max(x) ** 2
miy = min(y) ** 2
mxy = max(y) ** 2
print(max(abs(max(x) - min(x)), abs(max(y) - min(y)), sqrt(mix + miy), sqrt(mxx + mxy), sqrt(mix + mxy), sqrt(mxx + miy)))


from sys import maxsize
from math import hypot
n = int(input().strip())
(x1, x2, y1, y2) = (0, 0, 0, 0)
while n > 0:
	n -= 1
	t = tuple(map(int, input().split()))
	if t[1] == 0:
		if t[0] < 0:
			x1 = max(x1, abs(t[0]))
		else:
			x2 = max(x2, t[0])
	elif t[1] < 0:
		y1 = max(y1, abs(t[1]))
	else:
		y2 = max(y2, t[1])
res = max(hypot(x2, y2), hypot(x2, x1), hypot(x1, y2), hypot(x1, y1), x2 + x1, y2 + y1)
print(res)


import math

def distance(x, y):
	return math.sqrt(x * x + y * y)
n = int(input())
x = list()
y = list()
for i in range(n):
	pt = input().split()
	x.append(int(pt[0]))
	y.append(int(pt[1]))
rng_x = max(x) - min(x)
rng_y = max(y) - min(y)
max_hyp = distance(max((abs(i) for i in x)), max((abs(j) for j in y)))
print(max([rng_x, rng_y, max_hyp]))


from math import sqrt
xpos = 0
xneg = 0
ypos = 0
yneg = 0
x = int(input())
a = []
for c in range(0, x):
	g = input()
	g = str(g)
	h = []
	commaadded = False
	j = 0
	while commaadded == False:
		j = j + 1
		if g[j] == ' ':
			h.append(g[:j])
			h.append(g[j:])
			commaadded = True
		else:
			pass
	d = int(h[0])
	e = int(h[1])
	if d == 0:
		if e >= 0:
			if e > ypos:
				ypos = e
			else:
				pass
		elif e < yneg:
			yneg = e
		else:
			pass
	elif d >= 0:
		if d > xpos:
			xpos = d
		else:
			pass
	elif d < xneg:
		xneg = d
	else:
		pass
if xpos > -1 * xneg:
	highx = xpos
else:
	highx = -1 * xneg
if ypos > -1 * yneg:
	highy = ypos
else:
	highy = -1 * yneg
f = []
f.append(ypos - yneg)
f.append(xpos - xneg)
f.append(sqrt(highx ** 2 + highy ** 2))
answer = 0
for i in range(0, 3):
	if f[i] > answer:
		answer = f[i]
	else:
		pass
print(answer)


(left, right, up, down) = ([0, 0], [0, 0], [0, 0], [0, 0])
for _ in range(int(input())):
	(x, y) = [int(i) for i in input().split(' ')]
	(x, y) = [int(x), int(y)]
	if x < 0:
		if x < left[0]:
			left = [x, 0]
	elif x > 0:
		if x > right[0]:
			right = [x, 0]
	elif y < 0:
		if y < down[1]:
			down = [0, y]
	elif y > 0:
		if y > up[1]:
			up = [0, y]
dots = [left, right, up, down]
dist = 0
for i in range(len(dots) - 1):
	for j in range(i + 1, len(dots)):
		d = ((dots[i][0] - dots[j][0]) ** 2 + (dots[i][1] - dots[j][1]) ** 2) ** 0.5
		if d > dist:
			dist = d
print('{0:.6f}'.format(dist))


from math import sqrt
N = int(input())
top = 0
bottom = 0
left = 0
right = 0
for _ in range(N):
	(a, b) = [int(_) for _ in input().strip().split(' ')]
	if a == 0:
		if b > 0:
			if b > top:
				top = b
		elif b < bottom:
			bottom = b
	elif a > 0:
		if a > right:
			right = a
	elif a < left:
		left = a
maxVertical = top - bottom
maxHorizontal = right - left
maxDiagonal = sqrt(max(right, -left) ** 2 + max(top, -bottom) ** 2)
print(max(maxVertical, maxHorizontal, maxDiagonal))


left = right = up = down = None
for line in range(int(input())):
	(x, y) = map(int, input().split())
	if not y:
		if left is None or x < left:
			left = x
		if right is None or x > right:
			right = x
	if not x:
		if up is None or y > up:
			up = y
		if down is None or y < down:
			down = y
extremes = set()
if left is not None:
	extremes.add(left)
if right is not None:
	extremes.add(right)
if up is not None:
	extremes.add(up * 1j)
if down is not None:
	extremes.add(down * 1j)
print(max((abs(a - b) for a in extremes for b in extremes)))


(xf, x1, x2, yf, y1, y2) = (False, 0, 0, False, 0, 0)
for i in range(int(input())):
	(x, y) = map(int, input().split())
	if x == 0:
		yf = True
		(y1, y2) = (min(y1, y), max(y2, y))
	if y == 0:
		xf = True
		(x1, x2) = (min(x1, x), max(x2, x))
v = max(x2 - x1, y2 - y1)
if xf and yf:
	v = max(v, (max(abs(x1), abs(x2)) ** 2 + max(abs(y1), abs(y2)) ** 2) ** 0.5)
print(v)


from math import sqrt
Points = int(input().strip())
xp = 0
xm = 0
yp = 0
ym = 0
for point in range(Points):
	(x, y) = [int(p) for p in input().split()]
	if x > xp:
		xp = x
	if x < xm:
		xm = x
	if y > yp:
		yp = y
	if y < ym:
		ym = y
biggest = sqrt((yp - ym) ** 2)
L = [sqrt((0 - xp) ** 2 + (yp - 0) ** 2), sqrt((0 - 0) ** 2 + (yp - ym) ** 2), sqrt((0 - xm) ** 2 + (yp - 0) ** 2), sqrt((xm - xp) ** 2 + (0 - 0) ** 2), sqrt((xm - 0) ** 2 + (0 - ym) ** 2), sqrt((0 - xp) ** 2 + (ym - 0) ** 2)]
L.sort()
print('%.6f' % L[-1])


import math
x_max = x_min = y_max = y_min = 0
n = int(input())
for i in range(n):
	l = input().split(' ')
	l = [int(k) for k in l]
	if l[0] < x_min:
		x_min = l[0]
	if l[0] > x_max:
		x_max = l[0]
	if l[1] < y_min:
		y_min = l[1]
	if l[1] > y_max:
		y_max = l[1]
longest = x_max - x_min
if y_max - y_min > longest:
	longest = y_max - y_min
one = math.sqrt(x_max * x_max + y_max * y_max)
two = math.sqrt(x_max * x_max + y_min * y_min)
three = math.sqrt(x_min * x_min + y_max * y_max)
four = math.sqrt(x_min * x_min + y_min * y_min)
longest = max(longest, max(max(one, two), max(three, four)))
print(longest)


import math
n = int(input())
min_x = 1000000001
max_x = -1000000001
min_y = 1000000001
max_y = -1000000001
for i in range(n):
	(x, y) = [int(a) for a in input().split(' ')]
	if y == 0:
		min_x = min(x, min_x)
		max_x = max(x, max_x)
	if x == 0:
		min_y = min(y, min_y)
		max_y = max(y, max_y)
m1 = max(abs(max_x - min_x), abs(max_y - min_y))
m2 = math.sqrt(max(abs(min_x), abs(max_x)) ** 2 + max(abs(min_y), abs(max_y)) ** 2)
m = max(m1, m2)
print('{0:.6f}'.format(m))


import math, itertools
N = int(input())
distances = {'pos_x': 0, 'neg_x': 0, 'pos_y': 0, 'neg_y': 0}
for i in range(N):
	(x, y) = input().split()
	if x == '0':
		i_y = int(y)
		if i_y >= 0:
			if abs(i_y) > distances['pos_y']:
				distances['pos_y'] = abs(i_y)
		if i_y < 0:
			if abs(i_y) > distances['neg_y']:
				distances['neg_y'] = abs(i_y)
	if y == '0':
		i_x = int(x)
		if i_x >= 0:
			if abs(i_x) > distances['pos_x']:
				distances['pos_x'] = abs(int(x))
		if i_x < 0:
			if abs(i_x) > distances['neg_x']:
				distances['neg_x'] = abs(int(x))
x_dist = distances['pos_x'] + distances['neg_x']
y_dist = distances['pos_y'] + distances['neg_y']
x1_dist = math.sqrt(distances['pos_x'] ** 2 + distances['pos_y'] ** 2)
y1_dist = math.sqrt(distances['pos_y'] ** 2 + distances['neg_x'] ** 2)
x2_dist = math.sqrt(distances['neg_x'] ** 2 + distances['neg_y'] ** 2)
y2_dist = math.sqrt(distances['neg_y'] ** 2 + distances['pos_x'] ** 2)
print('%.6f' % max(x_dist, y_dist, x1_dist, y1_dist, x2_dist, y2_dist))


import math
n = int(input())
maxX = -10 ** 10
minX = 10 ** 10
maxY = -10 ** 10
minY = 10 ** 10
xs = False
ys = False
for x in range(n):
	str = input()
	x = int(str[0:str.index(' ')])
	y = int(str[str.index(' ') + 1:])
	if x == 0:
		maxY = max(y, maxY)
		minY = min(y, minY)
		xs = True
	if y == 0:
		maxX = max(x, maxX)
		minX = min(x, minX)
		ys = True
distx = 0
disty = 0
if xs:
	distx = maxX - minX
if ys:
	disty = maxY - minY
dist = 0
if xs and ys:
	maxX1 = max(abs(maxX), abs(minX))
	maxY1 = max(abs(maxY), abs(minY))
	dist = math.sqrt(maxX1 ** 2 + maxY1 ** 2)
print(max(max(distx, disty), dist))


from decimal import Decimal, getcontext
getcontext().prec = 50
UPPER = 10 ** 9
LOWER = -10 ** 9
N = int(input())
assert 2 <= N and N <= 10 ** 6

def test():
	pass

def get_dist(x_1, y_1, x_2, y_2):
	dx = x_1 - x_2
	dy = y_1 - y_2
	return Decimal(dx * dx + dy * dy).sqrt()
min_x = 0
min_y = 0
max_x = 0
max_y = 0
for _ in range(N):
	(x, y) = map(int, input().strip().split())
	assert LOWER <= x and x <= UPPER
	assert LOWER <= y and y <= UPPER
	if x < min_x:
		min_x = x
	if x > max_x:
		max_x = x
	if y < min_y:
		min_y = y
	if y > max_y:
		max_y = y
print(max(get_dist(max_x, 0, 0, max_y), get_dist(max_x, 0, min_x, 0), get_dist(max_x, 0, 0, min_y), get_dist(0, max_y, min_x, 0), get_dist(0, max_y, 0, min_y), get_dist(min_x, 0, 0, min_y)))


N = int(input())
minX = 10000000000
maxX = -10000000000
minY = 10000000000
maxY = -10000000000
for i in range(N):
	line = [int(x) for x in input().split()]
	(x, y) = (line[0], line[1])
	if x == 0:
		if minY > y:
			minY = y
		if maxY < y:
			maxY = y
	if y == 0:
		if minX > x:
			minX = x
		if maxX < x:
			maxX = x
distances = [maxX - minX, maxY - minY, (maxY ** 2 + minX ** 2) ** 0.5, (maxY ** 2 + maxX ** 2) ** 0.5, (minX ** 2 + minY ** 2) ** 0.5, (minY ** 2 + maxX ** 2) ** 0.5]
print('{:.6f}'.format(max(distances)))


def get_distance(x, y):
	return (x * x + y * y) ** 0.5
n = int(input().strip())
xl = []
yl = []
for i in range(n):
	line = input().strip()
	(x, y) = line.split()
	if x != '0':
		xl.append(int(x))
	elif y != '0':
		yl.append(int(y))
(max_x, min_x) = (max(xl), min(xl))
(max_y, min_y) = (max(yl), min(yl))
distances = [max_x - min_x, max_y - min_y, get_distance(max_x, max_y), get_distance(max_x, min_y), get_distance(min_x, max_y), get_distance(min_x, min_y)]
max_dist = max(distances)
print('{0:.6f}'.format(max_dist))


import math
dots = []
x = []
y = []
distance = 0

def dist(x, y):
	return math.sqrt(x ** 2 + y ** 2)
for T in range(int(input())):
	dots.append([int(a) for a in input().split(' ')])
for dot in dots:
	if dot[0] == 0:
		y.append(dot[1])
	if dot[1] == 0:
		x.append(dot[0])
x.sort()
y.sort()
if x[-1] - x[0] < y[-1] - y[0]:
	distance = y[-1] - y[0]
else:
	distance = x[-1] - x[0]
if abs(x[0]) < x[-1]:
	x[0] = x[-1]
if abs(y[0]) < y[-1]:
	y[0] = y[-1]
if dist(x[0], y[0]) > distance:
	distance = dist(x[0], y[0])
print(distance)


n = int(input())
(xs, xl, ys, yl) = (None, None, None, None)
for i in range(n):
	ls = input().split()
	(x, y) = (int(ls[0]), int(ls[1]))
	if x:
		if xs == None or x < xs:
			xs = x
		if xl == None or x > xl:
			xl = x
	if y:
		if ys == None or y < ys:
			ys = y
		if yl == None or y > yl:
			yl = y
ds = []
if xs and xl:
	ds.append(xl - xs)
if ys and yl:
	ds.append(yl - ys)
(cxs, cys) = ([xs, xl], [ys, yl])
for a in cxs:
	if a:
		for b in cys:
			if b:
				ds.append((a ** 2 + b ** 2) ** 0.5)
print(max(ds))


from copy import copy
n = int(input())
left = 0
right = 0
up = 0
down = 0
for i in range(n):
	(x, y) = map(int, input().split())
	if x < left:
		left = copy(x)
	if x > right:
		right = copy(x)
	if y > up:
		up = copy(y)
	if y < down:
		down = copy(y)
hor = max([abs(left), abs(right)])
ver = max([abs(up), abs(down)])
print(max([right - left, up - down, (hor ** 2 + ver ** 2) ** (1 / 2)]))


import math
n = int(input())
maxright = 0
maxleft = 0
maxup = 0
maxdown = 0
for i in range(n):
	(x, y) = map(int, input().split())
	if y == 0:
		if x > 0 and x > maxright:
			maxright = x
		elif x < 0 and x < maxleft:
			maxleft = x
	elif y > 0 and y > maxup:
		maxup = y
	elif y < 0 and y < maxdown:
		maxdown = y
a = [0 for x in range(6)]
a[0] = maxright - maxleft
a[1] = maxup - maxdown
a[2] = math.sqrt(maxup ** 2 + maxright ** 2)
a[3] = math.sqrt(maxup ** 2 + maxleft ** 2)
a[4] = math.sqrt(maxdown ** 2 + maxright ** 2)
a[5] = math.sqrt(maxdown ** 2 + maxleft ** 2)
print('{:.6f}'.format(max(a)))


import math
N = int(input())
max_x = [float('-inf'), 0]
min_x = [float('inf'), 0]
max_y = [0, float('-inf')]
min_y = [0, float('inf')]
for i in range(N):
	point = [int(e) for e in input().split(' ')]
	if point[0] == 0:
		if point[1] < min_y[1]:
			min_y[1] = point[1]
		if point[1] > max_y[1]:
			max_y[1] = point[1]
	else:
		if point[0] < min_x[0]:
			min_x[0] = point[0]
		if point[0] > max_x[0]:
			max_x[0] = point[0]
x_distance = max_x[0] - min_x[0]
y_distance = max_y[1] - min_y[1]
minx_miny_distance = math.sqrt(min_x[0] ** 2 + min_y[1] ** 2)
minx_maxy_distance = math.sqrt(min_x[0] ** 2 + max_y[1] ** 2)
maxx_miny_distance = math.sqrt(max_x[0] ** 2 + min_y[1] ** 2)
maxx_maxy_distance = math.sqrt(max_x[0] ** 2 + max_y[1] ** 2)
max_distance = max(x_distance, y_distance, minx_miny_distance, minx_maxy_distance, maxx_miny_distance, maxx_maxy_distance)
print(max_distance)


import sys
import math
n = int(input())
x = []
y = []
inp = []
for i in range(0, n):
	inp = input().split(' ')
	x.append(int(inp[0]))
	y.append(int(inp[1]))
minx = min(x)
miny = min(y)
maxx = max(x)
maxy = max(y)
a = maxx - minx
b = maxy - miny
c = math.hypot(minx, miny)
d = math.hypot(maxx, maxy)
e = math.hypot(maxx, miny)
f = math.hypot(minx, maxy)
s = [a, b, c, d, e, f]
print(max(s))


n = int(input())
dots = []
for i in range(n):
	dots.append(tuple(map(int, input().split())))

def dist(x, y):
	return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** (1 / 2)
left = (min(map(lambda x: x[0], dots)), 0)
right = (max(map(lambda x: x[0], dots)), 0)
down = (0, min(map(lambda x: x[1], dots)))
top = (0, max(map(lambda x: x[1], dots)))
maxdist = 0
d = [left, right, top, down]
for x in d:
	for y in d:
		if dist(x, y) > maxdist:
			maxdist = dist(x, y)
print('%.6f' % maxdist)


import math
import decimal

def getDistant(x, y):
	if x == 0:
		return y
	elif y == 0:
		return x
	else:
		return math.sqrt(x * x + y * y)
N = int(input())
xyPlane = [0, 0, 0, 0]
for i in range(N):
	l = list(map(int, input().split()))
	x = l[0]
	y = l[1]
	if x > 0:
		if x > xyPlane[0]:
			xyPlane[0] = x
	elif x < 0:
		if -1 * x > xyPlane[2]:
			xyPlane[2] = -1 * x
	elif y > 0:
		if y > xyPlane[1]:
			xyPlane[1] = y
	elif y < 0:
		if -1 * y > xyPlane[3]:
			xyPlane[3] = -1 * y
max = xyPlane[0] + xyPlane[2]
if max < xyPlane[1] + xyPlane[3]:
	max = xyPlane[1] + xyPlane[3]
if max < getDistant(xyPlane[0], xyPlane[1]):
	max = getDistant(xyPlane[0], xyPlane[1])
if max < getDistant(xyPlane[1], xyPlane[2]):
	max = getDistant(xyPlane[1], xyPlane[2])
if max < getDistant(xyPlane[2], xyPlane[3]):
	max = getDistant(xyPlane[2], xyPlane[3])
if max < getDistant(xyPlane[3], xyPlane[0]):
	max = getDistant(xyPlane[3], xyPlane[0])
SIXPLACES = decimal.Decimal(10) ** (-6)
print(decimal.Decimal(max).quantize(SIXPLACES))


N = int(input())
points = []
for i in range(N):
	temp = input().strip().split()
	temp = [int(j) for j in temp]
	points += [(temp[0], temp[1])]
max_x = max_y = min_x = min_y = False
for point in points:
	if not max_x or point[0] > max_x:
		max_x = point[0]
	if not min_x or point[0] < min_x:
		min_x = point[0]
	if not max_y or point[1] > max_y:
		max_y = point[1]
	if not min_y or point[1] < min_y:
		min_y = point[1]
furthest_x = max(max_x, abs(min_x))
furthest_y = max(max_y, abs(min_y))
print(max(max_x - min_x, max_y - min_y, (furthest_x ** 2 + furthest_y ** 2) ** 0.5))


import math
n = int(input())
a = []
b = []
for i in range(0, n):
	(x, y) = map(int, input().split())
	if x == 0:
		b.append(y)
	if y == 0:
		a.append(x)
m1 = abs(max(a) - min(a))
n1 = abs(max(b) - min(b))
maximum = max(m1, n1)
max1 = max(abs(max(a)), abs(min(a)))
max2 = max(abs(max(b)), abs(min(b)))
if maximum < math.sqrt(max1 ** 2 + max2 ** 2):
	maximum = math.sqrt(max1 ** 2 + max2 ** 2)
print('{0:.6f}'.format(maximum))


import heapq
import math

def solve(points, dist=lambda x, y: math.sqrt(x * x + y * y)):
	(xs, ys) = ([], [])
	for (x, y) in points:
		assert x == 0 or y == 0, 'Expected x=0 or y=0'
		heapq.heappush(xs, x)
		heapq.heappush(ys, y)
	(xmin,) = heapq.nsmallest(1, xs)
	(xmax,) = heapq.nlargest(1, xs)
	(ymin,) = heapq.nsmallest(1, ys)
	(ymax,) = heapq.nlargest(1, ys)
	dx = abs(xmax - xmin)
	dy = abs(ymax - ymin)
	q1 = dist(xmax, ymax)
	q2 = dist(xmin, ymax)
	q3 = dist(xmax, ymin)
	q3 = dist(xmax, ymin)
	q4 = dist(xmin, ymin)
	return max([dx, dy, q1, q2, q3, q4])

def main(n):
	points = (map(int, input().strip().split()) for _ in range(n))
	print('{:f}'.format(solve(points)))
main(int(input()))


n = int(input())
maxx = 0.0
minx = 0.0
maxy = 0.0
miny = 0.0
import sys
for i in range(n):
	(dx, dy) = map(int, sys.stdin.readline().split())
	if dx == 0:
		if dy > maxy:
			maxy = dy
		elif dy < miny:
			miny = dy
	elif dx > maxx:
		maxx = dx
	elif dx < minx:
		minx = dx
d = abs(miny - maxy)
dt = abs(minx - maxx)
if dt > d:
	d = dt
dt = pow(minx * minx + miny * miny, 0.5)
if dt > d:
	d = dt
dt = pow(maxx * maxx + maxy * maxy, 0.5)
if dt > d:
	d = dt
dt = pow(maxx * maxx + miny * miny, 0.5)
if dt > d:
	d = dt
dt = pow(minx * minx + maxy * maxy, 0.5)
if dt > d:
	d = dt
print(d)


import sys, math
n = int(input())
x = []
y = []
for case in range(n):
	c = [int(x) for x in input().split()]
	if c[0]:
		x.append(c[0])
	elif c[1]:
		y.append(c[1])
x.sort()
y.sort()
x_diff = x[-1] - x[0]
y_diff = y[-1] - y[0]
xy_diff = math.sqrt(max(abs(x[-1]), abs(x[0])) ** 2 + max(abs(y[0]), abs(y[-1])) ** 2)
print('{:.6f}'.format(float(max(x_diff, y_diff, xy_diff))))


import math
n = 0
outp = 0
count = int(input())
smallx = 1000000001
bigx = -10000000001
bigy = -1000000001
smally = 10000000001
while n < count:
	gin = input().split()
	if int(gin[0]) < smallx:
		smallx = int(gin[0])
	elif int(gin[0]) > bigx:
		bigx = int(gin[0])
	if int(gin[1]) < smally:
		smally = int(gin[1])
	elif int(gin[1]) > bigy:
		bigy = int(gin[1])
	n += 1

def distance(a, b):
	return math.sqrt(a ** 2 + b ** 2)
if abs(smallx) > abs(bigx):
	if abs(smally) > abs(bigy):
		outp = distance(smallx, smally)
	else:
		outp = distance(smallx, bigy)
elif abs(smally) > abs(bigy):
	outp = distance(bigx, smally)
else:
	outp = distance(bigx, bigy)
if bigx - smallx > bigy - smally:
	if bigx - smallx > outp:
		outp = bigx - smallx
elif bigy - smally > outp:
	outp = bigy - smally
print(outp)


from math import sqrt

def most_distant(dot_list):
	biggest_abs_x = abs(dot_list[0][0])
	biggest_abs_y = abs(dot_list[0][1])
	smallest_x = dot_list[0][0]
	smallest_y = dot_list[0][1]
	largest_x = smallest_x
	largest_y = smallest_y
	for dot in dot_list[1:]:
		x = dot[0]
		y = dot[1]
		if abs(x) > biggest_abs_x:
			biggest_abs_x = abs(x)
		if abs(y) > biggest_abs_y:
			biggest_abs_y = abs(y)
		if x > largest_x:
			largest_x = x
		if y > largest_y:
			largest_y = y
		if x < smallest_x:
			smallest_x = x
		if y < smallest_y:
			smallest_y = y
	biggest_diagonal = sqrt(biggest_abs_x ** 2 + biggest_abs_y ** 2)
	delta_x = abs(largest_x - smallest_x)
	delta_y = abs(largest_y - smallest_y)
	print(max(biggest_diagonal, delta_x, delta_y))
n = int(input().strip())
dots = []
for a_i in range(n):
	(x, y) = input().strip().split(' ')
	dots.append((int(y), int(x)))
most_distant(dots)