
data class Coordinate(val x:Int, val y:Int){
    operator fun plus(other:Coordinate):Coordinate = Coordinate(x + other.x, y + other.y)
    operator fun minus(other:Coordinate):Coordinate = Coordinate(x - other.x, y - other.y)
}
sealed class FourSegmentArea{
    abstract fun find(coordinate:Coordinate):Boolean
    protected abstract fun set(coordinate: Coordinate, size:Int):FourSegmentArea
    protected object Empty:FourSegmentArea() {
        override fun set(coordinate: Coordinate, size:Int): FourSegmentArea = (Area(size) as FourSegmentArea).set(coordinate, size)
        override fun find(coordinate: Coordinate): Boolean = false
    }

    class Area(private val mSize:Int):FourSegmentArea(){
        override fun set(coordinate: Coordinate, size: Int): FourSegmentArea {
            if (size != 1){
                children[coordinate.x / mHalfSize][coordinate.y / mHalfSize] = children[coordinate.x / mHalfSize][coordinate.y / mHalfSize].set(Coordinate(coordinate.x % mHalfSize, coordinate.y % mHalfSize), mHalfSize)
            }
            return this
        }
        private val mHalfSize:Int
            get() = (mSize + 1) / 2
        private var children:Array<Array<FourSegmentArea>> = Array(2){Array(2){Empty as FourSegmentArea}}
        override fun find(coordinate: Coordinate): Boolean {
            return when{
                mSize == 1 -> true
                coordinate.x > mSize || coordinate.y > mSize || coordinate.x < 0 || coordinate.y < 0-> false
                else -> children[coordinate.x / mHalfSize][coordinate.y / mHalfSize].find(Coordinate(coordinate.x % mHalfSize, coordinate.y % mHalfSize))
            }
        }
        fun setAt(coordinate:Coordinate):Unit {
            set(coordinate, mSize)
        }

    }
}
fun main(args:Array<String>):Unit{
    var m = readLine()!!.toInt()
    while(m != 0){
        val area = FourSegmentArea.Area(1000001)
        val target = Array(m){
            val (x, y) = readLine()!!.split(' ').map(String::toInt)
            Coordinate(x, y)
        }
        val stars = Array(readLine()!!.toInt()){
            val (x, y) = readLine()!!.split(' ').map(String::toInt)
            Coordinate(x, y)
        }
        stars.forEach{area.setAt(it)}
        var start = Coordinate(0, 0)
        searching@for(star in stars){
            if (target.map{it + star - target[0]}.all{area.find(it)}){
                start = star - target[0]
                break@searching
            }
        }
        println("${start.x} ${start.y}")
        m = readLine()!!.toInt()
    }
}
