#include<bits/stdc++.h>
using namespace std;
struct node
{
int x,y;
};
vector<node>v;
int main()
{
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
int x,y;
cin>>x>>y;
v.push_back({x,y});
}
while(m--)
{
int tx,ty;
cin>>tx>>ty;
for(int i=0;i<v.size();i++)
tx+=v[i].x,ty+=v[i].y;
cout<<tx<<" "<<ty<<endl;
}
return 0;
}