Kidnapping

Time limit1sMemory limit128 MB

Problem

Bob was kidnapped at an intersection in an unfamiliar city. The kidnappers put him in a car and drove toward their secret hideout. Because they knew Bob did not know the city, they did not blindfold him. Bob decided to remember the route.

The city is a grid of skyscrapers with R rows and S columns. There is a street between every two neighboring skyscrapers, and street intersections are numbered by row from top to bottom and by column from left to right, starting at 1.

Whenever the car drove along one street segment, Bob secretly wrote down the height of the skyscraper on the left side of the car and the height of the skyscraper on the right side. At each intersection, the driver could turn left, go straight, turn right, or make a U-turn. After reaching the hideout, Bob sent all recorded heights to the police.

Write a program that helps the police determine the coordinates of an intersection where the kidnappers' hideout could be.

Input

The first line contains two integers R and S, the number of rows and columns in the skyscraper grid. (3 <= R, S <= 100)

Each of the next R lines contains S integers, the heights of the skyscrapers in that row. Every height is at least 1 and at most 10,000.

The next line contains an integer N, the length of the route driven by the kidnappers. (1 <= N <= 10,000)

The next line contains N integers: the heights of the skyscrapers Bob saw on the left side of the car for each street segment.

The next line contains N integers: the heights of the skyscrapers Bob saw on the right side of the car for each street segment.

Output

Output the coordinates of an intersection where the hideout could be, in one line. Print the row first, then the column. If there are multiple valid answers, output any one of them.