#include<iostream>
#include<map>
#include<algorithm>
#include<mpi.h>

using namespace std;

typedef pair<int, int> P;

#define F first
#define S second

int main(int argc, char *argv[])
{
  int size, tag = 0;
  int m, n, x, y;
  int ans_x, ans_y;
  int rank, numprocs;
  P target[256], star[1024];
  P shift[1024];
  
  MPI_Request req;
  MPI_Status stat;

  MPI_Init(&argc, &argv);
  MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);

  while(1){
    if(rank == 0){
      cin >> m;
      if(m != 0){
	for(int i = 0;i < m; i++)
	  cin >> target[i].F >> target[i].S;
	cin >> n;
	for(int i = 0;i < n; i++)
	  cin >> star[i].F >> star[i].S;
      
	sort(target, target + m);
	sort(star, star + n);
      }
    }

    size = n / numprocs;
    if(rank == numprocs - 1)
      size = n / numprocs + n % numprocs;
    
    MPI_Bcast(&m, 1, MPI_INT, 0, MPI_COMM_WORLD);
    if(!m) break;
    MPI_Bcast(&n, 1, MPI_INT, 0, MPI_COMM_WORLD);
    MPI_Bcast(target, m, MPI::TWOINT, 0, MPI_COMM_WORLD);
    /*
    if(rank == 0){
      for(int i = 1;i < numprocs; i++)
	MPI_Isend(&star[i * size], i == numprocs - 1 ? size : size + n % numprocs, MPI::TWOINT, i, tag, MPI_COMM_WORLD, &req);
    } else {
      MPI_Irecv(&star[rank * size], size, MPI::TWOINT, 0, tag, MPI_COMM_WORLD, &req);
      MPI_Wait(&req, &stat);
    }
    */
    MPI_Bcast( star, n, MPI::TWOINT, 0, MPI_COMM_WORLD);
	
    bool flag;
    int start = rank * (n / numprocs);
    int end = (rank + 1) * (n / numprocs);
    if(rank == numprocs - 1)
      end = n;

    for(int i = start;i < end; i++){
      flag = true;
      x = star[i].F - target[0].F;
      y = star[i].S - target[0].S;

      for(int j = 0;j < m; j++){
	if(!binary_search(star, star + n, P(target[j].F + x, target[j].S + y))){
	  flag = false;
	  break;
	}	
      }
      if(flag) break;
    }
    
    if(!flag) x = y = 0;
    MPI_Reduce(&x, &ans_x, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
    MPI_Reduce(&y, &ans_y, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
    
    if(rank == 0)
      cout << ans_x << " " << ans_y << endl;
  }

  MPI_Finalize();

}