# 题目链接：

https://codeforces.com/contest/1091/problem/B

# 原题：

**Problem Statement**

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 (xi,yi). The j-th clue consists of 2 integers (aj,bj) and belongs to the obelisk pj, where p is some (unknown) permutation on n elements. It means that the treasure is located at T=(xpj+aj,ypj+bj). 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≤n≤1000) — the number of obelisks, that is also equal to the number of clues.

Each of the next n lines contains two integers xi, yi (−106≤xi,yi≤106) — the coordinates of the i-th obelisk. All coordinates are distinct, that is xi≠xj or yi≠yj will be satisfied for every (i,j) such that i≠j.

Each of the next n lines contains two integers ai, bi (−2⋅106≤ai,bi≤2⋅106) — the direction of the i-th clue. All coordinates are distinct, that is ai≠aj or bi≠bj will be satisfied for every (i,j) such that i≠j.

It is guaranteed that there exists a permutation p, such that for all i,j it holds (xpi+ai,ypi+bi)=(xpj+aj,ypj+bj).

**Output**

Output a single line containing two integers Tx,Ty — the coordinates of the treasure.

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

**Examples**

**input1**

```
2
2 5
-6 4
7 -2
-1 -3
```

**output1**

`1 2`

**input2**

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

**output2**

`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.

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

# 题意：

前n个数是点的坐标，后n个数是某一点相对于宝藏的位移

# 思路：

~~由样例~~不难看出，所有的2n个x坐标加起来除以n，所有的2n个y坐标加起来除以n，就是宝藏的位置了

# AC代码：

```
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
typedef long long ll;
#include<vector>
#define cin(n) scanf("%lld",&(n))
#define cout(n) printf("%lld",(n))
#define couc(c) printf("%c",(c))
#define coutn printf("\n")
#define cout_ printf(" ")
#define debug() printf("haha\n")
const int MAXN =1005;
ll t,n,k;
ll a,b;
ll ansa,ansb;
ll MIN=0x3f3f3f3f;
ll ans;
int MINNUM=1;
int main()
{
cin(n);
for(int i=1;i<=2*n;i++)
{
cin(a);
cin(b);
ansa+=a;
ansb+=b;
}
cout(ansa/n);
cout_;
cout(ansb/n);
coutn;
return 0;
}
```