#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{

    int m, n;
    int *mx;
    mx = malloc(1000000);
    int *my;
    my = malloc(1000000);
    int *nx;
    nx = malloc(1000000);
    int *ny;
    ny = malloc(1000000);

    int mxmax = 0;
    int mymax = 0;
    int mxmin = 1000000;
    int mymin = 1000000;
    int nxmax = 0;
    int nymax = 0;
    int nxmin = 1000000;
    int nymin = 1000000;
    int xans;
    int yans;

    while (1)
    {
        scanf("%d", &m);
        if (m == 0)
            break;
        for (int i = 0; i < m; i++)
        {
            scanf("%d %d", &mx[i], &my[i]);
            if (mx[i] > mxmax)
                mxmax = mx[i];
            if (mxmin > mx[i])
                mxmin = mx[i];
            if (my[i] > mymax)
                mymax = my[i];
            if (mymin > my[i])
                mymin = my[i];
        }
        scanf("%d", &n);
        for (int j = 0; j < n; j++)
        {
            scanf("%d %d", &nx[j], &ny[j]);
            if (nx[j] > nxmax)
                nxmax = nx[j];
            if (nxmin > nx[j])
                nxmin = nx[j];
            if (ny[j] > nymax)
                nymax = ny[j];
            if (nymin > ny[j])
                nymin = ny[j];
        }

        /*       for (int k = nxmin - mxmin; k < nxmax - mxmax;k++)
        {
            for (int l = nymin - mymin; l < nymax - nymax;l++)
            {
                if ()
            }
        }
*/
        xans = nxmax - mxmax;
        yans = nymax - mymax;
        printf("%d %d\n", xans, yans);
    }

    return 0;
}