Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point $T$, which coordinates to be found out.

Bob travelled around the world and collected clues of the treasure location at $n$ obelisks. These clues were in an ancient language, and he has only decrypted them at home. Since he does not know which clue belongs to which obelisk, finding the treasure might pose a challenge. Can you help him?

As everyone knows, the world is a two-dimensional plane. The $i$-th obelisk is at integer coordinates $(x_i, y_i)$. The $j$-th clue consists of $2$ integers $(a_j, b_j)$ and belongs to the obelisk $p_j$, where $p$ is some (unknown) permutation on $n$ elements. It means that the treasure is located at $T=(x_{p_j} + a_j, y_{p_j} + b_j)$. This point $T$ is the same for all clues.

In other words, each clue belongs to exactly one of the obelisks, and each obelisk has exactly one clue that belongs to it. A clue represents the vector from the obelisk to the treasure. The clues must be distributed among the obelisks in such a way that they all point to the same position of the treasure.

Your task is to find the coordinates of the treasure. If there are multiple solutions, you may print any of them.

Note that you don't need to find the permutation. Permutations are used only in order to explain the problem.


-----Input-----

The first line contains an integer $n$ ($1 \leq n \leq 1000$) — the number of obelisks, that is also equal to the number of clues.

Each of the next $n$ lines contains two integers $x_i$, $y_i$ ($-10^6 \leq x_i, y_i \leq 10^6$) — the coordinates of the $i$-th obelisk. All coordinates are distinct, that is $x_i \neq x_j$ or $y_i \neq y_j$ will be satisfied for every $(i, j)$ such that $i \neq j$. 

Each of the next $n$ lines contains two integers $a_i$, $b_i$ ($-2 \cdot 10^6 \leq a_i, b_i \leq 2 \cdot 10^6$) — the direction of the $i$-th clue. All coordinates are distinct, that is $a_i \neq a_j$ or $b_i \neq b_j$ will be satisfied for every $(i, j)$ such that $i \neq j$. 

It is guaranteed that there exists a permutation $p$, such that for all $i,j$ it holds $\left(x_{p_i} + a_i, y_{p_i} + b_i\right) = \left(x_{p_j} + a_j, y_{p_j} + b_j\right)$. 


-----Output-----

Output a single line containing two integers $T_x, T_y$ — the coordinates of the treasure.

If there are multiple answers, you may print any of them.


-----Examples-----
Input
2
2 5
-6 4
7 -2
-1 -3

Output
1 2

Input
4
2 2
8 2
-7 0
-2 6
1 -14
16 -12
11 -18
7 -14

Output
9 -12



-----Note-----

As $n = 2$, we can consider all permutations on two elements. 

If $p = [1, 2]$, then the obelisk $(2, 5)$ holds the clue $(7, -2)$, which means that the treasure is hidden at $(9, 3)$. The second obelisk $(-6, 4)$ would give the clue $(-1,-3)$ and the treasure at $(-7, 1)$. However, both obelisks must give the same location, hence this is clearly not the correct permutation.

If the hidden permutation is $[2, 1]$, then the first clue belongs to the second obelisk and the second clue belongs to the first obelisk. Hence $(-6, 4) + (7, -2) = (2,5) + (-1,-3) = (1, 2)$, so $T = (1,2)$ is the location of the treasure. [Image] 

In the second sample, the hidden permutation is $[2, 3, 4, 1]$.

Difficulty: EASY
Tags: Greedy algorithms

Complete search

Implementation

Constructive algorithms
Skill types: Complete search

Greedy algorithms

Starter code:

Solutions:
n = int(input())
a = []
b = []
for _ in range(n):
	(x, y) = map(int, input().split())
	a.append((x, y))
for _ in range(n):
	(x, y) = map(int, input().split())
	b.append((x, y))
S = set()
for i in range(n):
	S.add((a[0][0] + b[i][0], a[0][1] + b[i][1]))
for i in range(1, n):
	P = set()
	for j in range(n):
		P.add((a[i][0] + b[j][0], a[i][1] + b[j][1]))
	S &= P
for i in S:
	print(*i)
	break


n = int(input())
x = []
y = []
a = []
b = []
for _ in range(n):
	(t1, t2) = map(int, input().split())
	x.append(t1)
	y.append(t2)
for _ in range(n):
	(t1, t2) = map(int, input().split())
	a.append(t1)
	b.append(t2)
tx = [[] for _ in range(n)]
ty = [[] for _ in range(n)]
for i in range(n):
	for j in range(n):
		tx[i].append(x[i] + a[j])
for i in range(n):
	for j in range(n):
		ty[i].append(y[i] + b[j])
c = []
i = 0
j = 1
while True:
	if j == n:
		c.append(tx[0][i])
		break
	elif tx[0][i] in tx[j]:
		j += 1
	else:
		i += 1
		j = 1
i = 0
j = 1
while True:
	if j == n:
		c.append(ty[0][i])
		break
	elif ty[0][i] in ty[j]:
		j += 1
	else:
		i += 1
		j = 1
print(*c)


from collections import Counter

def read():
	return int(input())

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

def readmap():
	return map(int, input().split())
n = read()
X = []
Y = []
for _ in range(n):
	(x, y) = readmap()
	X.append(x)
	Y.append(y)
A = []
B = []
for _ in range(n):
	(a, b) = readmap()
	A.append(a)
	B.append(b)
c = Counter()
for i in range(n):
	for j in range(n):
		coordinate = (X[i] + A[j], Y[i] + B[j])
		c[coordinate] += 1
for (k, v) in c.items():
	if v >= n:
		print(k[0], k[1])


n = int(input())
s1 = 0
s2 = 0
for i in range(n):
	(k, l) = map(int, input().split())
	s1 += k
	s2 += l
for i in range(n):
	(k, l) = map(int, input().split())
	s1 += k
	s2 += l
print(s1 // n, s2 // n)


import copy
n = int(input())
ab = []
hell = []
x = 0
y = 0
for i in range(n):
	ab.append(list(map(int, input().split())))
	x += ab[i][0]
	y += ab[i][1]
for i in range(n):
	hell.append(list(map(int, input().split())))
	x += hell[i][0]
	y += hell[i][1]
print(int(x / n), int(y / n))


n = int(input())
a = [tuple(map(int, input().split())) for i in range(n)]
b = [tuple(map(int, input().split())) for i in range(n)]
(x1, y1) = max(a)
(x2, y2) = min(b)
print(x1 + x2, y1 + y2)


N = int(input())
(p, q) = (0, 0)
for i in range(N * 2):
	(x, y) = map(int, input().split())
	p += x
	q += y
print(p // N, q // N)


n = int(input())
pts = []
for X in range(n):
	pt = [int(i) for i in input().split()]
	pts.append(pt)
dirs = []
for X in range(n):
	d = [int(i) for i in input().split()]
	dirs.append(d)
dc = dict()
for i in range(n):
	for j in range(n):
		(x, y) = pts[i]
		(dx, dy) = dirs[j]
		if (x + dx, y + dy) not in dc:
			dc[x + dx, y + dy] = 1
		else:
			dc[x + dx, y + dy] += 1
for i in list(dc.keys()):
	if dc[i] >= n:
		print(i[0], i[1])
		break


n = int(input())
if n == 1:
	(x, y) = map(int, input().split())
	(a, b) = map(int, input().split())
	print(x + a, y + b)
else:
	l = []
	ll = []
	lll = 0
	llll = 0
	for i in range(n):
		l.append(list(map(int, input().split())))
	for i in range(n):
		ll.append(list(map(int, input().split())))
	for i in l:
		lll += i[0]
		llll += i[1]
	for i in ll:
		lll += i[0]
		llll += i[1]
	print(lll // n, llll // n)


t = int(input())
(s, k) = (0, 0)
for i in range(2 * t):
	(j, l) = map(int, input().split(' '))
	s += j
	k += l
print(s // t, k // t)


n = int(input())
lix = 0
lia = 0
for i in range(n):
	(a, b) = map(int, input().split())
	lix += a
	lia += b
for i in range(n):
	(a, b) = map(int, input().split())
	lix += a
	lia += b
print(lix // n, lia // n)


n = int(input())
l = []
q = []
for i in range(n):
	x = list(map(int, input().split()))
	l.append(x.copy())
for i in range(n):
	x = list(map(int, input().split()))
	q.append(x.copy())
l.sort()
q.sort(reverse=True)
print(l[0][0] + q[0][0], l[0][1] + q[0][1])


n = int(input())
j = []
i = []
x = 0
while x < 2 * n:
	x += 1
	s = input().split()
	if x < n + 1:
		j.append((int(s[0]), int(s[1])))
	else:
		i.append((int(s[0]), int(s[1])))
(a, b) = (max(j), min(i))
print(a[0] + b[0], a[1] + b[1])


n = int(input())
(maxX, maxY) = (float('-inf'), float('-inf'))
for i in range(n):
	(x, y) = map(int, input().split())
	maxX = max(maxX, x)
	maxY = max(maxY, y)
(minA, minB) = (10 ** 8, 10 ** 8)
for i in range(n):
	(a, b) = map(int, input().split())
	minA = min(a, minA)
	minB = min(b, minB)
print(maxX + minA, maxY + minB)


import operator
n = int(input())
obel = []
for i in range(n):
	(x, y) = map(int, input().split(' '))
	obel.append((x, y))
vectors = []
for i in range(n):
	(x, y) = map(int, input().split(' '))
	vectors.append((x, y))
coor = {}
for (x, y) in obel:
	for (a, b) in vectors:
		maybe = (x + a, y + b)
		coor[maybe] = coor.setdefault(maybe, 0) + 1
key = max(coor.items(), key=operator.itemgetter(1))[0]
print('%d %d' % key)


import math
n = int(input())
X = [0] * n
Y = [0] * n
A = [0] * n
B = [0] * n
s = 0
k = 0
for i in range(n):
	(X[i], Y[i]) = map(int, input().split())
	s += X[i]
	k += Y[i]
for i in range(n):
	(A[i], B[i]) = map(int, input().split())
	s += A[i]
	k += B[i]
s /= n
k /= n
print(math.trunc(s), math.trunc(k))


n = int(input())
obelisks = []
clues = []
xScore = 0
yScore = 0
for a in range(n):
	(x, y) = map(int, input().split())
	xScore += x
	yScore += y
for b in range(n):
	(x, y) = map(int, input().split())
	xScore += x
	yScore += y
print(int(xScore / n), int(yScore / n))


n = int(input())
x_y = []
for i in range(n):
	(x, y) = input().split(' ')
	x = int(x)
	y = int(y)
	x_y.append((x, y))
x_y.sort()
a_b = []
for i in range(n):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	a_b.append((a, b))
a_b.sort()
print(x_y[0][0] + a_b[-1][0], end=' ')
print(x_y[0][1] + a_b[-1][1], end=' ')


import sys
n = int(sys.stdin.readline())
o = []
c = []
for _ in range(n):
	(a, b) = map(int, sys.stdin.readline().split())
	o.append((a, b))
for _ in range(n):
	(a, b) = map(int, sys.stdin.readline().split())
	c.append((a, b))
dp = [[0] * n for _ in range(n)]
for i in range(n):
	for j in range(n):
		dp[i][j] = (o[i][0] + c[j][0], o[i][1] + c[j][1])
res = dict()
for i in range(n):
	for j in range(n):
		if dp[i][j] not in res:
			res[dp[i][j]] = 1
		else:
			res[dp[i][j]] += 1
for i in res:
	if res[i] == n:
		print(i[0], i[1])
		break


n = int(input())
xs = ys = 0
for _ in range(2 * n):
	(xi, yi) = [int(w) for w in input().split()]
	xs += xi
	ys += yi
print(xs // n, ys // n)


n = int(input())
(xs, ys) = (0, 0)
(clx, cly) = (0, 0)
for i in range(n):
	(x, y) = map(int, input().split())
	xs += x
	ys += y
for i in range(n):
	(x, y) = map(int, input().split())
	xs += x
	ys += y
xs //= n
ys //= n
print(xs, ys)


from sys import stdin
n = int(stdin.readline())
coor = []
vectors = []
for i in range(n):
	(x, y) = map(int, stdin.readline().split())
	coor.append((x, y))
for i in range(n):
	(a, b) = map(int, stdin.readline().split())
	vectors.append((a, b))
vectors.sort()
coor.sort()
print(vectors[0][0] + coor[-1][0], vectors[0][1] + coor[-1][1])


sa = sb = 0
n = int(input())
for i in range(2 * n):
	(a, b) = map(int, input().split())
	(sa, sb) = (sa + a, sb + b)
print(sa // n, sb // n)


n = int(input())
a_list = []
b_list = []
x_list = []
y_list = []
for i in range(n):
	(x, y) = map(int, input().split(' '))
	x_list.append(x)
	y_list.append(y)
for i in range(n):
	(a, b) = map(int, input().split(' '))
	a_list.append(a)
	b_list.append(b)
min_x = min(x_list)
min_y = min(y_list)
max_a = max(a_list)
max_b = max(b_list)
print('%d %d' % (min_x + max_a, min_y + max_b))


n = int(input())
(x, y) = (0, 0)
for _ in range(2 * n):
	(a, b) = tuple(map(int, input().split()))
	x += a
	y += b
print(*[x // n, y // n])


n = int(input())
o = []
mat = [None] * n
for i in range(n):
	o.append(list(map(int, input().split())))
a = []
for i in range(n):
	mat[i] = [None] * n
	a.append(list(map(int, input().split())))
dct = {}
mx = 0
ans = [None]
for i in range(n):
	for j in range(n):
		mat[i][j] = [o[i][0] + a[j][0], o[i][1] + a[j][1]]
		x = str(mat[i][j])
		if x in dct:
			dct[x] += 1
		else:
			dct[x] = 1
		if dct[x] > mx:
			mx = dct[x]
			ans = mat[i][j]
print(ans[0], ans[1])


n = int(input())
R = lambda : sorted(([*map(int, input().split())] for _ in [0] * n))
(o, c) = (R(), R())
print(o[0][0] + c[-1][0], o[0][1] + c[-1][1])


import sys
import math

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

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

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

def read_string_list(delim=' '):
	return input().strip().split(delim)

def sumup(t1, t2):
	return (t1[0] + t2[0], t1[1] + t2[1])
n = read_int()
locs = []
deltas = []
for _ in range(n):
	locs.append(tuple(read_int_list()))
for _ in range(n):
	deltas.append(tuple(read_int_list()))
locs.sort()
deltas.sort(reverse=True)
ans = sumup(locs[0], deltas[0])
print(ans[0], ans[1])


n = int(input())
o = [list(map(int, input().split())) for i in range(n)]
p = [list(map(int, input().split())) for i in range(n)]
x = sum([i[0] for i in o]) + sum([i[0] for i in p])
x = x // n
y = sum([i[1] for i in o]) + sum([i[1] for i in p])
y = y // n
print(x, y)


from sys import stdin
from collections import Counter
from math import sqrt, factorial, log10, log, floor, ceil
from itertools import permutations, combinations, combinations_with_replacement
input = stdin.readline

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

def lis():
	return list(map(str, input().split()))

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

def inp():
	return int(input())

def inps():
	return str(input().strip())

def pr(n):
	return stdout.write(str(n) + '\n')
INF = float('inf')

def solve():
	n = inp()
	(smx, smy) = (0, 0)
	for i in range(n * 2):
		(x, y) = mp()
		smx += x
		smy += y
	print(smx // n, smy // n)
t = 1
for i in range(t):
	solve()


n = int(input())
maxX = -10000000000
maxY = -10000000000
minA = 10000000000
minB = 10000000000
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a > maxX:
		maxX = a
	if b > maxY:
		maxY = b
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a < minA:
		minA = a
	if b < minB:
		minB = b
print(maxX + minA, maxY + minB)


n = int(input())
a = sorted([[int(i) for i in input().split()] for j in range(n)])
b = sorted([[int(i) for i in input().split()] for j in range(n)], reverse=True)
print(a[0][0] + b[0][0], a[0][1] + b[0][1])


n = int(input())
sum1 = 0
sum2 = 0
for item in range(n):
	(a, b) = [int(x) for x in input().split()]
	sum1 += a
	sum2 += b
for item in range(n):
	(a, b) = [int(x) for x in input().split()]
	sum1 += a
	sum2 += b
print(sum1 // n, sum2 // n)


n = int(input())
sum_x = 0
sum_y = 0
arr = []
for x in range(0, 2 * n):
	arr = input().split()
	sum_x += int(arr[0])
	sum_y += int(arr[1])
print(int(sum_x / n), ' ', int(sum_y / n))


n = int(input())
OBE = [list(map(int, input().split())) for i in range(n)]
CL = [list(map(int, input().split())) for i in range(n)]
OBE.sort(key=lambda x: x[1])
OBE.sort(key=lambda x: x[0])
CL.sort(key=lambda x: x[1])
CL.sort(key=lambda x: x[0])
print(OBE[0][0] + CL[-1][0], OBE[0][1] + CL[-1][1])


n = int(input())
x = []
y = []
for i in range(n * 2):
	temp = input().split()
	x.append(int(temp[0]))
	y.append(int(temp[1]))
print(int(sum(x) / n), int(sum(y) / n))


t = int(input())
mx = []
my = []
nx = []
ny = []
for _ in range(t):
	l = list(map(int, input().strip().split(' ')))
	mx.append(l[0])
	my.append(l[1])
for _ in range(t):
	l = list(map(int, input().strip().split(' ')))
	nx.append(l[0])
	ny.append(l[1])
print(int((sum(nx) + sum(mx)) / t), int((sum(my) + sum(ny)) / t))


n = int(input())
(x, y) = map(sum, zip(*(map(int, input().split()) for _ in [0] * 2 * n)))
print(x // n, y // n)


n = int(input())
sum1 = 0
sum2 = 0
for i in range(2 * n):
	(a, b) = map(int, input().split())
	sum1 += a
	sum2 += b
print(int(sum1 / n), int(sum2 / n))


n = int(input())
x = y = 0
for i in range(2 * n):
	(a, b) = map(int, input().split())
	x += a
	y += b
print(str(x // n) + ' ' + str(y // n))


n = int(input())
(xcoordi, ycoordi) = ([], [])
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	xcoordi.append(x)
	ycoordi.append(y)
(A, B) = ([], [])
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	A.append(a)
	B.append(b)
if n == 1:
	print(xcoordi[0] + A[0], ycoordi[0] + B[0])
else:
	di = {}
	for i in range(n):
		for j in range(n):
			temp1 = xcoordi[i] + A[j]
			temp2 = ycoordi[i] + B[j]
			if (temp1, temp2) not in di:
				di[temp1, temp2] = 1
			else:
				di[temp1, temp2] += 1
	C = list(di.keys())
	for i in range(len(C)):
		if di[C[i]] == n:
			print(C[i][0], C[i][1])
			break


n = int(input())
(x, y, a, b) = ([], [], [], [])
for i in range(n):
	(z, w) = map(int, input().split())
	x.append(z)
	y.append(w)
for i in range(n):
	(z, w) = map(int, input().split())
	a.append(z)
	b.append(w)
xd = [i for (i, j) in sorted(zip(x, y))]
yd = [j for (i, j) in sorted(zip(x, y))]
ad = [i for (i, j) in sorted(zip(a, b))]
bd = [j for (i, j) in sorted(zip(a, b))]
print(xd[0] + ad[-1], yd[0] + bd[-1])


def s(x):
	return x[0] + x[1]
n = int(input())
points = []
for i in range(n):
	(x, y) = map(int, input().split(' '))
	points.append([x, y])
vects = []
for i in range(n):
	(a, b) = map(int, input().split(' '))
	vects.append([a, b])
points.sort(key=s)
vects.sort(key=s, reverse=True)
if set(vects[0]) == set(vects[n - 1]):
	if points[0][0] + vects[0][0] == points[n - 1][0] + vects[n - 1][0] and points[0][1] + vects[0][1] == points[n - 1][1] + vects[n - 1][1]:
		print(points[0][0] + vects[0][0], points[0][1] + vects[0][1])
	else:
		print(points[0][0] + vects[n - 1][0], points[0][1] + vects[n - 1][1])
else:
	print(points[0][0] + vects[0][0], points[0][1] + vects[0][1])


n = int(input())
x1 = 0
y1 = 0
for i in range(n):
	(a, b) = map(int, input().split())
	x1 += a
	y1 += b
x2 = 0
y2 = 0
for i in range(n):
	(a, b) = map(int, input().split())
	x2 += a
	y2 += b
print((x1 + x2) // n, (y1 + y2) // n)


n = int(input())
R = lambda : ([*map(int, input().split())] for _ in [0] * n)
(a, b) = min(R())
(x, y) = max(R())
print(a + x, b + y)


from random import shuffle
n = int(input())
obelisks = []
clues = []
for i in range(n):
	obelisks.append(tuple(map(int, input().split())))
for i in range(n):
	clues.append(tuple(map(int, input().split())))
shuffle(obelisks)
shuffle(clues)
candidates = []
for obelisk in obelisks:
	candidates.append((obelisk[0] + clues[0][0], obelisk[1] + clues[0][1]))

def test(candidate):
	for clue in clues:
		obelisk = (candidate[0] - clue[0], candidate[1] - clue[1])
		if obelisk not in obelisks:
			return False
	return True
for candidate in candidates:
	if test(candidate):
		print('{} {}'.format(*candidate))
		break


xs = 0
ys = 0
t = int(input())
for test in range(t * 2):
	(x, y) = list(map(int, input().split()))
	xs += x
	ys += y
solx = int(xs / t)
soly = int(ys / t)
print(solx, soly)


n = int(input())
x1 = y1 = 0
for i in range(1, int(2 * n + 1)):
	(a, b) = map(int, input().split())
	x1 += a
	y1 += b
print(int(x1 / n), int(y1 / n))


N = int(input())
X = 0
Y = 0
for i in range(2 * N):
	tmp = [int(i) for i in input().split()]
	X += tmp[0]
	Y += tmp[1]
print(int(X / N), int(Y / N))


n = int(input())
obs = []
for _ in range(n):
	(x, y) = map(int, input().split())
	obs.append((x, y))
variants = set()
for _ in range(n):
	(a, b) = map(int, input().split())
	vars_1 = set()
	for (x, y) in obs:
		vars_1.add((a + x, b + y))
	if variants == set():
		variants = vars_1
	else:
		variants = variants & vars_1
variants = list(variants)
print(variants[0][0], variants[0][1])


n = int(input())
a = []
b = []
for _ in range(n):
	a.append(list(map(int, input().split())))
for _ in range(n):
	b.append(list(map(int, input().split())))
a.sort(reverse=True)
b.sort()
print(a[0][0] + b[0][0], a[0][1] + b[0][1])


n = int(input())
a = []
for _ in range(n):
	(x, y) = map(int, input().split())
	a.append((x, y))
b = []
for _ in range(n):
	(x, y) = map(int, input().split())
	b.append((-x, -y))
a.sort()
b.sort()
xa = a[0][0]
ya = a[0][1]
xb = b[0][0]
yb = b[0][1]
print(xa - xb, ya - yb)


def get_coords(a, v):
	coords = {}
	for i in range(len(a)):
		for j in range(len(v)):
			crd = (a[i][0] + v[j][0], a[i][1] + v[j][1])
			if crd not in coords:
				coords[crd] = 1
			else:
				coords[crd] += 1
			if coords[crd] == len(a):
				return crd
	return (5000000, 5000000)
n = int(input())
obelisks = [tuple(map(int, input().split())) for i in range(n)]
tips = [tuple(map(int, input().split())) for i in range(n)]
print(*get_coords(obelisks, tips))


n = int(input())
obsk = []
for i in range(n):
	vect = input()
	vect = vect.split()
	obsk.append((int(vect[0]), int(vect[1])))
clues = []
c_memb = set()
for i in range(n):
	vect = input()
	vect = vect.split()
	clue = (int(vect[0]), int(vect[1]))
	clues.append(clue)
	c_memb.add(clue)
for i in range(n):
	possible = (obsk[0][0] + clues[i][0], obsk[0][1] + clues[i][1])
	valid = True
	for j in range(1, n):
		if (possible[0] - obsk[j][0], possible[1] - obsk[j][1]) not in c_memb:
			valid = False
			break
	if valid:
		print(possible[0], possible[1])
		break


n = int(input())
x = []
y = []
for i in range(n):
	(a, b) = map(int, input().split())
	x += [a]
	y += [b]
clx = []
cly = []
for i in range(n):
	(c, d) = map(int, input().split())
	clx += [c]
	cly += [d]
print(min(x) + max(clx), min(y) + max(cly))


n = int(input())
a = sorted([tuple(map(int, input().split())) for i in range(n)])
b = sorted([tuple(map(int, input().split())) for i in range(n)])
print(a[0][0] + b[-1][0], a[0][1] + b[-1][1])


n = int(input())
t1 = [[0] * 2 for i in range(n)]
t2 = [[0] * 2 for i in range(n)]
for i in range(n):
	a = list(map(int, input().split()))
	t1[i] = a
for i in range(n):
	a = list(map(int, input().split()))
	t2[i] = a
t1 = sorted(t1, reverse=True)
t2 = sorted(t2, reverse=False)
resultx = t1[0][0] + t2[0][0]
resulty = t2[0][1] + t1[0][1]
tt = True
for i in range(n):
	if resultx != t1[i][0] + t2[i][0] or resulty != t1[i][1] + t2[i][1]:
		tt = False
if tt == True:
	print(resultx, resulty)


n = int(input())
(x, y) = (0, 0)
res = 0
for i in range(0, 2 * n):
	(_x, _y) = map(int, input().split(' '))
	(x, y) = (x + _x, y + _y)
(x, y) = map(lambda _: _ // n, (x, y))
print(x, y)


n = int(input())
A = 0
B = 0
for i in range(2 * n):
	(a, b) = map(int, input().split(' '))
	A += a
	B += b
print(A // n, B // n)


n = int(input())
x = 0
y = 0
for _ in range(2 * n):
	(a, b) = [int(s) for s in input().split()]
	x += a
	y += b
print(x // n, y // n)


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


class Index:

	def __init__(self, x=0, y=0):
		self.x = x
		self.y = y

	def __add__(self, other):
		temp = Index(self.x + other.x, self.y + other.y)
		return temp

	def Ans(self, n):
		print(self.x // n, self.y // n)
Num = int(input())
T = Index()
for i in range(2 * Num):
	(m, n) = map(int, input().split())
	T2 = Index(m, n)
	T = T + T2
T.Ans(Num)


n = int(input())
u = 0
v = 0
for i in range(n):
	(x, y) = map(int, input().split())
	u += x
	v += y
for j in range(n):
	(a, b) = map(int, input().split())
	u += a
	v += b
print(str(int(u / n)), str(int(v / n)))


t = int(input()) * 2
x = 0
y = 0
n = t // 2
while t > 0:
	t -= 1
	(a, b) = input().split()
	x += int(a)
	y += int(b)
print(x // n, y // n)


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import functools
import sys
import math
MAX = sys.maxsize
MAXN = 10 ** 6 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

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

def charIN():
	return sys.stdin.readline().strip().split()
t = [0] * 1000010

def create(a, n):
	global t
	for i in range(n, 2 * n):
		t[i] = a[i - n]
	for i in range(n - 1, 0, -1):
		t[i] = t[2 * i] + t[2 * i + 1]

def ncr(n, k):
	res = 1
	c = [0] * (k + 1)
	c[0] = 1
	for i in range(1, n + 1):
		for j in range(min(i, k), 0, -1):
			c[j] = (c[j] + c[j - 1]) % MOD
	return c[k]
n = int(input())
d = defaultdict(int)
a = []
b = []
for _ in range(n):
	a.append(list(numIN()))
for _ in range(n):
	b.append(list(numIN()))
for i in range(n):
	for j in range(n):
		d[a[i][0] + b[j][0], a[i][1] + b[j][1]] += 1
for i in d:
	if d[i] == n:
		print(i[0], i[1])
		exit(0)


import math
import sys
DEBUG = False

def inp():
	return sys.stdin.readline().rstrip()

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)

def solve(N, O, C):
	cs = set()
	for (x, y) in C:
		cs.add((x, y))
	for c in C:
		X = O[0][0] + c[0]
		Y = O[0][1] + c[1]
		bad = False
		for o in O:
			dx = X - o[0]
			dy = Y - o[1]
			if (dx, dy) not in cs:
				bad = True
				break
		if not bad:
			return (X, Y)
	assert False

def main():
	N = int(inp())
	O = [[int(e) for e in inp().split()] for _ in range(N)]
	C = [[int(e) for e in inp().split()] for _ in range(N)]
	print(*solve(N, O, C))
main()


n = int(input())
sum1 = 0
sum2 = 0
for i in range(n * 2):
	(a1, a2) = map(int, input().split())
	sum1 += a1
	sum2 += a2
print(sum1 // n, sum2 // n)


n = int(input())
x = [input().split() for i in range(n)]
a = [input().split() for i in range(n)]
temp = []
t = []
(sumX, sumY, sumA, sumB) = (0, 0, 0, 0)
for i in range(n):
	sumX += int(x[i][0])
	sumY += int(x[i][1])
	sumA += int(a[i][0])
	sumB += int(a[i][1])
print((sumX + sumA) // n, ' ', (sumY + sumB) // n)


n = int(input())
xm = ym = -10000000
for _ in range(n):
	(xi, yi) = map(int, input().split())
	(xm, ym) = max((xi, yi), (xm, ym))
am = bm = 10000000
for _2 in range(n):
	(ai, bi) = map(int, input().split())
	(am, bm) = min((ai, bi), (am, bm))
print(am + xm, bm + ym)


n = int(input())
x = [0] * n
y = [0] * n
a = [0] * n
b = [0] * n
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
ax = (sum(x) + sum(a)) // n
ay = (sum(y) + sum(b)) // n
print(ax, ay)


n = int(input())
obel = []
for i in range(n):
	(x, y) = [int(i) for i in input().split()]
	obel.append((x, y))
pods = []
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	pods.append([a, b])
possible = []
for i in range(n):
	possible.append([obel[0][0] + pods[i][0], obel[0][1] + pods[i][1]])
s = set(obel)
for i in range(n):
	(z, t) = possible[i]
	mainf = True
	for j in range(n):
		if (z - pods[j][0], t - pods[j][1]) not in s:
			mainf = False
	if mainf:
		print(z, t)
		break


from sys import stdin, stdout
from io import StringIO
fin = stdin
num_obelisks = int(fin.readline())
obs = []
for _ in range(num_obelisks):
	obs.append(tuple(map(int, fin.readline().strip().split())))
cls = []
for _ in range(num_obelisks):
	cls.append(tuple(map(int, fin.readline().strip().split())))

def loc_treasure(obelisks, clues):
	(bo_x, bo_y) = max(obelisks)
	(sc_x, sc_y) = min(clues)
	location = (bo_x + sc_x, bo_y + sc_y)
	return location
(x, y) = loc_treasure(obs, cls)
fout = stdout
fout.write(str(x) + ' ' + str(y) + '\n')
None


n = int(input())
ch = [0, 0]
ko = []
if n == 1:
	(a, b) = list(map(int, input().split()))
	(c, d) = list(map(int, input().split()))
	print(a + c, b + d)
	exit()
(x, y) = list(map(int, input().split()))
for i in range(n - 1):
	(a, b) = list(map(int, input().split()))
	ch[0] += a
	ch[1] += b
for i in range(n):
	(a, b) = list(map(int, input().split()))
	ko.append([a, b])
musx = 0
musy = 0
for i in range(n):
	musx += ko[i][0]
	musy += ko[i][1]
for i in range(n):
	if x + ko[i][0] == (musx - ko[i][0] + ch[0]) / (n - 1) and y + ko[i][1] == (musy - ko[i][1] + ch[1]) / (n - 1):
		print(x + ko[i][0], y + ko[i][1])


def jewel(lst, n):
	(sum_x, sum_y) = (0, 0)
	for elem in lst:
		sum_x += elem[0]
		sum_y += elem[1]
	return (sum_x // n, sum_y // n)
N = int(input())
a = list()
for i in range(2 * N):
	(x, y) = [int(j) for j in input().split()]
	a.append([x, y])
print(*jewel(a, N))


n = int(input())
obes = []
clue = []
for i in range(n):
	obes.append(list(map(int, input().split())))
for i in range(n):
	clue.append(list(map(int, input().split())))
obes.sort()
clue.sort(reverse=True)
(Tx, Ty) = (obes[0][0] + clue[0][0], obes[0][1] + clue[0][1])
print(Tx, Ty)


n = int(input())
ans1 = 0
ans2 = 0
for i in range(0, 2 * n):
	(a, b) = [int(x) for x in input().split()]
	ans1 += a
	ans2 += b
print(ans1 // n, ans2 // n)


import math
import os
import random
import re
import sys
n = int(input())
X = 0
Y = 0
for i in range(2 * n):
	start = list(map(int, input().rstrip().split()))
	X += start[0]
	Y += start[1]
x = int(X / (n + 0.0))
y = int(Y / (n + 0.0))
print(x, y)


sumx = sumy = 0
n = int(input())
for _ in range(n * 2):
	(x, y) = map(int, input().split())
	sumx += x
	sumy += y
print(sumx // n, sumy // n)


TN = 1

def solution():
	n = int(input())
	mp = [list(map(int, input().split())) for i in range(n)]
	pds = [list(map(int, input().split())) for i in range(n)]
	ansx = 0
	ansy = 0
	for i in range(n):
		ansx += mp[i][0] + pds[i][0]
		ansy += mp[i][1] + pds[i][1]
	print(ansx // n, ansy // n)
while TN != 0:
	solution()
	TN -= 1


n = int(input())
C = [list() for x in range(n)]
D = [list() for x in range(n)]
sumx = sumy = 0
for x in range(n):
	C[x] = list(map(int, input().split()))
for x in range(n):
	D[x] = list(map(int, input().split()))
for x in range(n):
	sumx += C[x][0] + D[x][0]
	sumy += C[x][1] + D[x][1]
print(sumx // n, sumy // n)


n = int(input().strip())
obelisks = []
clues = []
for i in range(n):
	obelisks.append(tuple(map(int, input().strip().split())))
for i in range(n):
	clues.append(tuple(map(int, input().strip().split())))
obelisks.sort()
clues.sort(reverse=True)
print(obelisks[0][0] + clues[0][0], obelisks[0][1] + clues[0][1])


n = int(input())
ansx = 0
ansy = 0
for i in range(2 * n):
	(x, y) = [int(a) for a in input().split()]
	ansx += x
	ansy += y
print(ansx // n, ansy // n)


n = int(input())
t1 = 0
t2 = 0
for i in range(0, n):
	(x, y) = map(int, input().split())
	t1 += x
	t2 += y
for i in range(0, n):
	(a, b) = map(int, input().split())
	t1 += a
	t2 += b
print(t1 // n, t2 // n)


R = lambda : map(int, input().split())
n = int(input())
sa = 0
sb = 0
for _ in range(n + n):
	(a, b) = R()
	sa += a
	sb += b
print(sa // n, sb // n)


def solve():
	n = list(map(int, input().split()))[0]
	xx = yy = 0
	for i in range(n * 2):
		(x, y) = list(map(int, input().split()))
		xx += x
		yy += y
	print(xx // n, yy // n)
solve()


n = int(input())
x = []
y = []
a = []
b = []
for i in range(n):
	(m, k) = map(int, input().split())
	x.append(m)
	y.append(k)
for j in range(n):
	(m, k) = map(int, input().split())
	a.append(m)
	b.append(k)
tx = (sum(x) + sum(a)) // n
ty = (sum(y) + sum(b)) // n
print(tx, ty)


n = int(input())
X = 0
Y = 0
for _ in range(2 * n):
	(x, y) = [int(x) for x in input().split()]
	X += x
	Y += y
print(X // n, Y // n)


n = int(input())
(x, y) = (0, 0)
for _ in range(2 * n):
	(dx, dy) = map(int, input().split())
	x += dx
	y += dy
print(x // n, y // n)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [tuple(map(int, l.split())) for l in sys.stdin]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = [LI() for _ in range(n)]
	b = [LI() for _ in range(n)]
	c = collections.defaultdict(int)
	for (i, j) in a:
		for (k, l) in b:
			c[i + k, j + l] += 1
	for (k, v) in c.items():
		if v == n:
			return ' '.join(map(str, k))
	return -1
print(main())


n = int(input())
res = [0, 0]
for _ in range(2 * n):
	l = [*map(int, input().split())]
	res[0] += l[0]
	res[1] += l[1]
print(res[0] // n, res[1] // n)


n = int(input())
(x, y) = (0, 0)
for _ in range(2 * n):
	(xi, yi) = map(int, input().split())
	x += xi
	y += yi
print(x // n, y // n)


n = int(input())
T = [0, 0]
for i in range(2 * n):
	(a, b) = map(int, input().split())
	T[0] += a
	T[1] += b
print(T[0] // n, T[1] // n)


n = int(input())
r_1 = 0
r_2 = 0
for i in range(2 * n):
	(x, y) = map(int, input().split())
	r_1 += x
	r_2 += y
print(r_1 // n, r_2 // n)


from itertools import permutations
n = int(input())
x = 0
y = 0
clx = 0
cly = 0
for _ in range(n):
	t = list(map(int, input().split()))
	x += t[0]
	y += t[1]
for _ in range(n):
	t = list(map(int, input().split()))
	clx += t[0]
	cly += t[1]
print((x + clx) // n, (y + cly) // n)


from collections import Counter
n = int(input())
a = []
b = []
final1 = []
final2 = []
for _ in range(n):
	l = [int(x) for x in input().split()]
	a.append(l)
for _ in range(n):
	m = [int(y) for y in input().split()]
	b.append(m)
for i in range(n):
	for j in range(n):
		final1.append(a[i][0] + b[j][0])
		final2.append(a[i][1] + b[j][1])
l1 = Counter(final1)
l2 = Counter(final2)
print(l1.most_common(1)[0][0], l2.most_common(1)[0][0])


n = int(input())
c = []
d = []
for i in range(n):
	(x, y) = map(int, input().split())
	c.append((x, y))
opt = {}
for i in range(n):
	(x, y) = map(int, input().split())
	d.append((x, y))
	for ic in c:
		k = (x + ic[0], y + ic[1])
		if k not in opt:
			opt[k] = 0
		opt[k] += 1
for o in opt:
	if opt[o] >= n:
		print(o[0], o[1])
		exit()


import sys
import itertools
amount = int(input())
obeliscs = []
vecs = set()
for i in range(amount):
	obeliscs.append([int(s) for s in input().split()])
for i in range(amount):
	vecs.add(tuple([int(s) for s in input().split()]))
for item in vecs:
	point = [obeliscs[0][0] + item[0], obeliscs[0][1] + item[1]]
	flag = False
	for j in range(1, amount):
		if not (point[0] - obeliscs[j][0], point[1] - obeliscs[j][1]) in vecs:
			flag = True
			break
	if not flag:
		print(' '.join([str(s) for s in point]))
		sys.exit(0)


n = int(input())
l1 = []
for i in range(n):
	(x, y) = map(int, input().split())
	l1.append([x, y])
l2 = []
for i in range(n):
	(a, b) = map(int, input().split())
	l2.append([a, b])
minn1 = 10000000
minn2 = 10000000
maxx1 = -10000000
maxx2 = -10000000
for i in range(n):
	if l1[i][0] < minn1:
		minn1 = l1[i][0]
	if l1[i][1] < minn2:
		minn2 = l1[i][1]
	if l1[i][0] > maxx1:
		maxx1 = l1[i][0]
	if l1[i][1] > maxx2:
		maxx2 = l1[i][1]
for i in range(n):
	if l2[i][0] < minn1:
		minn1 = l2[i][0]
	if l2[i][1] < minn2:
		minn2 = l2[i][1]
	if l2[i][0] > maxx1:
		maxx1 = l2[i][0]
	if l2[i][1] > maxx2:
		maxx2 = l2[i][1]
print(maxx1 + minn1, maxx2 + minn2)


n = int(input())
sumj = 0
sumk = 0
for i in range(n * 2):
	(j, k) = map(int, input().split())
	sumj += j
	sumk += k
print(sumj // n, sumk // n)


n = int(input())
(s1, s2) = (0, 0)
for i in range(2 * n):
	(x, y) = map(int, input().split())
	s1 += x
	s2 += y
print(int(s1 / n), int(s2 / n))


a = int(input())
(x, y) = (0, 0)
for _ in ' ' * (2 * a):
	(g, h) = map(int, input().split())
	x += g
	y += h
print(x // a, y // a)


n = int(input())
xs = []
ys = []
for i in range(n):
	(x, y) = map(int, input().split())
	xs.append(x)
	ys.append(y)
	(a, b) = map(int, input().split())
	xs.append(a)
	ys.append(b)
x = sum(xs) // n
y = sum(ys) // n
print(x, y)


import collections
import itertools
from functools import reduce
mod = 10 ** 9 + 7

def permutationbysum():
	for _ in range(int(input())):
		(num, l, r, achieve) = map(int, input().split())
		k = r - l + 1
		if k * (k + 1) // 2 <= achieve <= k * (num * 2 + 1 - k) // 2:
			outpos = r % num
			inpos = l - 1
			ans = [0] * num
			for i in range(num, 0, -1):
				if achieve - i > 0 or (achieve - i == 0 and inpos == r - 1):
					achieve -= i
					ans[inpos] = i
					inpos += 1
				else:
					ans[outpos] = i
					outpos += 1
					outpos %= num
			print(*ans)
		else:
			print(-1)

def peaks():
	for _ in range(int(input())):
		(num, peak) = map(int, input().split())
		pos = 1
		rpos = num
		ans = []
		now = 0
		if num == 1:
			if not peak:
				print(1)
			else:
				print(-1)
			continue
		if num == 2:
			if peak:
				print(-1)
			else:
				print(1, 2)
			continue
		added = 0
		while rpos + 1 != pos:
			if not peak:
				while pos <= rpos:
					ans.append(pos)
					pos += 1
				break
			if not now:
				ans.append(pos)
				pos += 1
			else:
				ans.append(rpos)
				rpos -= 1
				if num - added != 1:
					peak -= 1
			added += 1
			now = 1 - now
		if peak:
			print(-1)
			continue
		print(*ans)
import sys
input = sys.stdin.readline

def addone():
	for _ in range(int(input())):
		(num, changes) = input().split()
		l = collections.deque(sorted([int(i) for i in num]))
		perm = collections.deque()
		changes = int(changes)
		cd = 0
		ans = len(num)
		while True:
			nextnum = l.pop()
			while perm and perm[-1] == nextnum:
				l.append(perm.pop())
			c = 10 - nextnum - cd
			changes -= c
			cd += c
			if changes >= 0:
				if not c:
					perm.appendleft(1 - cd)
					l.appendleft(-cd)
				else:
					l.appendleft(1 - cd)
					l.appendleft(-cd)
				ans += 1
			else:
				break
		print(ans % 1000000007)
import math

def andsequences():

	def mapping(num):
		nonlocal mnum
		nonlocal c
		num = int(num)
		if num < mnum:
			mnum = num
			c = 1
		elif num == mnum:
			c += 1
		return num
	mod = 1000000007
	for _ in range(int(input())):
		mnum = float('inf')
		c = 0
		num = int(input())
		l = list(map(mapping, input().split()))
		for i in l:
			if mnum & i != mnum:
				print(0)
				break
		else:
			if c == 1:
				print(0)
			else:
				print(math.factorial(num - 2) * (c - 1) * c % mod)

def numberdigit():
	n = 10 ** 5 * 2
	l = [0] * 11
	mod = 10 ** 9 + 7
	l[0] = l[1] = l[2] = l[3] = l[4] = l[5] = l[6] = l[7] = l[8] = 2
	l[9] = 3
	l[10] = 4
	for i in range(11, n):
		l.append((l[i - 10] + l[i - 9]) % mod)
	for _ in range(int(input())):
		(num, c) = input().split()
		c = int(c)
		ans = 0
		for i in num:
			i = int(i)
			if 10 - i > c:
				ans += 1
			else:
				ans += l[c - (10 - i)]
		print(ans % mod)

def mushroom():
	(people, t1, t2, percent) = map(int, input().split())
	l = []
	percent = 1 - percent * 0.01
	for i in range(1, people + 1):
		(s, s1) = map(int, input().split())
		l.append([i, max(s * t1 * percent + s1 * t2, s1 * t1 * percent + s * t2)])
	l.sort(key=lambda x: x[1], reverse=True)
	for i in l:
		i[1] = '{:.2f}'.format(i[1])
		print(*i)

def escape():
	prins = int(input())
	dra = int(input())
	start = int(input())
	pack = int(input())
	c = int(input())
	speeddiff = dra - prins
	if speeddiff <= 0:
		return 0
	pd = start * prins
	ans = 0
	while pd < c:
		hs = pd / speeddiff
		pd += prins * hs
		if pd >= c:
			break
		time = pd / dra
		time += pack
		pd += prins * time
		ans += 1
	return ans

def perm():

	def high(n, k):
		return k * (2 * n - k + 1) // 2

	def low(k):
		return k * (k + 1) // 2
	for _ in range(int(input())):
		(num, lef, rig, s) = map(int, input().split())
		k = rig - lef + 1
		(rig, lef) = (rig - 1, lef - 1)
		if not high(num, k) >= s >= low(k):
			print(-1)
			continue
		l = [0] * num
		lp = lef
		rp = lef - 1
		for i in range(num, 0, -1):
			if high(i, k) >= s and s - i >= low(k - 1) and k:
				l[lp] = i
				lp += 1
				s -= i
				k -= 1
			else:
				l[rp] = i
				rp -= 1
		if k:
			print(-1)
		else:
			print(*l)

def newcom():
	for _ in range(int(input())):
		(days, price) = map(int, input().split())
		dl = input().split()
		worth = input().split()
		worth.append(0)
		ans = float('inf')
		req = 0
		left = 0
		for i in range(days):
			a = int(dl[i])
			w = int(worth[i])
			ans = min(ans, req + max(0, price - left + a - 1) // a)
			ns = max(0, w - left + a - 1) // a
			req += ns + 1
			left += a * ns - w
		print(ans)

def perfectsq():
	for _ in range(int(input())):
		n = input()
		for i in input().split():
			sq = math.sqrt(int(i))
			if sq != int(sq):
				print('YES')
				break
		else:
			print('NO')

def and0big():
	for _ in range(int(input())):
		(l, k) = map(int, input().split())
		print(l ** k % mod)
import math

def mod1p():
	n = int(input())
	ans = dict()
	p = 1
	for i in range(1, n):
		if math.gcd(i, n) == 1:
			ans[str(i)] = True
			p = p * i % n
	if p == 1:
		print(len(ans))
		print(' '.join(ans.keys()))
	else:
		ans.pop(str(p))
		print(len(ans))
		print(' '.join(ans.keys()))

def shorttask():
	num = 10000100
	l = [-1] * (num + 2)
	s = [-1] * (num + 2)
	l[1] = 1
	for i in range(2, int(math.sqrt(num + 1)) + 2):
		if l[i] == -1:
			l[i] = i
			for x in range(i * i, num + 1, i):
				if l[x] == -1:
					l[x] = i
	s[1] = 1
	for i in range(2, num + 1):
		if l[i] == -1:
			l[i] = i
			s[i] = i + 1
		else:
			i1 = i
			s[i] = 1
			while i1 % l[i] == 0:
				i1 //= l[i]
				s[i] = s[i] * l[i] + 1
			s[i] *= s[i1]
	ans = [-1] * (num + 1)
	for i in range(num, 0, -1):
		if s[i] < num:
			ans[s[i]] = i
	for _ in range(int(input())):
		print(ans[int(input())])

def review():
	for _ in range(int(input())):
		n = int(input())
		ans = 0
		for i in input().split():
			i = int(i)
			if i == 1 or i == 3:
				ans += 1
		print(ans)

def GCDleng():
	po10 = [0] * 11
	po10[1] = 1
	for i in range(2, 11):
		po10[i] = po10[i - 1] * 10
	for _ in range(int(input())):
		(n, n1, res) = map(int, input().split())
		print(po10[n], po10[n1] + po10[res])

def anothercarddeck():
	(n, q) = map(int, input().split())
	l = input().split()
	d = {l[i]: i for i in range(n - 1, -1, -1)}
	ans = []
	for i in input().split():
		now = d[i]
		ans.append(now + 1)
		for key in d:
			if d[key] < now:
				d[key] += 1
		d[i] = 0
	print(*ans)

def mincoststring():
	(n, letters) = map(int, input().split())
	l = [chr(i + 97) for i in range(letters)]
	ans = []
	real = letters - 1
	if not n:
		print(*ans, sep='')
		return
	if n == 1:
		print(*ans, sep='', end='')
		print(l[1 % (real + 1)])
		return
	while n:
		for i in range(len(l)):
			for i1 in range(i, len(l)):
				if i1 != real:
					ans.append(l[i1])
					ans.append(l[i])
					n -= 2
				else:
					ans.append(l[i1])
					n -= 1
				if not n:
					print(*ans, sep='')
					return
				if n == 1:
					print(*ans, sep='', end='')
					print(l[(i1 + 1) % (real + 1)])
					return
	print(*ans)

def mincost2():
	(n, letters) = map(int, input().split())
	l = [chr(i + 97) for i in range(letters)]
	comb = []
	if letters == 1 or n == 1:
		print('a' * n)
		return
	for i in range(letters):
		for i1 in range(i, letters):
			comb.append(l[i1] + l[i])
	lc = len(comb)
	while True:
		for i in range(lc):
			if ord(comb[i][0]) - 97 == letters - 1:
				n -= 1
				print(comb[i][0], end='')
			else:
				n -= 2
				print(comb[i], end='')
			if n == 1:
				pos = ord(comb[i][0]) - 97 + 1
				print(l[pos % letters])
				return
			if not n:
				return

def Tittat():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		l = list(map(int, input().split()))
		for i in range(n):
			if not k:
				break
			while k and l[i]:
				l[i] -= 1
				l[-1] += 1
				k -= 1
		print(*l)

def xorq2():
	for _ in range(int(input())):
		n = int(input())
		s = 0
		num = -1
		nc = 0
		c = 0
		for i in input().split():
			i = int(i)
			s ^= i
			c += 1
			if num == -1 and s == i:
				num = s
				s = 0
				nc += c
				c = 0
			if num != -1 and (s == num or not s):
				s = 0
				nc += c
				c = 0
		print(['NO', 'YES'][nc == n])

def xorq2re():
	n = int(input())
	s = input().split()
	xor = 0
	for i in range(n):
		s[i] = int(s[i])
		xor ^= s[i]
	if not xor:
		print('YES')
	else:
		new = 0
		ans = 0
		for i in s:
			new ^= i
			if new == xor:
				new = 0
				ans += 1
		print(['NO', 'YES'][ans > 1])
import sys
sys.setrecursionlimit(2300)

def q3partition():

	def partition():
		if tol % 2:
			return 0
		up = tol
		rec = [[False] * (up + 2) for _ in range(n + 1)]
		rec[0][0] = True
		for i in range(1, n + 1):
			v = l[i - 1]
			for j in range(up + 1):
				if rec[i - 1][j]:
					if v + j <= up:
						rec[i][j + v] = True
					rec[i][j] = True
		return rec[n][tol // 2]

	def ints(x):
		nonlocal tol
		nonlocal gcf
		x = int(x)
		tol += x
		gcf = math.gcd(gcf, x) if gcf != float('inf') else x
		return x
	n = int(input())
	tol = 0
	gcf = float('inf')
	l = list(map(ints, input().split()))
	if partition():
		pos = 1
		for i in l:
			if i // gcf % 2:
				print(1)
				print(pos)
				return
			pos += 1
	else:
		print(0)

def permu(n, r):
	return math.factorial(n) // math.factorial(n - r)

def comb(n, r):
	return math.factorial(n) // math.factorial(r) * math.factorial(n - r)

def calc():
	n = int(input())
	ans = permu(n, n)
	for i in range(1, n + 1):
		ans -= comb(n, i)
	print(ans)

def order():
	for _ in range(int(input())):
		n = int(input())
		odd = []
		even = []
		for i in input().split():
			i = int(i)
			if i % 2:
				odd.append(i)
			else:
				even.append(i)
		print(*odd + even)

def TMTdoc():
	n = int(input())
	l = input().rstrip()
	tts = 0
	tms = 0
	for i in l:
		if i == 'T':
			tts += 1
		else:
			tms += 1
	if tms * 2 == tts:
		nowts = 0
		nowms = 0
		for i in l:
			if i == 'T':
				nowts += 1
			else:
				nowms += 1
				if nowts >= nowms and tms - nowms + 1 <= tts - nowts:
					continue
				return 'NO'
	else:
		return 'NO'
	return 'YES'

def relayrace():

	def solve(n):
		if n:
			s = -1
		else:
			s = 1
		nowmax = -float('inf')
		nowmin = -nowmax
		ans = 0
		for (i, v) in sorted(l, key=lambda x: (x[1], s * int(x[0])), reverse=True):
			i = int(i)
			if i > nowmax:
				nowmax = i
			if i < nowmin:
				nowmin = i
			ans += v * (nowmax - nowmin)
		return ans
	n = int(input())
	l = -1
	ans = 0
	for i in sorted(input().split(), key=lambda x: int(x)):
		if l == -1:
			l = int(i)
		else:
			ans += int(i) - l
	return ans

def relayraces():
	n = int(input())
	l = sorted(map(int, input().split()))
	minv = float('INF')
	minpos = 0
	for i in range(len(l)):
		if i > 0 and 0 <= l[i] - l[i - 1] <= minv:
			minv = l[i] - l[i - 1]
			minpos = i
		if i < n - 1 and l[i + 1] - l[i] <= minv:
			minv = l[i + 1] - l[i]
			minpos = i
	lpos = minpos - 1
	rpos = minpos + 1
	ans = 0
	while lpos >= 0 and rpos < n:
		diffl = -(l[lpos] - l[minpos])
		diffr = l[rpos] - l[minpos]
		if diffl < diffr:
			minpos = lpos
			lpos -= 1
			ans += diffl
		else:
			minpos = rpos
			rpos += 1
			ans += diffr
	if lpos < 0:
		m = l[0]
		for i in range(rpos, n):
			ans += l[i] - m
	else:
		h = l[-1]
		for i in range(minpos, -1, -1):
			ans += h - l[i]
	return ans

def relayracess():

	def recur(l, r):
		if l == r:
			return 0
		if d[l, r] != -1:
			return d[l, r]
		ans = nums[r] - nums[l] + min(recur(l + 1, r), recur(l, r - 1))
		d[l, r] = ans
		return ans
	d = collections.defaultdict(lambda : -1)
	n = int(input())
	nums = sorted(map(int, input().split()))
	return recur(0, n - 1)

def relayracesss():
	n = int(input())
	l = sorted(map(int, input().split()))
	dp = [[0] * n for _ in range(n)]
	for i in range(n - 2, -1, -1):
		for i1 in range(i + 1, n):
			dp[i][i1] = l[i1] - l[i] + min(dp[i + 1][i1], dp[i][i1 - 1])
	return dp[0][n - 1]

def relayracessss():
	n = int(input())
	l = sorted(map(int, input().split()))
	dp = [0] * n
	for le in range(n - 2, -1, -1):
		for ri in range(le + 1, n):
			dp[ri] = l[ri] - l[le] + min(dp[ri], dp[ri - 1])
	return dp[-1]

def binli():
	n = int(input())
	n2 = n * 2
	s = input().rstrip()
	s1 = input().rstrip()
	s2 = input().rstrip()
	posl = [0, 0, 0]
	ans = ''
	while max(posl) < n2:
		l = [[], []]
		l[int(s[posl[0]])].append(0)
		l[int(s1[posl[1]])].append(1)
		l[int(s2[posl[2]])].append(2)
		if len(l[0]) >= 2:
			for i in l[0]:
				posl[i] += 1
			ans += '0'
		else:
			for i in l[1]:
				posl[i] += 1
			ans += '1'
	if posl[0] == n2:
		if posl[1] >= posl[2]:
			ans += s1[posl[1]:]
		else:
			ans += s2[posl[2]:]
	elif posl[1] == n2:
		if posl[0] >= posl[2]:
			ans += s[posl[0]:]
		else:
			ans += s2[posl[2]:]
	elif posl[0] >= posl[1]:
		ans += s[posl[0]:]
	else:
		ans += s1[posl[1]:]
	print(ans)

def almostsort():
	(n, k) = map(int, input().split())
	ul = 2 ** (n - 1)
	if k > ul:
		return [-1]
	permen = []
	bi = bin(k - 1)[2:]
	if bi == '0':
		return range(1, n + 1)
	pos = n - len(bi)
	ans = list(range(1, pos))
	for i in bi:
		permen.append(pos)
		if not int(i):
			ans += permen[::-1]
			permen = []
		pos += 1
	permen.append(n)
	ans += permen[::-1]
	return ans

def q1_2050():
	for i in range(int(input())):
		s = int(input())
		if s % 2050:
			print(-1)
		else:
			ab = 2050
			while ab <= s:
				ab *= 10
			ab //= 10
			c = 0
			while s and s != 1:
				c += s // ab
				s = s % ab
				while s != 1 and s and (s < ab):
					ab //= 10
			print(c)

def q2jog():
	(n, m) = map(int, input().split())
	sortbyval = []
	rowsv = [collections.defaultdict(int) for _ in range(n)]
	for row in range(n):
		for i in input().split():
			i = int(i)
			sortbyval.append([i, row])
			rowsv[row][i] += 1
	sortbyval.sort(key=lambda x: x[0])
	larl = []
	for i in range(0, n * m, m):
		larl.append(sortbyval[i:i + m])
	ans = [[0] * m for _ in range(n)]
	person = 0
	for i in larl:
		for (v, pos) in i:
			ans[pos][person] = v
			rowsv[pos][v] -= 1
			person += 1
			if person == m:
				break
		else:
			continue
		break
	for r in range(n):
		for c in range(m):
			if not ans[r][c]:
				for key in list(rowsv[r].keys()):
					if not rowsv[r][key]:
						rowsv[r].pop(key)
						continue
					rowsv[r][key] -= 1
					ans[r][c] = key
					break
	for i in ans:
		print(*i)

def q3fillomino(n, inp):

	def gorow():
		nonlocal nowp
		nonlocal col
		nonlocal totake
		t = 0
		if nowp and col < n and totake and (not l[col][nowp - 1]):
			for back in range(nowp, -1, -1):
				if l[col][back]:
					nowp += 1
					col += 1
					return t
				if not totake:
					return t
				l[col][back] = i
				totake -= 1
				nowp -= 1
				t = 1
			nowp += 1
			col += 1
		return t
	l = [[0] * i for i in range(1, n + 1)]
	p = 0
	for i in inp:
		totake = int(i)
		nowp = p
		col = p
		while col < n:
			if not totake:
				break
			for _ in range(n - p):
				if not gorow():
					break
			if not totake or col == n or nowp == n:
				break
			l[col][nowp] = i
			totake -= 1
			col += 1
		p += 1
	for i in l:
		print(*i)

def q3fillominoclear(n, inp):
	l = [[0] * i for i in range(1, n + 1)]
	p = 0
	for i in inp:
		take = int(i) - 1
		l[p][p] = i
		(x, y) = (p, p)
		while take:
			if y and (not l[x][y - 1]):
				y -= 1
			else:
				x += 1
			l[x][y] = i
			take -= 1
		p += 1
	for i in l:
		print(*i)

def q4explor():

	def gen(r, c):
		res = float('inf')
		if r:
			res = min(res, his[r - 1][c] + 2 * colstep[r - 1][c])
		if r < rows - 1:
			res = min(res, his[r + 1][c] + 2 * colstep[r][c])
		if c:
			res = min(res, his[r][c - 1] + 2 * rowstep[r][c - 1])
		if c < cols - 1:
			res = min(res, his[r][c + 1] + 2 * rowstep[r][c])
		return res
	(rows, cols, k) = map(int, input().split())
	if k % 2:
		for i in range(rows):
			print(*[-1] * cols)
		return
	rowstep = [list(map(int, input().split())) for _ in range(rows)]
	colstep = [list(map(int, input().split())) for _ in range(rows - 1)]
	his = [[0] * cols for _ in range(rows)]
	for _ in range(k // 2):
		temp = [[gen(r, c) for c in range(cols)] for r in range(rows)]
		his = temp
	for i in his:
		print(*i)

def cvacations():

	def de(v):
		nonlocal last
		if v == 2:
			last = 2
		elif v == 1:
			last = 1
	n = int(input())
	ans = 0
	last = 0
	l = input().split()
	for i1 in range(n):
		i = int(l[i1])
		if not i:
			last = 0
			ans += 1
			continue
		if i == 1:
			if last != 2:
				last = 2
				continue
			ans += 1
			last = 0
		elif i == 2:
			if last != 1:
				last = 1
				continue
			ans += 1
			last = 0
		elif not last:
			if i1 < n - 1:
				de(int(l[i1 + 1]))
				if int(l[i1 + 1]) == 3:
					for pos in range(i1 + 2, n):
						if l[pos] != 3:
							r = l[pos]
							break
					else:
						last = 1
						continue
					de(r)
			else:
				break
		elif last == 1:
			last = 2
		elif last == 2:
			last = 1
	return ans

def brackets():
	s = input().rstrip()
	(lpos, rpos) = (0, len(s) - 1)
	ans = []
	while lpos + 1 <= rpos:
		if s[lpos] == '(':
			if s[rpos] == ')':
				ans.append(lpos + 1)
				ans.append(rpos + 1)
				lpos += 1
				rpos -= 1
			else:
				rpos -= 1
		else:
			lpos += 1
	if ans:
		print(1)
		print(len(ans))
		print(*sorted(ans))
	else:
		print(0)

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

def complibook():
	(n, q) = In()
	nums = list(In())
	for _ in range(q):
		(l, r, x) = In()
		num = nums[x - 1]
		les = 0
		for i in range(l - 1, r):
			if nums[i] < num:
				les += 1
		print(['No', 'Yes'][les + l - 1 == x - 1])

def bstr():
	for _ in range(int(input())):
		(n, k) = In()
		now = 1
		times = 2
		while k > now:
			k -= now
			now += 1
			times += 1
		fir = n - times
		sec = n - k
		for i in range(n):
			if i == fir or i == sec:
				print('b', end='')
			else:
				print('a', end='')
		print()

def avgsuper():
	(n, k, oper) = In()
	l = sorted(In(), reverse=True)
	nowavg = sum(l) / n
	(addpos, addnum) = (0, 0)
	for i in range(oper):
		if n == 1 and addpos != 0:
			break
		new = (nowavg * n - l[n - 1]) / max(n - 1, 1)
		if 1 / n > new - nowavg and addpos < n:
			addnum += 1
			if addnum >= k:
				addpos += 1
				addnum = 0
			nowavg += 1 / n
		else:
			nowavg = new
			n -= 1
	print(nowavg)

def avgsuper2():
	(n, k, oper) = In()
	l = sorted(In(), reverse=True)
	prefix = [0] * (n + 1)
	for i in range(1, n + 1):
		prefix[i] = l[i - 1] + prefix[i - 1]
	prefix.pop(0)
	ans = 0
	for i in range(n - 1, max(-1, n - oper - 2), -1):
		ans = max(ans, (prefix[i] + min(k * (i + 1), oper - (n - i - 1))) / (i + 1))
	return ans

def tanna():
	(n, k, A, B) = (int(input()), int(input()), int(input()), int(input()))
	if k == 1:
		return (n - 1) * A
	x = n
	ans = 0
	while x != 1:
		if x < k:
			return ans + A * (x - 1)
		if not x % k:
			nexts = x // k
			ans += min(B, A * (x - nexts))
			x = nexts
		else:
			new = x % k
			ans += new * A
			x = x - new
	return ans

def segsqu():
	square = 1
	num = int(input())
	while num > square * square:
		square += 1
	cols = square
	rows = math.ceil(num / cols)
	print(cols + rows)

def ParallelUniverses():
	(n, k, m, t) = In()
	for _ in range(t):
		(sta, pos) = In()
		if sta:
			n += 1
			if pos - 1 < k:
				k += 1
		elif pos < k:
			k -= pos
			n -= pos
		else:
			n = pos
		print(n, k)

def treasure():
	num = int(input())
	choose = max([list(In()) for _ in range(num)])
	ch2 = min((list(In()) for _ in range(num)))
	print(choose[0] + ch2[0], choose[1] + ch2[1])
treasure()


n = int(input())
posx = []
clux = []
posy = []
cluy = []
for i in range(n):
	arr = [int(x) for x in input().split()]
	posx.append(arr[0])
	posy.append(arr[1])
for i in range(n):
	arr = [int(x) for x in input().split()]
	clux.append(arr[0])
	cluy.append(arr[1])
posx.sort()
posy.sort()
clux.sort()
cluy.sort()
print(posx[0] + clux[-1], posy[0] + cluy[-1])


n = int(input())
o = [list(map(int, input().split())) for _ in range(n)]
c = [list(map(int, input().split())) for _ in range(n)]
o.sort(key=lambda x: (x[0], x[1]))
c.sort(key=lambda x: (x[0], x[1]), reverse=True)
print(o[0][0] + c[0][0], o[0][1] + c[0][1])


n = int(input())
if n == 1:
	o = tuple(map(int, input().split()))
	c = tuple(map(int, input().split()))
	print(o[0] + c[0], o[1] + c[1])
	exit()
(a, b) = [tuple(map(int, input().split())) for _ in range(2)]
o = {tuple(map(int, input().split())) for _ in range(n - 2)}
c = [tuple(map(int, input().split())) for _ in range(n)]
sc = set(c)
o |= {a, b}

def check(tx, ty):
	for (x, y) in o:
		if (tx - x, ty - y) not in sc:
			return False
	return True
for i in range(n):
	for j in range(n):
		if i != j:
			if a[0] + c[i][0] == b[0] + c[j][0] and a[1] + c[i][1] == b[1] + c[j][1]:
				if check(a[0] + c[i][0], a[1] + c[i][1]):
					print(a[0] + c[i][0], a[1] + c[i][1])
					exit()


n = int(input())
ob = []
pod = []
for i in range(n):
	ob.append(tuple(map(int, input().split())))
for i in range(n):
	pod.append(tuple(map(int, input().split())))
vzmpoints = set()
for el in pod:
	vzmpoints.add((ob[0][0] + el[0], ob[0][1] + el[1]))
for v in ob:
	vzmpoints = vzmpoints & {(pod[i][0] + v[0], pod[i][1] + v[1]) for i in range(n)}
print(*vzmpoints.pop())


import sys
import math

def main():
	n = int(input())
	obelisk = [tuple(map(int, input().split())) for _ in range(n)]
	clue = [tuple(map(int, input().split())) for _ in range(n)]
	for i in range(n):
		(x, y) = (obelisk[i][0] + clue[0][0], obelisk[i][1] + clue[0][1])
		lol = [(x - ox, y - oy) for (ox, oy) in obelisk]
		if set(lol) == set(clue):
			print('{} {}'.format(x, y))
			break
main()


import sys

def inpt():
	return sys.stdin.readline().strip()
n = int(inpt())
x = 0
y = 0
for i in range(2 * n):
	(xt, yt) = [int(i) for i in inpt().split()]
	x += xt
	y += yt
print(x // n, y // n)


t = int(input())
a = []
b = []
for i in range(2 * t):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
print(sum(a) // t, sum(b) // t)


n = int(input())
a = []
b = []
for _ in range(n):
	(s, t) = map(int, input().split())
	a.append(s)
	b.append(t)
c = []
d = []
for _ in range(n):
	(s, t) = map(int, input().split())
	c.append(s)
	d.append(t)
x = min(a) + max(c)
y = min(b) + max(d)
print(x, y)


import itertools
import random
num_input = int(input())
obelisk = []
clue = []
for i in range(0, num_input):
	(x, y) = list(map(int, input().split()))
	obelisk.append((x, y))
for i in range(0, num_input):
	(x, y) = list(map(int, input().split()))
	clue.append((x, y))
sum_x = 0
sum_y = 0
for i in range(0, num_input):
	sum_x += obelisk[i][0] + clue[i][0]
	sum_y += obelisk[i][1] + clue[i][1]
print('{:d} {:d}'.format(sum_x // num_input, sum_y // num_input))


n = int(input())
xy = []
ab = []
for i in range(n):
	xy.append(list(map(int, input().split())))
for i in range(n):
	ab.append(list(map(int, input().split())))
ans = []
for i in xy:
	for j in ab:
		ans.append((i[0] + j[0], i[1] + j[1]))
d = {}
for i in ans:
	if i in d:
		d[i] += 1
		if d[i] == n:
			print(*list(i))
	else:
		d[i] = 1
		if d[i] == n:
			print(*list(i))


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
c = []
l = []
for i in range(n):
	c.append(I())
s = set()
d = {}
m = 0
ans = 0
for i in range(n):
	l.append(I())
	for j in c:
		x = j[0]
		y = j[1]
		a = (l[i][0] + x, l[i][1] + y)
		if a in d:
			d[a] += 1
		else:
			d[a] = 1
		if d[a] > m:
			m = d[a]
			ans = a
print(ans[0], ans[1])


import math
n = int(input())
ml1 = -math.inf
ml2 = -math.inf
sl1 = math.inf
sl2 = math.inf
for each in range(n):
	x = input().split()
	(x[0], x[1]) = (int(x[0]), int(x[1]))
	if x[0] >= ml1:
		ml1 = x[0]
	if x[1] >= ml2:
		ml2 = x[1]
for each in range(n):
	x = input().split()
	(x[0], x[1]) = (int(x[0]), int(x[1]))
	if x[0] <= sl1:
		sl1 = x[0]
	if x[1] <= sl2:
		sl2 = x[1]
print(ml1 + sl1, ml2 + sl2)


n = int(input())
x = y = 0
for i in range(2 * n):
	line = input()
	line = line.split(' ')
	x += int(line[0])
	y += int(line[1])
print(x // n, y // n)


n = int(input())
(x, y, a, b) = ([], [], [], [])
for _ in range(n):
	(xi, yi) = map(int, input().split())
	x.append(xi)
	y.append(yi)
for _ in range(n):
	(ai, bi) = map(int, input().split())
	a.append(ai)
	b.append(bi)
x.sort()
y.sort()
a.sort()
b.sort()
print('%d %d' % (x[0] + a[-1], y[0] + b[-1]))


from collections import Counter
n = int(input())
l = [[int(i) for i in input().split()] for i in range(2 * n)]
xy = [l[i] for i in range(n)]
ab = [l[i] for i in range(n, 2 * n)]
m = []
for i in xy:
	for j in ab:
		m.append((i[0] + j[0], i[1] + j[1]))
c = Counter(m)
p = c.most_common(1)
print(*p[0][0])


n = int(input())
arr = []
for i in range(n):
	(x, y) = map(int, input().split())
	arr.append((x, y))
arr1 = []
for i in range(n):
	(a, b) = map(int, input().split())
	arr1.append((a, b))
dict1 = {}
for i in range(n):
	dict2 = {}
	for j in range(n):
		val1 = arr[i][0] + arr1[j][0]
		val2 = arr[i][1] + arr1[j][1]
		try:
			dict1[val1, val2] += 1
		except:
			KeyError
			dict1[val1, val2] = 1
for i in dict1.keys():
	if dict1[i] == n:
		print(i[0], i[1])
		break


N = int(input())
obelisk = []
clue = []
matrix = {}
for x in range(N):
	obelisk.append(list(map(int, input().split())))
for x in range(N):
	clue.append(list(map(int, input().split())))
for i in obelisk:
	for j in clue:
		x = i[0] + j[0]
		y = i[1] + j[1]
		try:
			matrix[str(x) + ' ' + str(y)] += 1
		except:
			matrix[str(x) + ' ' + str(y)] = 1
for (i, j) in matrix.items():
	if j == N:
		print(i)
		break


n = int(input())
obe = [list(map(int, input().split())) for i in range(n)]
clues = [list(map(int, input().split())) for i in range(n)]
ti = sum([i[0] for i in obe]) + sum([i[0] for i in clues])
tj = sum([i[1] for i in obe]) + sum([i[1] for i in clues])
ti = ti // n
tj = tj // n
print(ti, tj)


import sys
import math

def solve(n):
	(x, y) = ([], [])
	for i in range(n):
		(q, w) = map(int, input().split())
		x.append(q)
		y.append(w)
	(a, b) = ([], [])
	for i in range(n):
		(q, w) = map(int, input().split())
		a.append(q)
		b.append(w)
	ans = [max(x) + min(a), max(y) + min(b)]
	for i in ans:
		print(i, end=' ')
n = int(input())
ans = solve(n)


n = int(input())
a = [tuple(map(int, input().split())) for i in range(n)]
b = [tuple(map(int, input().split())) for i in range(n)]
a.sort()
b.sort(reverse=True)
print(a[0][0] + b[0][0], a[0][1] + b[0][1])


n = int(input())
pos = []
diffs = []
for i in range(n):
	(a, b) = map(int, input().split())
	pos.append((a, b))
for i in range(n):
	(c, d) = map(int, input().split())
	diffs.append((c, d))
pos.sort()
diffs.sort(reverse=True)
print(pos[0][0] + diffs[0][0], pos[0][1] + diffs[0][1])


import sys

def add(a, b):
	return (a[0] + b[0], a[1] + b[1])

def diff(a, b):
	return (a[0] - b[0], a[1] - b[1])
n = int(input())
P = [tuple((int(x) for x in input().split())) for _ in range(n)]
D = [tuple((int(x) for x in input().split())) for _ in range(n)]
pts = [add(P[0], D[i]) for i in range(n)]
from collections import defaultdict as dd, deque
sD = dd(int)
for d in D:
	sD[d] += 1
for pt in pts:
	S = sD.copy()
	for i in range(n):
		d = diff(pt, P[i])
		if S[d] > 0:
			S[d] -= 1
		else:
			break
	else:
		print(*pt)
		sys.exit()


n = int(input())
xy = []
for _ in range(n):
	xy.append([int(x) for x in input().split()])
ab = []
for _ in range(n):
	ab.append([int(x) for x in input().split()])
xy.sort()
ab.sort(reverse=True)
ans = (xy[0][0] + ab[0][0], xy[0][1] + ab[0][1])
print(ans[0], ans[1])


t = int(input())
l = []
for i in range(2 * t):
	(n, k) = map(int, input().split())
	l.append((n, k))
ans = []
for i in range(2):
	s = 0
	for j in range(len(l)):
		s += l[j][i]
	ans.append(s // t)
print(*ans)


from collections import defaultdict
(N, Obelisk, MyDict) = (int(input()), [], defaultdict(int))
for i in range(N):
	Obelisk.append(list(map(int, input().split())))
for i in range(N):
	Temp = list(map(int, input().split()))
	for j in range(N):
		Coordinate = (Obelisk[j][0] + Temp[0], Obelisk[j][1] + Temp[1])
		MyDict[Coordinate] += 1
		if MyDict[Coordinate] == N:
			print(*Coordinate)
			exit()


from sys import stdin, stdout
from collections import defaultdict
n = int(stdin.readline())
x = list()
y = list()
for i in range(n):
	x.append([int(a) for a in stdin.readline().split()])
for i in range(n):
	y.append([int(a) for a in stdin.readline().split()])
ans = defaultdict(lambda : 0)
for i in x:
	for j in y:
		r = (i[0] + j[0], i[1] + j[1])
		ans[r] += 1
t = [0, 0]
for (k, v) in ans.items():
	if v > t[1]:
		t = [k, v]
ans = t[0]
stdout.write('{} {}'.format(ans[0], ans[1]))


from collections import defaultdict
n = int(input())
arr = []
d = {}
d2 = defaultdict(int)
listt = []
goal = (0, 0)
for _ in range(n):
	(x, y) = map(int, input().split())
	arr.append((x, y))
(x, y) = arr[0]
for _ in range(n):
	(a, b) = map(int, input().split())
	d[str((a, b))] = 0
	listt.append((a, b))
for i in range(n):
	(x, y) = arr[i]
	for j in range(n):
		(a, b) = listt[j]
		d2[str((x + a, y + b))] += 1
		if d2[str((x + a, y + b))] == n:
			goal = (x + a, y + b)
print(*goal)


n = int(input())
p = [tuple(map(int, input().split())) for _ in range(n)]
q = [tuple(map(int, input().split())) for _ in range(n)]
(sumx, sumy) = (0, 0)
for (i, j) in p:
	sumx += i
	sumy += j
for (i, j) in q:
	sumx += i
	sumy += j
sumx //= n
sumy //= n
print(sumx, sumy)


n = int(input())
l1 = []
for i in range(n):
	l1.append([int(j) for j in input().split()])
l2 = []
for i in range(n):
	l2.append([int(j) for j in input().split()])
l1.sort()
l2.sort()
x = l1[0][0] + l2[-1][0]
y = l1[0][1] + l2[-1][1]
print(x, y)


n = int(input())
Ob = []
P = []
S = []
D = dict()
for i in range(n):
	(x, y) = map(int, input().split())
	Ob.append((x, y))
for i in range(n):
	(a, b) = map(int, input().split())
	P.append((a, b))
for i in range(n):
	for j in range(n):
		t = (Ob[i][0] + P[j][0], Ob[i][1] + P[j][1])
		if t not in D:
			D[t] = 1
		else:
			D[t] += 1
for (k, v) in D.items():
	if v == n:
		print(*k)
		break


n = int(input().strip())
(sum_x, sum_y) = (0, 0)
for i in range(2 * n):
	(xa, xb) = [int(i) for i in input().strip().split(' ')]
	sum_x += xa
	sum_y += xb
print(sum_x // n, sum_y // n)


n = int(input())
(l, c) = ([], [])
for _ in range(2 * n):
	(a, b) = map(int, input().split())
	if _ < n:
		l.append((a, b))
	else:
		c.append((a, b))
l.sort()
c.sort()
ans = []
for i in range(n):
	ans.append((l[i][0] + c[n - i - 1][0], l[i][1] + c[n - i - 1][1]))
ans.sort()
print(*ans[0])


n = int(input())
sumx1 = 0
sumy1 = 0
sumx2 = 0
sumy2 = 0
for i in range(n):
	(x, y) = list(map(int, input().split()))
	sumx1 += x
	sumy1 += y
for i in range(n):
	(x, y) = list(map(int, input().split()))
	sumx2 += x
	sumy2 += y
sumx2 = (sumx2 + sumx1) // n
sumy2 = (sumy2 + sumy1) // n
print('{} {}'.format(sumx2, sumy2))


n = int(input())
(x, y, a, b) = ([0] * n, [0] * n, [0] * n, [0] * n)
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
print(max(x) + min(a), max(y) + min(b))


from sys import stdin, stdout
import cProfile, math
from collections import Counter
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10000000)

class Operation:

	def __init__(self, name, function, function_on_equal, neutral_value=0):
		self.name = name
		self.f = function
		self.f_on_equal = function_on_equal

def add_multiple(x, count):
	return x * count

def min_multiple(x, count):
	return x

def max_multiple(x, count):
	return x
sum_operation = Operation('sum', sum, add_multiple, 0)
min_operation = Operation('min', min, min_multiple, 1000000000.0)
max_operation = Operation('max', max, max_multiple, -1000000000.0)

class SegmentTree:

	def __init__(self, array, operations=[sum_operation, min_operation, max_operation]):
		self.array = array
		if type(operations) != list:
			raise TypeError('operations must be a list')
		self.operations = {}
		for op in operations:
			self.operations[op.name] = op
		self.root = SegmentTreeNode(0, len(array) - 1, self)

	def query(self, start, end, operation_name):
		if self.operations.get(operation_name) == None:
			raise Exception('This operation is not available')
		return self.root._query(start, end, self.operations[operation_name])

	def summary(self):
		return self.root.values

	def update(self, position, value):
		self.root._update(position, value)

	def update_range(self, start, end, value):
		self.root._update_range(start, end, value)

	def __repr__(self):
		return self.root.__repr__()

class SegmentTreeNode:

	def __init__(self, start, end, segment_tree):
		self.range = (start, end)
		self.parent_tree = segment_tree
		self.range_value = None
		self.values = {}
		self.left = None
		self.right = None
		if start == end:
			self._sync()
			return
		self.left = SegmentTreeNode(start, start + (end - start) // 2, segment_tree)
		self.right = SegmentTreeNode(start + (end - start) // 2 + 1, end, segment_tree)
		self._sync()

	def _query(self, start, end, operation):
		if end < self.range[0] or start > self.range[1]:
			return None
		if start <= self.range[0] and self.range[1] <= end:
			return self.values[operation.name]
		self._push()
		left_res = self.left._query(start, end, operation) if self.left else None
		right_res = self.right._query(start, end, operation) if self.right else None
		if left_res is None:
			return right_res
		if right_res is None:
			return left_res
		return operation.f([left_res, right_res])

	def _update(self, position, value):
		if position < self.range[0] or position > self.range[1]:
			return
		if position == self.range[0] and self.range[1] == position:
			self.parent_tree.array[position] = value
			self._sync()
			return
		self._push()
		self.left._update(position, value)
		self.right._update(position, value)
		self._sync()

	def _update_range(self, start, end, value):
		if end < self.range[0] or start > self.range[1]:
			return
		if start <= self.range[0] and self.range[1] <= end:
			self.range_value = value
			self._sync()
			return
		self._push()
		self.left._update_range(start, end, value)
		self.right._update_range(start, end, value)
		self._sync()

	def _sync(self):
		if self.range[0] == self.range[1]:
			for op in self.parent_tree.operations.values():
				current_value = self.parent_tree.array[self.range[0]]
				if self.range_value is not None:
					current_value = self.range_value
				self.values[op.name] = op.f([current_value])
		else:
			for op in self.parent_tree.operations.values():
				result = op.f([self.left.values[op.name], self.right.values[op.name]])
				if self.range_value is not None:
					bound_length = self.range[1] - self.range[0] + 1
					result = op.f_on_equal(self.range_value, bound_length)
				self.values[op.name] = result

	def _push(self):
		if self.range_value is None:
			return
		if self.left:
			self.left.range_value = self.range_value
			self.right.range_value = self.range_value
			self.left._sync()
			self.right._sync()
			self.range_value = None

	def __repr__(self):
		ans = '({}, {}): {}\n'.format(self.range[0], self.range[1], self.values)
		if self.left:
			ans += self.left.__repr__()
		if self.right:
			ans += self.right.__repr__()
		return ans

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer / denom

def primeFactors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def isprime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def test_print(*args):
	if testingMode:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

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

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

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result
TestCases = False
testingMode = False
optimiseForReccursion = False

def main():
	n = get_int()
	(x, y) = (0, 0)
	for i in range(2 * n):
		(xi, yi) = get_tuple()
		x += xi
		y += yi
	print(x // n, y // n)
if TestCases:
	for _ in range(get_int()):
		cProfile.run('main()') if testingMode else main()
else:
	(cProfile.run('main()') if testingMode else main()) if not optimiseForReccursion else threading.Thread(target=main).start()


n = int(input())
t = 2 * n
(r1, r2) = (0, 0)
while t:
	(x, y) = map(int, input().split())
	r1 += x
	r2 += y
	t -= 1
print(r1 // n, r2 // n)


n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
ab = [tuple(map(int, input().split())) for _ in range(n)]
allX = 0
allY = 0
allA = 0
allB = 0
for (x, y) in xy:
	allX += x
	allY += y
for (a, b) in ab:
	allA += a
	allB += b
print((allX + allA) // n, (allY + allB) // n)


n = int(input())
l = []
p = []
for i in range(n):
	(a, b) = map(int, input().split())
	l.append([a, b])
for i in range(n):
	(a, b) = map(int, input().split())
	p.append([a, b])
l.sort()
p.sort()
print(l[0][0] + p[-1][0], l[0][1] + p[-1][1])


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	ob = []
	cl = []
	n = int(stdin.readline())
	for _ in range(n):
		ob.append([int(x) for x in stdin.readline().split()])
	for _ in range(n):
		cl.append([int(x) for x in stdin.readline().split()])
	ob.sort(key=lambda x: x[0] * 10 ** 7 + x[1])
	cl.sort(key=lambda x: x[0] * 10 ** 7 + x[1], reverse=True)
	res = [ob[0][0] + cl[0][0], ob[0][1] + cl[0][1]]
	stdout.write(' '.join([str(x) for x in res]))
	return 0
main()


n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
ab = [list(map(int, input().split())) for i in range(n)]
sol = []
for i in range(n):
	x = {(xy[i][0] + ab[j][0], xy[i][1] + ab[j][1]) for j in range(n)}
	sol.append(x)
ss = sol[0]
for j in ss:
	ch = 0
	for i in sol:
		if j in i:
			ch += 1
		else:
			break
	if ch == n:
		print(*j)
		exit()


t = int(input())
l = []
o = 2 * t
while o > 0:
	(a, b) = input().strip().split()
	l.append([int(a), int(b)])
	o -= 1
l.sort()
s = str(l[0][0] + l[len(l) - 1][0]) + ' ' + str(l[0][1] + l[len(l) - 1][1])
print(s)


def main():
	n = int(input())
	ob = [(0, 0)] * n
	d = [(0, 0)] * n
	for i in range(n):
		ob[i] = tuple(map(int, input().split()))
	for i in range(n):
		d[i] = tuple(map(int, input().split()))
	ans = set()
	for i in range(n):
		new_ans = set()
		for j in range(n):
			new_ans.add((ob[j][0] + d[i][0], ob[j][1] + d[i][1]))
		if i:
			ans = new_ans & ans
		else:
			ans = new_ans
	print(list(ans)[0][0], list(ans)[0][1])
main()


n = int(input())
summ_x = 0
summ_y = 0
for i in range(2 * n):
	(a, b) = map(int, input().split())
	summ_x += a
	summ_y += b
print(summ_x // n, summ_y // n)


n = int(input())
x = []
y = []
a = []
b = []
for i in range(n):
	(xx, yy) = map(int, input().split())
	x.append(xx)
	y.append(yy)
for i in range(n):
	(xx, yy) = map(int, input().split())
	a.append(xx)
	b.append(yy)
print(int(sum(x + a) / n), int(sum(y + b) / n))


n = int(input())
obs = []
for i in range(n):
	obs.append(list(map(int, input().rstrip().split())))
plus = []
for i in range(n):
	plus.append(list(map(int, input().rstrip().split())))
obs.sort()
plus.sort()
xval = obs[0][0] + plus[-1][0]
obs.sort(key=lambda x: x[1])
plus.sort(key=lambda x: x[1])
yval = obs[0][1] + plus[-1][1]
print(xval, yval)


def read_row():
	return [int(i) for i in input().split()]

def add(p1, p2):
	return [p1[0] + p2[0], p1[1] + p2[1]]
n = int(input())
obelisks = [read_row() for _ in range(n)]
clues = [read_row() for _ in range(n)]
points = set([tuple(add(obelisks[0], offset)) for offset in clues])
for obelisk in obelisks[1:]:
	new_p = set([tuple(add(obelisk, offset)) for offset in clues])
	points = points & new_p
answer = list(points)[0]
print(answer[0], answer[1])


def mi():
	return map(int, input().split())
n = int(input())
c = [0] * n
for i in range(n):
	c[i] = list(mi())
d = [0] * n
for i in range(n):
	d[i] = list(mi())
possans = [0] * (n * n)
k = 0
for i in range(n):
	for j in range(n):
		t1 = (c[i][0] + d[j][0], c[i][1] + d[j][1])
		possans[k] = t1
		k += 1
from collections import Counter
c = Counter(possans)
c = sorted(c, key=c.get)
print(*c[-1])


from math import inf

def main():
	count = int(input())
	x = 0
	y = 0
	for a in range(count):
		arr = input().split()
		x += int(arr[0])
		y += int(arr[1])
		arr = input().split()
		x += int(arr[0])
		y += int(arr[1])
	x //= count
	y //= count
	print(x, y)
main()


n = int(input())
x = []
y = []
a = []
b = []
for i in range(n):
	(xi, yi) = map(int, input().split())
	x.append(xi)
	y.append(yi)
for i in range(n):
	(ai, bi) = map(int, input().split())
	a.append(ai)
	b.append(bi)
pos_t = set()
for i in range(n):
	pos_t.add((x[0] + a[i], y[0] + b[i]))
for i in range(1, n):
	pos_t_ = set()
	for j in range(n):
		pos_t_.add((x[i] + a[j], y[i] + b[j]))
	pos_t = pos_t.intersection(pos_t_)
t = pos_t.pop()
print(t[0], t[1])


n = int(input())
mx = 10000000
my = 10000000
Ma = -20000000
Mb = -20000000
xy = []
ab = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	if x < mx:
		mx = x
	if y < my:
		my = y
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a > Ma:
		Ma = a
	if b > Mb:
		Mb = b
print(mx + Ma, my + Mb)


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


n = int(input())
(sumX, sumY) = (0, 0)
for i in range(0, 2 * n):
	(a, b) = map(int, input().split())
	sumX += a
	sumY += b
print('%d %d' % (sumX / n, sumY / n))


n = int(input())
xy = []
ab = []
for i in range(n):
	xy.append(list(map(int, input().split())))
for i in range(n):
	ab.append(list(map(int, input().split())))
u = []
for i in range(n):
	(x, y) = xy[i]
	u.append(set())
	for j in range(n):
		(a, b) = ab[j]
		u[i].add(str(x + a) + ' ' + str(y + b))
for i in range(1, n):
	u[i].intersection_update(u[i - 1])
f = list(u[-1])
print(f[0])


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial
from collections import defaultdict, Counter, OrderedDict, deque
from itertools import combinations, groupby, zip_longest, permutations
from bisect import *
from functools import reduce
from operator import mul
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().strip('\n')
grid = lambda r: [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
N = I()
(A, B) = ([], [])
for _ in range(2 * N):
	(x, y) = tup()
	if _ < N:
		A.append((x, y))
	else:
		B.append((x, y))
d = defaultdict(int)
for i in range(N):
	for j in range(N):
		(x, y) = (A[i][0] + B[j][0], A[i][1] + B[j][1])
		d[x, y] += 1
for i in d:
	if d[i] == N:
		print(*i)
		break
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


n = int(input())
(x, y) = (0, 0)
for i in range(n * 2):
	(nx, ny) = map(int, input().strip().split(' '))
	x += nx
	y += ny
print(x // n, y // n)


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


n = int(input())
for i in range(n):
	if i == 0:
		(mx, my) = map(int, input().split())
	else:
		(x, y) = map(int, input().split())
		if mx > x:
			mx = x
		if my > y:
			my = y
for i in range(n):
	if i == 0:
		(ma, mb) = map(int, input().split())
	else:
		(a, b) = map(int, input().split())
		if ma < a:
			ma = a
		if mb < b:
			mb = b
print('{} {}'.format(mx + ma, my + mb))


n = int(input())
l1 = []
l2 = []
l3 = []
l4 = []
l5 = []
l6 = []
lt3 = []
lt6 = []
i = 0
for i in range(n):
	(a, b) = map(int, input().split())
	l1.append(a)
	l2.append(b)
for i in range(n):
	(a, b) = map(int, input().split())
	l4.append(a)
	l5.append(b)
i = 0
for j in l4:
	l3.append(l1[i] + j)
i = 0
for j in l5:
	l6.append(l2[i] + j)
f = 0
for i in l1:
	lt3 = []
	for j in l4:
		lt3.append(i + j)
	l3 = list(set(l3) & set(lt3))
f = 0
for i in l2:
	lt6 = []
	for j in l5:
		lt6.append(i + j)
	l6 = list(set(l6) & set(lt6))
print(l3[0], l6[0])


n = int(input())
a = [tuple(map(int, input().split())) for i in range(n)]
b = [tuple(map(int, input().split())) for i in range(n)]
x = min(a)
h = max(b)
print(x[0] + h[0], x[1] + h[1])


from collections import defaultdict
n = int(input())
a = [[int(i) for i in input().split()] for _ in range(n)]
b = [[int(i) for i in input().split()] for _ in range(n)]
x = {a[i][0]: 1 for i in range(n)}
y = {a[i][1]: 1 for i in range(n)}
count = defaultdict(lambda : 0)
for (g, h) in b:
	count[g, h] += 1
for i in range(n):
	sx = a[0][0] + b[i][0]
	sy = a[0][1] + b[i][1]
	cs = 1
	for j in range(1, n):
		req = (sx - a[j][0], sy - a[j][1])
		if req != tuple(b[i]) and count[req] or count[req] > 1:
			pass
		else:
			cs = 0
			break
	if cs == 1:
		print(sx, sy)
		break


n = int(input())
p = []
c = []
for i in range(n):
	p.append(tuple(map(int, input().split())))
for i in range(n):
	c.append(tuple(map(int, input().split())))
ts = [set() for i in range(n)]
for i in range(n):
	for j in range(n):
		ts[i].add((p[i][0] + c[j][0], p[i][1] + c[j][1]))
for i in range(n):
	(tx, ty) = ts[0].pop()
	ok = True
	for j in range(1, n):
		if (tx, ty) not in ts[j]:
			ok = False
			break
	if ok:
		print(tx, ty)
		exit()


n = int(input())
d1 = {}
d2 = {}
l1 = []
l2 = []
for i in range(n):
	(a, b) = map(int, input().split())
	l1.append((a, b))
	d1[a, b] = 1
for i in range(n):
	(a, b) = map(int, input().split())
	l2.append((a, b))
	d2[a, b] = 1
i = l1[0]
flag = 0
for j in l2:
	t = (i[0] + j[0], i[1] + j[1])
	for k in l1:
		if (t[0] - k[0], t[1] - k[1]) not in d2:
			flag = 1
			break
	if flag == 0:
		print(t[0], t[1])
		exit()
	else:
		flag = 0


n = int(input())
(c, d) = (list(), list())
for i in range(n):
	c.append(tuple(map(int, input().split())))
for i in range(n):
	d.append(tuple(map(int, input().split())))
c.sort(key=lambda x: (x[0], x[1]))
d.sort(key=lambda x: (x[0], x[1]), reverse=True)
print(c[0][0] + d[0][0], c[0][1] + d[0][1])


n = int(input())
(x1, y1, x2, y2) = ([], [], [], [])
for i in range(n):
	(x, y) = map(int, input().split())
	x1 += [x]
	y1 += [y]
for i in range(n):
	(x, y) = map(int, input().split())
	x2 += [x]
	y2 += [y]
print(min(x1) + max(x2), min(y1) + max(y2))


import math
n = input()
n = int(n)
xa = 0
ya = 0
x = 0
y = 0
for i in range(2 * n):
	(xa, ya) = input().split()
	x += int(xa)
	y += int(ya)
print(x // n, y // n)


n = int(input())
a = 0
b = 0
for i in range(2 * n):
	temp = input().split()
	a += int(temp[0])
	b += int(temp[1])
print(a // n, b // n)


n = int(input())
xlist = []
ylist = []
for i in range(n):
	(x, y) = map(int, input().split())
	xlist.append(x)
	ylist.append(y)
alist = []
blist = []
for i in range(n):
	(a, b) = map(int, input().split())
	alist.append(a)
	blist.append(b)
xsum = sum(xlist)
ysum = sum(ylist)
asum = sum(alist)
bsum = sum(blist)
s1 = (xsum + asum) // n
s2 = (ysum + bsum) // n
print(s1, s2)


from collections import Counter

def plus(a, b):
	return (a[0] + b[0], a[1] + b[1])

def minus(a, b):
	return (a[0] - b[0], a[1] - b[1])
n = int(input())
points = []
vectors = []
for i in range(n):
	points.append(tuple(map(int, input().split())))
for i in range(n):
	vectors.append(tuple(map(int, input().split())))
vector_cnt = Counter(vectors)
for i in range(n):
	cp = plus(points[0], vectors[i])
	cc = Counter()
	for j in range(n):
		np = minus(cp, points[j])
		cc[np] += 1
	if cc == vector_cnt:
		print(*cp)
		exit()


n = int(input())
x = []
a = []
cnt_x = 0
cnt_y = 0
for i in range(n * 2):
	(x, y) = map(int, input().split())
	cnt_x += x
	cnt_y += y
print(cnt_x // n, cnt_y // n)


n = int(input())
d = set([])
for i in range(n):
	(x, y) = map(int, input().split())
	d.add((x, y))
l = list(d)
h = []
t = 0
for i in range(n):
	(a, b) = map(int, input().split())
	h.append((a, b))
prev = set([])
for j in range(n):
	prev.add((l[0][0] + h[j][0], l[0][1] + h[j][1]))
for i in range(1, n):
	next = set([])
	for j in range(n):
		next.add((l[i][0] + h[j][0], l[i][1] + h[j][1]))
	prev = set.intersection(next, prev)
	if len(prev) == 1:
		t = 1
		print(*list(prev)[0])
		break
if t == 0:
	print(*list(prev)[0])


import sys
from os import path
if path.exists('input.txt') and path.exists('output.txt'):
	sys.stdout = open('output.txt', 'w')
	sys.stdin = open('input.txt', 'r')

def main():
	n = int(input())
	clues = [[int(i) for i in input().split()] for i in range(n)]
	dirs = [[int(i) for i in input().split()] for i in range(n)]
	sum_x = 0
	sum_y = 0
	sum_a = 0
	sum_b = 0
	for i in range(n):
		sum_x += clues[i][0]
		sum_y += clues[i][1]
		sum_a += dirs[i][0]
		sum_b += dirs[i][1]
	x = (sum_x + sum_a) // n
	y = (sum_y + sum_b) // n
	print(x, y)
main()


import sys
from itertools import product
from collections import Counter
N = int(input())
obelisks = [list(map(int, sys.stdin.readline().split())) for _ in [0] * N]
dists = [list(map(int, l.split())) for l in sys.stdin]
counter = Counter()
for ((x1, y1), (x2, y2)) in product(obelisks, dists):
	counter[x1 + x2, y1 + y2] += 1
print(*counter.most_common(1)[0][0])


n = int(input())
(a1, a2) = (float('inf'), float('inf'))
(b1, b2) = (-1 * float('inf'), -1 * float('inf'))
for _ in range(n):
	(a, b) = map(int, input().split())
	a1 = min(a1, a)
	a2 = min(a2, b)
for _ in range(n):
	(a, b) = map(int, input().split())
	b1 = max(b1, a)
	b2 = max(b2, b)
print(int(a1 + b1), int(a2 + b2))


n = int(input())
xy = []
ab = []
for i in range(n):
	xy.append(list(map(int, input().split())))
for i in range(n):
	ab.append(list(map(int, input().split())))
xy.sort()
ab.sort()
print(xy[0][0] + ab[-1][0], xy[0][1] + ab[-1][1])


n = int(input())
p = []
q = []
for _ in range(n):
	r = tuple(map(int, input().split(' ')))
	p.append(r)
for _ in range(n):
	r = tuple(map(int, input().split(' ')))
	q.append(r)
p = sorted(p)
q = sorted(q)
(x, y) = (p[0][0] + q[0][0], p[0][1] + q[0][1])
alt = False
for i in range(n):
	if p[i][0] + q[i][0] == x and p[i][1] + q[i][1] == y:
		continue
	else:
		alt = True
		break
if alt is True:
	(x, y) = (p[0][0] + q[n - 1][0], p[0][1] + q[n - 1][1])
print('{} {}'.format(x, y))


from collections import defaultdict
n = int(input())
ob = []
cl = []
temp = []
map1 = defaultdict(tuple)
map2 = defaultdict(tuple)
for _ in range(n):
	(x, y) = map(int, input().split())
	ob.append((x, y))
for _ in range(n):
	(x, y) = map(int, input().split())
	cl.append((x, y))
	map1[x, y] = 1
possible = []
(x, y) = (ob[0][0], ob[0][1])
for i in range(n):
	possible.append((cl[i][0] + x, cl[i][1] + y))
for i in range(len(possible)):
	(tar_x, tar_y) = (possible[i][0], possible[i][1])
	f = 1
	for j in range(n):
		s_x = tar_x - ob[j][0]
		s_y = tar_y - ob[j][1]
		if (s_x, s_y) not in map1:
			f = 0
	if f == 1:
		print(tar_x, tar_y)
		break


n = int(input())
mas1 = [float('-inf'), float('-inf')]
min1 = [float('inf'), float('inf')]
for t in range(n):
	(x1, y1) = map(int, input().split())
	mas1 = max(mas1, [x1, y1])
for t in range(n):
	(x1, y1) = map(int, input().split())
	min1 = min(min1, [x1, y1])
print(mas1[0] + min1[0], mas1[1] + min1[1])


from sys import stdin
n = int(stdin.readline().strip())
p = []
c = []
for i in range(n):
	p.append(list(map(int, stdin.readline().strip().split())))
for i in range(n):
	c.append(list(map(int, stdin.readline().strip().split())))
p.sort()
c.sort(reverse=True)
print(p[0][0] + c[0][0], p[0][1] + c[0][1])


n = int(input())
dic = {}
pontos = []
for i in range(n):
	(x, y) = list(map(int, input().split(' ')))
	pontos.append((x, y))
for i in range(n):
	(x, y) = list(map(int, input().split(' ')))
	for j in range(n):
		if (x + pontos[j][0], y + pontos[j][1]) in dic.keys():
			dic[x + pontos[j][0], y + pontos[j][1]] += 1
		else:
			dic[x + pontos[j][0], y + pontos[j][1]] = 1
a = sorted(dic.items(), key=lambda x: x[1], reverse=True)
print('{} {}'.format(a[0][0][0], a[0][0][1]))


n = int(input())
(a, b) = ([], [])
for i in range(n):
	r = tuple(map(int, input().split()))
	a.append(r)
for i in range(n):
	r = tuple(map(int, input().split()))
	b.append(r)
c = []
for i in range(n):
	k = set()
	for j in range(n):
		r = (a[i][0] + b[j][0], a[i][1] + b[j][1])
		k.add(r)
	c.append(k)
d = c[0]
k = d.intersection(*c)
k = list(k)
print(*k[0])


import sys
n = int(sys.stdin.readline().strip())
x = []
y = []
a = []
b = []
for i in range(0, n):
	line = sys.stdin.readline().strip().split()
	x.append(int(line[0]))
	y.append(int(line[1]))
for i in range(0, n):
	line = sys.stdin.readline().strip().split()
	a.append(int(line[0]))
	b.append(int(line[1]))
mx = min(x)
my = max(y)
for i in range(0, n):
	if x[i] == mx:
		my = min([my, y[i]])
ma = max(a)
mb = min(b)
for i in range(0, n):
	if a[i] == ma:
		mb = max([mb, b[i]])
print(str(mx + ma) + ' ' + str(my + mb))


n = int(input())
X = []
Y = []
for i in range(n):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
A = []
B = []
for i in range(n):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
print((sum(X) + sum(A)) // n, (sum(Y) + sum(B)) // n)


n = int(input())
cd = [[0] * 2 for x in range(n)]
cl = [[0] * 2 for x in range(n)]
for i in range(n):
	cd[i] = list(map(int, input().split()))
for i in range(n):
	cl[i] = list(map(int, input().split()))
dp = [[0, 0] * n for x in range(n)]
dt = dict()
flag = 0
if n == 1:
	print(cd[0][0] + cl[0][0], cd[0][1] + cl[0][1])
	exit()
for i in range(n):
	for j in range(n):
		dp[i][j] = [cd[i][0] + cl[j][0], cd[i][1] + cl[j][1]]
		tm = tuple(dp[i][j])
		if tm in dt:
			dt[tm] += 1
			if dt[tm] == n:
				print(tm[0], tm[1])
				flag = 1
				break
		else:
			dt[tm] = 1
	if flag == 1:
		break


n = int(input())
p = []
add = dict()
for i in range(n):
	(a, b) = map(int, input().split())
	p.append((a, b))
for i in range(n):
	(a, b) = map(int, input().split())
	add[a, b] = 0
for key in add.keys():
	T = [key[0] + p[0][0], key[1] + p[0][1]]
	ok = 1
	for i in range(1, n):
		if not (T[0] - p[i][0], T[1] - p[i][1]) in add.keys():
			ok = 0
	if ok == 1:
		print(*T)
		break


n = int(input())
ij = []
ab = []
for _ in range(n):
	ij.append(tuple(map(int, input().split())))
for _ in range(n):
	ab.append(tuple(map(int, input().split())))
ij.sort()
ab.sort(reverse=True)
print(ij[0][0] + ab[0][0], ij[0][1] + ab[0][1])


num = int(input())
(sumx, sumy) = (0, 0)
for i in range(2 * num):
	(x, y) = input().split()
	sumx += int(x)
	sumy += int(y)
print(sumx // num, sumy // num)


obilisks = int(input())
xtreasure = 0
ytreasure = 0
for i in range(obilisks + obilisks):
	(xpos, ypos) = [int(x) for x in input().split()]
	xtreasure += xpos
	ytreasure += ypos
print(xtreasure // obilisks, ytreasure // obilisks)


import sys
input = sys.stdin.readline
mii = lambda : list(map(int, input().split()))
n = int(input())
a = 0
b = 0
for _ in range(2 * n):
	(u, v) = mii()
	a += u
	b += v
print('%d %d' % (a // n, b // n))


d = {}
n = int(input())
a = []
n2 = n
n = 2 * n
for _ in range(n):
	(b, c) = map(int, input().split())
	a.append((b, c))
for i in range(1, n):
	xsum = a[0][0] + a[i][0]
	ysum = a[0][1] + a[i][1]
	d = {}
	for j in range(1, n):
		try:
			d[a[j]] += 1
		except:
			d[a[j]] = 1
	d[a[i]] -= 1
	flag = 0
	for j in range(1, n):
		if d[a[j]] > 0:
			d[a[j]] -= 1
			xtemp = xsum - a[j][0]
			ytemp = ysum - a[j][1]
			try:
				if d[xtemp, ytemp] > 0:
					d[xtemp, ytemp] -= 1
				else:
					flag = 1
					break
			except:
				flag = 1
				break
	if flag == 0:
		print(xsum, ysum)
		break


n = int(input())
sx = 0
sy = 0
for i in range(2 * n):
	(x, y) = map(int, input().split())
	sx += x
	sy += y
print(int(sx / n), int(sy / n))


a = int(input())
xx = 0
yy = 0
for i in range(a * 2):
	(x, y) = map(int, input().split())
	xx += x
	yy += y
print(xx // a, yy // a)


def read_input():
	n = int(input())
	obelisks = []
	for _ in range(n):
		obelisk = input()
		obelisk = [int(coor) for coor in obelisk.strip().split()]
		obelisks.append(obelisk)
	clues = []
	for _ in range(n):
		clue = input()
		clue = [int(dir_) for dir_ in clue.strip().split()]
		clues.append(clue)
	return (n, obelisks, clues)

def find_treasure(n, obelisks, clues):
	Tx = 0
	Ty = 0
	for i in range(n):
		Tx += obelisks[i][0] + clues[i][0]
		Ty += obelisks[i][1] + clues[i][1]
	return (Tx // n, Ty // n)
(n, obelisks, clues) = read_input()
(Tx, Ty) = find_treasure(n, obelisks, clues)
print(Tx, Ty)


import math
n = int(input())
sum1 = sum2 = 0
for i in range(2 * n):
	(a, b) = [int(x) for x in input().split()]
	sum1 += a
	sum2 += b
print(sum1 // n, sum2 // n)


n = int(input())
c = []
for _ in range(n):
	c.append(tuple(map(int, input().split())))
p = []
for _ in range(n):
	p.append(tuple(map(int, input().split())))
print(max(c, key=lambda t: t[0])[0] + min(p, key=lambda t: t[0])[0], max(c, key=lambda t: t[1])[1] + min(p, key=lambda t: t[1])[1])


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
c = []
l = []
for i in range(n):
	c.append(I())
s = set()
d = {}
m = 0
ans = 0
for i in range(n):
	l.append(I())
	for j in c:
		x = j[0]
		y = j[1]
		a = (l[i][0] + x, l[i][1] + y)
		if a in d:
			d[a] += 1
		else:
			d[a] = 1
		if d[a] > m:
			m = d[a]
			ans = a
print(ans[0], ans[1])


n = int(input().strip())
sum_x = 0
sum_y = 0
for _ in range(2 * n):
	xy = list(map(int, input().strip().split()))
	sum_x += xy[0]
	sum_y += xy[1]
print('{} {}'.format(int(sum_x / n), int(sum_y / n)))


n = int(input())
x = []
a = []
sx1 = 0
sx2 = 0
for i in range(n):
	(x1, y1) = map(int, input().split())
	x.append((x1, y1))
	sx1 += x1
	sx2 += y1
sa1 = 0
sa2 = 0
for i in range(n):
	(x1, y1) = map(int, input().split())
	a.append((x1, y1))
	sa1 += x1
	sa2 += y1
print((sx1 + sa1) // n, (sx2 + sa2) // n)


n = int(input())
a = [[0, 0] for i in range(n)]
for i in range(n):
	(x, y) = map(int, input().split())
	a[i][0] = x
	a[i][1] = y
b = [[0, 0] for i in range(n)]
for i in range(n):
	(x, y) = map(int, input().split())
	b[i][0] = x
	b[i][1] = y
ans = dict()
for i in range(n):
	for j in range(n):
		try:
			ans[a[i][0] + b[j][0], a[i][1] + b[j][1]] += 1
		except:
			ans[a[i][0] + b[j][0], a[i][1] + b[j][1]] = 1
for i in ans:
	if ans[i] == n:
		print(i[0], i[1])
		exit(0)


n = int(input())
corx = 0
cory = 0
for i in range(2 * n):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	corx = corx + x
	cory = cory + y
print(f'{corx // n} {cory // n}')


t = int(input())
(x, y) = (0, 0)
for _ in range(2 * t):
	(a, b) = map(int, input().split())
	x += a
	y += b
print(x // t, y // t)


(n, y, m, x) = (-10000000, -10000000, 10000000, 10000000)
d = int(input())
for _ in range(d):
	(a, b) = map(int, input().split())
	m = min(m, a)
	x = min(x, b)
for _ in range(d):
	(a, b) = map(int, input().split())
	n = max(n, a)
	y = max(y, b)
print(m + n, x + y)


n = int(input())
a = []
b = []
for i in range(n):
	a.append([int(i) for i in input().split()])
for i in range(n):
	b.append([int(i) for i in input().split()])
u = set()
for i in range(n):
	u.add((a[0][0] + b[i][0], a[0][1] + b[i][1]))
for j in range(n):
	c = set()
	for i in range(n):
		c.add((a[j][0] + b[i][0], a[j][1] + b[i][1]))
	u = c.intersection(u)
	if len(u) == 1:
		for i in u:
			print(*i)
		break
else:
	for i in u:
		print(*i)
		break


n = int(input())
tx = 0
ty = 0
for i in range(2 * n):
	(x, y) = [int(i) for i in input().split()]
	tx += x
	ty += y
print(int(tx / n), int(ty / n))


n = int(input())
x = []
y = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
a = []
b = []
for i in range(n):
	(c, d) = map(int, input().split())
	a.append(c)
	b.append(d)
f = True
z = 0
while f:
	(tx, ty) = (x[0] + a[z], y[0] + b[z])
	s = set([(tx - a[i], ty - b[i]) for i in range(n)])
	if s == set(((x[i], y[i]) for i in range(n))):
		print(tx, ty)
		break
	z += 1


n = int(input())
a = 0
b = 0
suma = 0
sumb = 0
for i in range(0, 2 * n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	suma += a
	sumb += b
print(suma // n, sumb // n)


n = int(input())
(a, b) = (0, 0)
for i in range(2 * n):
	(c, d) = [int(x) for x in input().split()]
	a += c
	b += d
print(a // n, b // n)


n = int(input())
tx = 0
ty = 0
for i in range(n):
	(x, y) = map(int, input().split())
	tx += x
	ty += y
cx = 0
cy = 0
for i in range(n):
	(x, y) = map(int, input().split())
	cx += x
	cy += y
print(' '.join([str((tx + cx) // n), str((ty + cy) // n)]))


n = int(input())
p = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	p.append((x, y))
c = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	c.append((x, y))
T = {}
for i in p:
	for j in c:
		(x, y) = (i[0] + j[0], i[1] + j[1])
		if (x, y) not in T:
			T[x, y] = 1
		else:
			T[x, y] += 1
ans = -1
tu = []
for i in T:
	if ans == -1:
		u = i
		ans = T[u]
	elif ans < T[i]:
		ans = T[i]
		u = i
print(u[0], u[1])


def main():
	n = int(input())
	(x, y) = (0, 0)
	for i in range(2 * n):
		(a, b) = map(int, input().split())
		x += a
		y += b
	print(x // n, y // n)
main()


from collections import defaultdict
n = int(input())
obelisks = []
clues = []
for i in range(n):
	obelisks.append(list(map(int, input().split())))
for i in range(n):
	clues.append(list(map(int, input().split())))
possible = defaultdict(int)
for (x, y) in obelisks:
	for (a, b) in clues:
		(tx, ty) = (x + a, y + b)
		possible[f'{tx},{ty}'] += 1
for (k, v) in possible.items():
	if v == n:
		print(*k.split(','))


N = int(input())
(x, y) = (0, 0)
for _ in range(2 * N):
	(tmp_x, tmp_y) = map(int, input().split())
	x += tmp_x
	y += tmp_y
print(x // N, y // N)


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(n)]
x = sum((v[0] for v in a)) + sum((v[0] for v in b))
y = sum((v[1] for v in a)) + sum((v[1] for v in b))
print(x // n, y // n)


a = input()
a = int(a)
obelisk = []
clues = []
for i in range(a):
	b = input()
	b = b.split()
	obelisk.append(b)
for i in range(a):
	b = input()
	b = b.split()
	clues.append(b)
x = 0
y = 0
for i in obelisk:
	x += int(i[0])
	y += int(i[1])
for i in clues:
	x += int(i[0])
	y += int(i[1])
print(int(x / a), int(y / a))


n = int(input())
nn = n
k = n
li = list()
li1 = list()
while nn > 0:
	(x, y) = map(int, input().split())
	li.append([x, y])
	nn -= 1
while n > 0:
	(a, b) = map(int, input().split())
	li1.append([a, b])
	n -= 1
di = dict()
for i in range(k):
	for j in range(k):
		s1 = li[i][0] + li1[j][0]
		s2 = li[i][1] + li1[j][1]
		if (s1, s2) not in di:
			di[s1, s2] = 1
		else:
			di[s1, s2] += 1
for i in di:
	if di[i] == k:
		print(i[0], i[1])
		break


import math
mx = math.inf
my = math.inf
n = int(input())
for i in range(n):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	mx = min(x, mx)
	my = min(y, my)
ax = -math.inf
ay = -math.inf
for i in range(n):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	ax = max(x, ax)
	ay = max(y, ay)
print(mx + ax, my + ay)


from collections import defaultdict as dc
n = int(input())
xy = []
a = []
k = dc(int)
for i in range(n):
	(x, y) = [int(i) for i in input().split()]
	xy.append((x, y))
for i in range(n):
	(x, y) = [int(i) for i in input().split()]
	a.append((x, y))
if n == 1:
	print(xy[i][0] + a[0][0], xy[i][1] + a[0][1])
else:
	for i in range(n):
		for j in range(n):
			q = (xy[i][0] + a[j][0], xy[i][1] + a[j][1])
			k[q] = k[q] + 1
			if k[q] == n:
				print(*q)
				exit()


n = int(input())
o = []
for _ in range(n):
	(x, y) = map(int, input().split())
	o.append((x, y))
o.sort()
p = []
for _ in range(n):
	(x, y) = map(int, input().split())
	p.append((x, y))
p.sort(reverse=True)
print(o[0][0] + p[0][0], o[0][1] + p[0][1])


def main():
	n = int(input())
	ob = []
	p = []
	for i in range(n):
		(a, b) = map(int, input().split())
		ob.append((a, b))
	for i in range(n):
		(a, b) = map(int, input().split())
		p.append((a, b))
	p.sort()
	ob.sort()
	print(p[0][0] + ob[-1][0], p[0][1] + ob[-1][1])
main()


def Bshorter():
	n = int(input())
	x = 0
	y = 0
	for i in range(2 * n):
		xy_in = input().split()
		x += int(xy_in[0])
		y += int(xy_in[1])
	print('{} {}'.format(x // n, y // n))
Bshorter()


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	coords = []
	hints = []
	for i in range(2 * n):
		if i < n:
			(x, y) = map(int, input().split())
			z = (x, y, i + 1)
			coords.append(z)
		else:
			(a, b) = map(int, input().split())
			z = (a, b, i - n + 1)
			hints.append(z)
	coords.sort(key=lambda x: (-x[0], -x[1]))
	hints.sort(key=lambda x: (x[0], x[1]))
	print(coords[0][0] + hints[0][0], coords[0][1] + hints[0][1])
main()


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')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def binary_search(lb, ub, val, cnt):
	mid = (lb + ub) // 2
	if val < mid:
		ub = mid - 1
		binary_search(lb, ub, val, cnt - 1)
	elif val > mid:
		lb = mid + 1
		binary_search(lb, ub, val, cnt - 1)
	else:
		print(cnt)

def abs(x):
	return x if x >= 0 else -x
for t in range(1):
	n = int(input())
	(sum1, sum2) = (0, 0)
	for i in range(2 * n):
		(x, y) = list(map(int, input().split()))
		sum1 += x
		sum2 += y
print(sum1 // n, sum2 // n)


def r(a, b):
	ans = a // b
	if a % b != 0:
		ans += 1
	return ans
n = int(input())
(x, y) = (0, 0)
for i in range(2 * n):
	(xx, yy) = map(int, input().split())
	x += xx
	y += yy
print(x // n, y // n)


n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	a.append((x, y))
for i in range(n):
	(x, y) = list(map(int, input().split()))
	b.append((x, y))
a.sort()
b.sort(reverse=True)
print(a[0][0] + b[0][0], a[0][1] + b[0][1])


n = int(input())
obs = []
clues = []
for i in range(n):
	(x, y) = [int(i) for i in input().split()]
	obs.append([x, y])
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	clues.append([a, b])
x = y = 0
for i in range(n):
	x += obs[i][0] + clues[i][0]
	y += obs[i][1] + clues[i][1]
print(x // n, y // n)


n = int(input())
x = []
y = []
a = []
b = []
for _ in range(n):
	(xi, yi) = [int(item) for item in input().split()]
	x.append(xi)
	y.append(yi)
for _ in range(n):
	(ai, bi) = [int(item) for item in input().split()]
	a.append(ai)
	b.append(bi)
Xl = [set() for _ in range(n)]
Yl = [set() for _ in range(n)]
Xc = [set() for _ in range(n)]
Yc = [set() for _ in range(n)]
for i in range(n):
	for j in range(n):
		Xl[i].add(a[i] + x[j])
		Xc[j].add(a[i] + x[j])
		Yl[i].add(b[i] + y[j])
		Yc[j].add(b[i] + y[j])
(Ty, Tx) = (-1, -1)
Xcands = []
for x in Xl[0]:
	for i in range(n):
		if not x in Xl[i]:
			break
	else:
		Xcands.append(x)
for x in Xcands:
	for i in range(n):
		if not x in Xc[i]:
			break
	else:
		Tx = x
		break
Ycands = []
for y in Yl[0]:
	for i in range(n):
		if not y in Yl[i]:
			break
	else:
		Ycands.append(y)
for y in Ycands:
	for i in range(n):
		if not y in Yc[i]:
			break
	else:
		Ty = y
		break
print(Tx, Ty)


n = int(input())
x = 0
y = 0
for b in range(n * 2):
	v = input()
	x += int(v[:list(v).index(' ')])
	y += int(v[list(v).index(' '):])
print(x // n, y // n)


nb_points = int(input())
sum_x = 0
sum_y = 0
for _ in range(2 * nb_points):
	(a, b) = [int(x) for x in input().split()]
	sum_x += a
	sum_y += b
print(sum_x // nb_points, sum_y // nb_points)


n = int(input())
obelisk = [list(map(int, input().split())) for _ in range(n)]
clues = [tuple(map(int, input().split())) for _ in range(n)]
d = set(clues)
first = obelisk[0]
for clue in clues:
	treasure = [0, 0]
	treasure[0] = first[0] + clue[0]
	treasure[1] = first[1] + clue[1]
	f = False
	for o in obelisk:
		t = (treasure[0] - o[0], treasure[1] - o[1])
		if t not in d:
			f = True
			break
	if not f:
		print(*treasure)


ob = []
clue = []
n = int(input())
sum_x = 0
sum_y = 0
for i in range(n):
	(x, y) = list(map(int, input().strip().split()))
	sum_x += x
	sum_y += y
for i in range(n):
	(x, y) = list(map(int, input().strip().split()))
	sum_x += x
	sum_y += y
print(sum_x // n, sum_y // n)


k = int(input())
(x, y) = (0, 0)
for i in range(2 * k):
	(a, b) = map(int, input().split())
	x += a
	y += b
print(x // k, y // k)


n = int(input())
(pts, hints) = ([], [])
for i in range(n):
	pts.append([int(x) for x in input().split()])
for i in range(n):
	hints.append([int(c) for c in input().split()])
if n == 1:
	print(hints[0][0] + pts[0][0], hints[0][1] + pts[0][1])
else:
	a = [set() for j in range(n)]
	c = 0
	for i in pts:
		for j in hints:
			a[c].add((i[0] + j[0], i[1] + j[1]))
		c += 1
	ans = a[0].intersection(a[1])
	for i in range(2, len(a)):
		ans = ans.intersection(a[i])
	ans = list(ans)
	print(ans[0][0], ans[0][1])


n = int(input())
a = b = 10 ** 7
x = y = -10 ** 7
for i in range(n):
	(u, v) = map(int, input().split())
	(a, b) = (min(a, u), min(b, v))
for i in range(n):
	(u, v) = map(int, input().split())
	(x, y) = (max(x, u), max(y, v))
print(a + x, b + y)


n = int(input())
ob = []
q = []
for i in range(n):
	ob.append(list(map(int, input().split())))
for i in range(n):
	q.append(list(map(int, input().split())))
ob.sort()
q.sort(reverse=True)
print(ob[0][0] + q[0][0], ob[0][1] + q[0][1])


import sys
input_name = 'b_input1.txt'
n = int(input())
pts = []
diff = []
for _ in range(n):
	(x, y) = list(map(int, input().split()))
	pts.append((x, y))
for _ in range(n):
	(x, y) = list(map(int, input().split()))
	diff.append((x, y))
pts = sorted(pts)
diff = sorted(diff, reverse=True)
print(f'{pts[0][0] + diff[0][0]} {pts[0][1] + diff[0][1]}')


n = int(input())
x = []
y = []
for i in range(n):
	(x1, y1) = [int(x) for x in input().split()]
	x.append(x1)
	y.append(y1)
for i in range(n):
	(x1, y1) = [int(x) for x in input().split()]
	x.append(x1)
	y.append(y1)
print(sum(x) // n, sum(y) // n)


n = int(input())
Overallx = []
Overally = []
for i in range(0, n):
	(x, y) = [int(x) for x in input().split()]
	Overallx.append(x)
	Overally.append(y)
for i in range(0, n):
	(x, y) = [int(x) for x in input().split()]
	Overallx.append(x)
	Overally.append(y)
Overallx.sort()
Overally.sort()
x = Overallx[0] + Overallx[-1]
y = Overally[0] + Overally[-1]
print(x, y)


S = set()
N = int(input())
(A, B) = min([tuple(map(int, input().split())) for i in range(N)])
(C, D) = max([tuple(map(int, input().split())) for i in range(N)])
print(A + C, B + D)


n = int(input())
R = lambda : ([*map(int, input().split())] for _ in [0] * n)
(o, c) = (min(R()), max(R()))
print(o[0] + c[0], o[1] + c[1])


R = lambda : map(int, input().split())
n = int(input())
(S1, S2) = (0, 0)
for i in range(2 * n):
	(a, b) = R()
	S1 += a
	S2 += b
print(S1 // n, S2 // n)


n = int(input())
obs = []
ops = []
locs = {}
for _ in range(n):
	obs.append(list(map(int, input().split())))
for _ in range(n):
	(x, y) = map(int, input().split())
	for o in obs:
		nloc = (o[0] + x, o[1] + y)
		if nloc not in locs:
			locs[nloc] = []
		locs[nloc].append(o)
for l in locs:
	if len(locs[l]) == n:
		print(l[0], l[1])
		break
else:
	print('what happened', locs)


n = int(input())
a1 = 100000000
b1 = 100000000
a2 = -100000000
b2 = -100000000
for i in range(0, n):
	(a, b) = [int(x) for x in input().split()]
	if a < a1:
		a1 = a
		b1 = b
	if a == a1:
		b1 = min(b, b1)
for i in range(0, n):
	(a, b) = [int(x) for x in input().split()]
	if a > a2:
		a2 = a
		b2 = b
	if a == a2:
		b2 = max(b, b2)
print('{} {}'.format(a1 + a2, b1 + b2))


first_coordinates = []
N = int(input())
for i in range(N):
	(x, y) = map(int, input().split())
	first_coordinates.append((x, y))
second_coordinates = []
for j in range(N):
	(x, y) = map(int, input().split())
	second_coordinates.append((x, y))
first_coordinates.sort(key=lambda x: x[1])
first_coordinates.sort(key=lambda x: x[0])
second_coordinates.sort(key=lambda x: x[1], reverse=True)
second_coordinates.sort(key=lambda x: x[0], reverse=True)
print(first_coordinates[0][0] + second_coordinates[0][0], first_coordinates[0][1] + second_coordinates[0][1])


n = int(input())
summ1 = 0
summ2 = 0
for i in range(2 * n):
	(k, m) = map(int, input().split())
	summ1 += k
	summ2 += m
print(summ1 // n, summ2 // n)


n = int(input())
x = [0] * n
y = [0] * n
(a, b) = ([0] * n, [0] * n)
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
d = []
for i in range(n):
	d.append({})
for i in range(n):
	for j in range(n):
		d[i][x[i] + a[j], y[i] + b[j]] = 1
f = 0
for i in d[0]:
	ff = 1
	for j in range(n):
		try:
			if d[j][i] == 1:
				continue
		except:
			ff = 0
			break
	if ff == 1:
		print(i[0], i[1])
		break


n = int(input())
a = []
b = []
for _ in range(n):
	a.append(list(map(int, input().split())))
for _ in range(n):
	b.append(list(map(int, input().split())))
d = {}
for i in range(n):
	for j in range(n):
		k = a[i][0] + b[j][0]
		l = a[i][1] + b[j][1]
		d[k, l] = d.get((k, l), 0) + 1
for i in d:
	if d[i] == n:
		print(*i)


__author__ = 'Sudip'
n = int(input())
a = [[0, 0] for i in range(n)]
b = [[0, 0] for i in range(n)]
for i in range(n):
	a[i] = list(map(int, input().split()))
for i in range(n):
	b[i] = list(map(int, input().split()))
a.sort()
b.sort(reverse=True)
print(a[0][0] + b[0][0], end=' ')
print(a[0][1] + b[0][1])


import bisect
n = int(input())
obelisks = []
clues = []
for i in range(n):
	obelisks.append(tuple(map(int, input().split())))
for i in range(n):
	clues.append(tuple(map(int, input().split())))
candidates = []
for obelisk in obelisks:
	candidates.append((obelisk[0] + clues[0][0], obelisk[1] + clues[0][1]))
obelisks = sorted(obelisks)

def test(candidate):
	for clue in clues:
		obelisk = (candidate[0] - clue[0], candidate[1] - clue[1])
		closest = bisect.bisect_left(obelisks, obelisk)
		if closest >= len(obelisks) or obelisks[closest] != obelisk:
			return False
	return True
for candidate in candidates:
	if test(candidate):
		print('{} {}'.format(*candidate))
		break


n = int(input())
cood = []
for i in range(n):
	cood += [list(map(int, input().split()))]
arr = []
for i in range(n):
	(x, y) = map(int, input().split())
	buf = []
	for j in range(n):
		buf += [(x + cood[j][0], y + cood[j][1])]
	arr += [buf]
res = set()
for i in range(n):
	res.add(arr[i][0])
for j in range(1, n):
	buf = set()
	for i in range(n):
		buf.add(arr[i][j])
	res.intersection_update(buf)
	if len(res) == 1:
		break
buf = res.pop()
print(buf[0], buf[1])


n = int(input())
tx = 0
ty = 0
for i in range(2 * n):
	(a, b) = list(map(int, input().split()))
	tx += a
	ty += b
print(tx // n, ty // n)


from sys import stdin, stdout
input = stdin.readline
n = int(input())
o = []
c = []
flag = False
possible = []
for _ in range(n):
	o.append(tuple(map(int, input().split())))
for _ in range(n):
	c.append(tuple(map(int, input().split())))
for i in range(n):
	a = []
	for j in range(n):
		a.append((o[i][0] + c[j][0], o[i][1] + c[j][1]))
	possible.append(a)
	if i >= 1:
		b = set.intersection(*map(set, [possible[-1], possible[-2]]))
		possible.append(b)
		if len(b) == 1:
			print(*list(b)[0])
			flag = True
			break
if not flag:
	print(*possible[-1][0])


n = int(input())
coorob = []
for i in range(n):
	coorob.append([int(x) for x in input().split()])
clueob = []
for i in range(n):
	clueob.append([int(x) for x in input().split()])
answerx = 0
answery = 0
for i in range(n):
	answerx += coorob[i][0] + clueob[i][0]
	answery += coorob[i][1] + clueob[i][1]
answerx = int(answerx / n)
answery = int(answery / n)
print(str(answerx) + ' ' + str(answery))


string = input()
N = int(string)
coords = []
hints = []
for i in range(0, N):
	string = input()
	coord = tuple(string.split(' '))
	coords.append((int(coord[0]), int(coord[1])))
for i in range(0, N):
	string = input()
	hint = tuple(string.split(' '))
	hints.append((int(hint[0]), int(hint[1])))
(x, y) = coords[0]
M = set(((x + a, y + b) for (a, b) in hints))
for (x, y) in coords[1:]:
	M1 = set(((x + a, y + b) for (a, b) in hints if (x + a, y + b) in M))
	M = M1
ans = M.pop()
print(ans[0], ans[1])


n = int(input())
c = 10000000
(x, y, a, b) = (c, c, -c, -c)
for q in range(n):
	(x1, y1) = map(int, input().split())
	if x1 < x:
		x = x1
	if y1 < y:
		y = y1
for q in range(n):
	(a1, b1) = map(int, input().split())
	if a1 > a:
		a = a1
	if b1 > b:
		b = b1
print(x + a, y + b)


n = int(input().strip())
(xm, ym) = (0, 0)
for i in range(2 * n):
	(x, y) = list(map(int, input().strip().split()))
	xm += x
	ym += y
print(xm // n, ym // n)


n = int(input().strip())
(x, y) = (0, 0)
for i in range(n):
	(xi, yi) = map(int, input().strip().split())
	x += xi
	y += yi
for i in range(n):
	(xi, yi) = map(int, input().strip().split())
	x += xi
	y += yi
print(x // n, y // n)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
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 main():
	n = int(input())
	(xy, ab) = ([], [])
	for i in range(2 * n):
		if i < n:
			(x, y) = map(int, input().split())
			xy.append((x, y))
		else:
			(a, b) = map(int, input().split())
			ab.append((a, b))
	d = collections.defaultdict(lambda : 0)
	for i in range(n):
		for j in range(n):
			(t, s) = (xy[i][0] + ab[j][0], xy[i][1] + ab[j][1])
			d[t, s] += 1
	ans = []
	for k in d.keys():
		if d[k] == n:
			ans.append(k[0])
			ans.append(k[1])
			break
	print(ans[0], ans[1])
main()


def main():
	n = int(input())
	points = []
	for i in range(n):
		points.append([int(x) for x in input().split(' ')])
	vectors = []
	for i in range(n):
		vectors.append([int(x) for x in input().split(' ')])
	points = sorted(points, key=lambda x: x[0])
	pnts = [points[0]]
	for i in range(1, n):
		if points[i][0] == points[i - 1][0]:
			pnts.append(points[i])
		else:
			break
	big_pnt_y = max(pnts, key=lambda x: x[1])
	vectors = sorted(vectors, key=lambda x: x[0], reverse=True)
	smallest_y = min(vectors[:len(pnts)], key=lambda x: x[1])
	print('%d %d' % (big_pnt_y[0] + smallest_y[0], big_pnt_y[1] + smallest_y[1]))
main()


def check_others(os, pairs, x, y):
	for o in os:
		found = False
		for (i, p) in enumerate(pairs):
			if p is not None:
				if o[0] + p[0] == x and o[1] + p[1] == y:
					pairs[i] = None
					found = True
					break
		if not found:
			return False
	return True

def go():
	n = int(input())
	x = 0
	y = 0
	for i in range(2 * n):
		(a, b) = [int(i) for i in input().split(' ')]
		x += a
		y += b
	return '{} {}'.format(x // n, y // n)
print(go())


def read_nums():
	return [int(x) for x in input().split()]

def main():
	(n,) = read_nums()
	res = (0, 0)
	for _ in range(2 * n):
		nums = read_nums()
		res = (res[0] + nums[0], res[1] + nums[1])
	print(res[0] // n, res[1] // n)
main()


num = int(input())
x = 0
y = 0
for i in range(num * 2):
	string = input()
	x += int(string.split(' ')[0])
	y += int(string.split(' ')[1])
x = x // num
y = y // num
print('{} {}'.format(x, y))


t = int(input())
x = 0
y = 0
result = ''
for i in range(2 * t):
	s = input()
	s = s.split(' ')
	for i in range(2):
		s[i] = int(s[i])
	x = x + s[0]
	y = y + s[1]
x = x // t
y = y // t
result = result + str(x) + ' ' + str(y)
print(result)


n = int(input())
oblique = []
sum_r_obliq = 0
sum_c_obliq = 0
sum_r_clue = 0
sum_c_clue = 0
for i in range(n):
	(a, b) = map(int, input().split())
	sum_r_obliq += a
	sum_c_obliq += b
clue = []
for i in range(n):
	(c, d) = map(int, input().split())
	sum_r_clue += c
	sum_c_clue += d
print((sum_r_obliq + sum_r_clue) // n, (sum_c_obliq + sum_c_clue) // n)


n = int(input())
x2 = 0
y2 = 0
for i in range(2 * n):
	(x1, y1) = map(int, input().split())
	x2 += x1
	y2 += y1
print(int(x2 / n), int(y2 / n))


n = int(input())
c = [tuple(map(int, input().split())) for x in range(0, 2 * n)]
T = (0, 0)
for u in c:
	(x, y) = T
	(a, b) = u
	T = (x + a, b + y)
(x, y) = T
T = (x // n, y // n)
print(*T)


n = int(input())
x = y = dx = dy = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	(x, y) = (x + a, y + b)
for _ in range(n):
	(a, b) = map(int, input().split())
	(dx, dy) = (dx + a, dy + b)
print((x + dx) // n, (y + dy) // n)


n = int(input())
xys = []
for _ in range(n):
	(x, y) = map(int, input().split())
	xys.append([x, y])
txys = []
for _ in range(n):
	(tx, ty) = map(int, input().split())
	txys.append([tx, ty])
xys = sorted(xys)
txys = sorted(txys)[::-1]
print(xys[0][0] + txys[0][0], xys[0][1] + txys[0][1])


n = int(input())
(a, b) = (0, 0)
for x in range(2 * n):
	(q, w) = map(int, input().split())
	a += q
	b += w
print(a // n, b // n)


import itertools
n = input()
n = int(n)
xs = []
ys = []
xsp = []
ysp = []
for i in range(n):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	xs.append(x)
	ys.append(y)
for i in range(n):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	xsp.append(x)
	ysp.append(y)
x = (sum(xs) + sum(xsp)) // n
y = (sum(ys) + sum(ysp)) // n
print(str(x) + ' ' + str(y))


import sys
import math
from collections import defaultdict
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
n = int(input())
coords = []
params = []
for i in range(n):
	c = [int(x) for x in input().split()]
	coords.append(c)
for i in range(n):
	p = [int(x) for x in input().split()]
	params.append(p)
init = [coords[0][0], coords[0][1]]
answers = defaultdict(lambda : 0)
for c in coords:
	(c1, c2) = (c[0], c[1])
	for p in params:
		(p1, p2) = (p[0], p[1])
		a = (c1 + p1, c2 + p2)
		answers[a] += 1
for a in answers:
	if answers[a] == n:
		p = a
print(p[0], p[1])


n = int(input())
xs = []
ys = []
for _ in range(n):
	xiyi = list(map(int, input().rstrip().split()))
	xi = xiyi[0]
	yi = xiyi[1]
	xs.append(xi)
	ys.append(yi)
As = []
Bs = []
for _ in range(n):
	aibi = list(map(int, input().rstrip().split()))
	ai = aibi[0]
	bi = aibi[1]
	As.append(ai)
	Bs.append(bi)
Tx = min(xs) + max(As)
Ty = min(ys) + max(Bs)
print(Tx, Ty)


n = int(input())
posXs = []
posYs = []
for _ in range(n):
	[posX, posY] = [int(p) for p in input().split(' ')]
	posXs.append(posX)
	posYs.append(posY)
dirXs = []
dirYs = []
for _ in range(n):
	[dirX, dirY] = [int(p) for p in input().split(' ')]
	dirXs.append(dirX)
	dirYs.append(dirY)
posXs.sort()
posYs.sort()
dirXs.sort()
dirYs.sort()
print(posXs[0] + dirXs[-1], posYs[0] + dirYs[-1])


n = int(input())
x = 0
y = 0
for i in range(n):
	(xx, yy) = map(int, input().split(' '))
	x += xx
	y += yy
for i in range(n):
	(xx, yy) = map(int, input().split(' '))
	x += xx
	y += yy
print(x // n, y // n)


n = int(input())
a = [{0, 0} for i in range(0, n)]
b = [{0, 0} for i in range(0, n)]
sax = say = sbx = sby = 0
for i in range(0, n):
	a[i] = tuple(map(int, input().split(' ')))
	(x, y) = a[i]
	sax += x
	say += y
for i in range(0, n):
	b[i] = tuple(map(int, input().split(' ')))
	(x, y) = b[i]
	sbx += x
	sby += y
sx = (sax + sbx) // n
sy = (say + sby) // n
print(sx, sy)


n = int(input())
arr1 = []
arr2 = []
arr1.append([])
arr1.append([])
arr2.append([])
arr2.append([])
for i in range(n):
	tmp = input().split()
	arr1[0].append(int(tmp[0]))
	arr1[1].append(int(tmp[1]))
for i in range(n):
	tmp = input().split()
	arr2[0].append(int(tmp[0]))
	arr2[1].append(int(tmp[1]))
ans = []
for i in range(n):
	ans.append([])
l1 = 0
l2 = 0
for i in range(n):
	l1 += arr1[0][i] + arr2[0][i]
	l2 += arr1[1][i] + arr2[1][i]
print(int(l1 / n), int(l2 / n))


import sys
for s in sys.stdin:
	totx = 0
	toty = 0
	for i in range(0, int(s) * 2):
		(x, y) = input().split(' ')
		x = int(x)
		y = int(y)
		totx += x
		toty += y
	totx = totx / int(s)
	toty = toty / int(s)
	print('%.0f %.0f' % (totx, toty))


n = int(input())
s = []
q = []
x = [0] * n
a = [0] * n
for i in range(n):
	s.append(input())
for i in range(n):
	q.append(input())
for i in range(n):
	x[i] = list(map(int, s[i].split()))
	a[i] = list(map(int, q[i].split()))
x = sorted(x)
a = sorted(a)
a = a[-1::-1]
print(x[0][0] + a[0][0], x[0][1] + a[0][1])


n = int(input())
obs = []
clues = []
for i in range(n):
	(x, y) = map(int, input().split())
	obs.append([x, y])
for i in range(n):
	(x, y) = map(int, input().split())
	clues.append([x, y])
obs = sorted(obs, key=lambda x: x[0] + x[1] + x[1])
clues = sorted(clues, key=lambda x: x[0] + x[1] + x[1], reverse=True)
print(obs[0][0] + clues[0][0], obs[0][1] + clues[0][1])