import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Objects;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.Queue;
import java.util.LinkedList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream;
        try {
            inputStream = new FileInputStream("input.txt");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        OutputStream outputStream;
        try {
            outputStream = new FileOutputStream("output.txt");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        CFireAgain solver = new CFireAgain();
        solver.solve(1, in, out);
        out.close();
    }

    static class CFireAgain {
        private int n;
        private int m;
        private int K;
        private boolean[][] vis;
        private Queue<Util.Pair<Integer>> queue = new LinkedList<>();
        private Util.Pair<Integer> p;

        private boolean isValid(int x, int y) {
            return x >= 1 && x <= n && y >= 1 && y <= m && !vis[x][y];
        }

        private void bfs() {
            while (!queue.isEmpty()) {
                p = queue.poll();
                if (isValid(p.x + 1, p.y)) {
                    queue.offer(new Util.Pair<>(p.x + 1, p.y));
                    vis[p.x + 1][p.y] = true;
                }
                if (isValid(p.x - 1, p.y)) {
                    queue.offer(new Util.Pair<>(p.x - 1, p.y));
                    vis[p.x - 1][p.y] = true;
                }
                if (isValid(p.x, p.y + 1)) {
                    queue.offer(new Util.Pair<>(p.x, p.y + 1));
                    vis[p.x][p.y + 1] = true;
                }
                if (isValid(p.x, p.y - 1)) {
                    queue.offer(new Util.Pair<>(p.x, p.y - 1));
                    vis[p.x][p.y - 1] = true;
                }
            }
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            n = in.nextInt();
            m = in.nextInt();
            K = in.nextInt();
            vis = new boolean[n + 1][m + 1];
            for (int i = 0; i < K; i++) {
                int a = in.nextInt(), b = in.nextInt();
                vis[a][b] = true;
                queue.offer(new Util.Pair<>(a, b));
            }
            bfs();
            out.println(p.x + " " + p.y);
            out.flush();
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;
        private ArrayList<String> res = new ArrayList<>();
        private StringBuilder sb = new StringBuilder("");

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void println(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                sb.append(objects[i]);
            }
            res.add(sb.toString());
            sb = new StringBuilder("");
        }

        public void close() {
//        writer.flush();
            writer.close();
        }

        public void flush() {
            for (String str : res) writer.printf("%s\n", str);
            res.clear();
            sb = new StringBuilder("");
        }

    }

    static class Util {
        public static class Pair<T> {
            public T x;
            public T y;

            public Pair(T x, T y) {
                this.x = x;
                this.y = y;
            }

            public boolean equals(Object obj) {
                if (obj == this) return true;
                if (!(obj instanceof Util.Pair)) return false;
                Util.Pair<T> pair = (Util.Pair<T>) obj;
                return this.x == pair.x && this.y == pair.y;
            }

            public String toString() {
                return ("(" + this.x + "," + this.y + ")");
            }

            public int hashCode() {
                return Objects.hash(x, y);
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public InputReader(FileInputStream file) {
            this.stream = file;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res = (res << 3) + (res << 1) + c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}


import java.awt.Point;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;

public class Contest35_3 {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader("input.txt"));
        String[] s = in.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int m = Integer.parseInt(s[1]);
        int k = Integer.parseInt(in.readLine());
        s = in.readLine().split(" ");
        Point[] inp = new Point[k];
        int p = 0;
        for (int i = 0; i < k; i++) {
            inp[i] = new Point(Integer.parseInt(s[p++]),
                    Integer.parseInt(s[p++]));
        }
        int max = -1;
        int maxx = -1;
        int maxy = -1;
        int i;
        int j, dist;
        for (i = 1; i <= n; i++) {
            for (j = 1; j <= m; j++) {
                dist = 1000000;
                for (int l = 0; l < inp.length; l++) {
                    dist = Math.min(
                            Math.abs(inp[l].x - i) + Math.abs(inp[l].y - j),
                            dist);
                }
                if (dist > max) {
                    max = dist;
                    maxx = i;
                    maxy = j;
                }
            }
        }
        String res = maxx + " " + maxy + "\n";
        FileWriter out = new FileWriter(new File("output.txt"));
        out.append(res);
        out.flush();
        out.close();
    }
}


/**
 * Created by IntelliJ IDEA.
 * User: Taras_Brzezinsky
 * Date: 9/16/11
 * Time: 1:27 PM
 * To change this template use File | Settings | File Templates.
 */

import java.io.*;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.HashSet;
import java.util.Queue;
import java.util.StringTokenizer;

public class TaskC extends Thread {
    public TaskC() {
        try {
            this.input = new BufferedReader(new FileReader("input.txt"));
            this.output = new PrintWriter("output.txt");
            this.setPriority(Thread.MAX_PRIORITY);
        } catch (Throwable e) {
            System.exit(666);
        }
    }

    private void solve() throws Throwable {
        int n = nextInt();
        int m = nextInt();
        int k = nextInt();
        Queue<Integer> qX = new ArrayDeque<Integer>();
        Queue<Integer> qY = new ArrayDeque<Integer>();
        boolean [][]was = new boolean[n][m];
        for (int i = 0; i < k; ++i) {
            int x = nextInt() - 1, y = nextInt() - 1;
            qX.add(x);
            qY.add(y);
            was[x][y] = true;
        }
        int lastX = -1, lastY = -1;
        while (!qX.isEmpty()) {
            lastX = qX.poll();
            lastY = qY.poll();
            for (int i = 0; i < dx.length; ++i) {
                int nextX = lastX + dx[i], nextY = lastY + dy[i];
                if (nextX < n && nextY < m && nextX >= 0 && nextY >= 0 && !was[nextX][nextY]) {
                    qX.add(nextX);
                    qY.add(nextY);
                    was[nextX][nextY] = true;
                }
            }
        }
        ++lastX;
        ++lastY;
        output.println(lastX + " " + lastY);

    }

    public void run() {
        try {
            solve();
        } catch (Throwable e) {
            System.err.println(e.getMessage());
            e.printStackTrace();
            System.exit(666);
        } finally {
            output.flush();
            output.close();
        }
    }

    public static void main(String[] args) {
        new TaskC().start();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String nextToken() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine());
        }
        return tokens.nextToken();
    }
    static final int PRIME = 3119;
    static final int[]dx = {1, -1, 0, 0}, dy = {0, 0, -1, 1};
    private BufferedReader input;
    private PrintWriter output;
    private StringTokenizer tokens = null;
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class incendio {
    void dbg(Object...os) { System.err.println(Arrays.deepToString(os)); }
    static StringTokenizer _stk; static BufferedReader input; static PrintWriter output;
    static String next(){return _stk.nextToken();} static int nextInt(){return Integer.parseInt(next());}
    static String readln()throws IOException {String l=input.readLine();_stk=l==null?null:new StringTokenizer(l," ");return l;}
    public static void main(String[] args) throws IOException {
        input = new BufferedReader(new FileReader("input.txt"));
        output = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
        new incendio();
        output.close();
    }

    incendio() throws IOException {
        readln();
        M = nextInt(); N = nextInt();
        readln();
        final int K = nextInt();
        int xf[]=new int[K], yf[]=new int[K];
        readln();
        for(int i=0; i<K; i++) {
            xf[i]=nextInt();
            yf[i]=nextInt();
        }

        int best=-1, xbest=0, ybest=0;
        for(int i=1; i<=M; i++) {
            for(int j=1; j<=N; j++) {
                int dist=Integer.MAX_VALUE;
                for(int k=0; k<K; k++) {
                    dist = Math.min(dist, Math.abs(i-xf[k])+Math.abs(j-yf[k]));
                }
                if(dist>best) {
                    best=dist;
                    xbest=i;
                    ybest=j;
                }
            }
        }
        output.println(xbest+" "+ybest);
    }

    int M, N;
}


import java.io.*;
import java.util.*;

public class Main {
    InputStream is;
    PrintWriter out;
    String INPUT = "";

    long MAX = 100000L, MOD = 1000000007L, INF = (long) 1e18;

    boolean isValid(int x, int y, int n, int m){
        return x>=0 && y>=0 && x<n && y<m;
    }

    void solve(int TC) throws Exception {
        helper hp = new helper(MOD, (int)MAX);
        hp.initIO("input.txt", "output.txt");
        int n = hp.nextInt(), m = hp.nextInt();
        boolean[][] a = new boolean[n][m];
        int k = hp.nextInt();
        ArrayDeque<int[]> q = new ArrayDeque<>();
        for(int i=0;i<k;i++){
            int x = hp.nextInt() - 1;
            int y = hp.nextInt() - 1;
            a[x][y] = true;
            q.add(new int[]{x,y});
        }
        int lastX = 0,lastY = 0;
        int[] dx = new int[]{1,-1,0,0};
        int[] dy = new int[]{0,0,1,-1};
        while(!q.isEmpty()){
            int[] X = q.pollFirst();
            for(int i=0;i<4;i++){
                int x = X[0] + dx[i];
                int y = X[1] + dy[i];
                if(isValid(x,y,n,m) && !a[x][y]){
                    a[x][y] = true;
                    lastX = x;
                    lastY = y;
                    q.add(new int[]{x,y});
                }
            }
        }
        hp.println((lastX+1) + " " + (lastY+1)); hp.flush();
    }

    boolean TestCases = false;
    public static void main(String[] args) throws Exception { new Main().run(); }

    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}

    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        out = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        int T = TestCases ? ni() : 1;
        for(int t=1;t<=T;t++) solve(t);
        out.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

    void p(Object o) { out.print(o); }
    void pn(Object o) { out.println(o); }
    void pni(Object o) { out.println(o);out.flush(); }
    double PI = 3.141592653589793238462643383279502884197169399;

    int ni() {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-') {
            minus = true;
            b = readByte();
        }
        while(true) {
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-') {
            minus = true;
            b = readByte();
        }
        while(true) {
            if(b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    double nd() { return Double.parseDouble(ns()); }
    char nc() { return (char)skip(); }

    int BUF_SIZE = 1024 * 8;
    byte[] inbuf = new byte[BUF_SIZE];
    int lenbuf = 0, ptrbuf = 0;

    int readByte() {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        } return inbuf[ptrbuf++];
    }

    boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))) {
            sb.appendCodePoint(b); b = readByte();
        } return sb.toString();
    }

    char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        } return n == p ? buf : Arrays.copyOf(buf, p);
    }

    void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}

class helper {
    final long MOD;
    final int MAXN;
    final Random rnd;

    public helper(long mod, int maxn) {
        MOD = mod;
        MAXN = maxn;
        rnd = new Random();
    }

    static final int BUFSIZE = 1 << 20;
    static byte[] buf;
    static int index, total;
    static InputStream in;
    static BufferedWriter bw;

    public void initIO(InputStream is, OutputStream os) {
        try {
            in = is;
            bw = new BufferedWriter(new OutputStreamWriter(os));
            buf = new byte[BUFSIZE];
        } catch (Exception e) {
        }
    }

    public void initIO(String inputFile, String outputFile) {
        try {
            in = new FileInputStream(inputFile);
            bw = new BufferedWriter(new OutputStreamWriter(
                    new FileOutputStream(outputFile)));
            buf = new byte[BUFSIZE];
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private int scan() throws Exception {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0)
                return -1;
        }
        return buf[index++];
    }

    public String next() throws Exception {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan())
            sb.append((char) c);
        return sb.toString();
    }

    public int nextInt() throws Exception {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    public long nextLong() throws Exception {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    public long pow(long base, long exp, long MOD) {
        base %= MOD;
        long ret = 1;
        while (exp > 0) {
            if ((exp & 1) == 1) ret = ret * base % MOD;
            base = base * base % MOD;
            exp >>= 1;
        }
        return ret;
    }

    public void println(Object a) throws Exception {
        bw.write(a.toString()+"\n");
    }
    public void print(Object a) throws Exception {
        bw.write(a.toString());
    }
    public void flush() throws Exception {
        bw.flush();
    }

    public static int[] sieve;
    public static ArrayList<Integer> primes;

    public void setSieve() {
        primes = new ArrayList<>();
        sieve = new int[MAXN];
        int i, j;
        for (i = 2; i < MAXN; ++i)
            if (sieve[i] == 0) {
                primes.add(i);
                for (j = i; j < MAXN; j += i) {
                    sieve[j] = i;
                }
            }
    }
}


import java.io.*;
import java.util.*;

public class Solution implements Runnable {

	Scanner input;
	PrintWriter output;

	private void solve() throws Exception
	{
		int n = nextInt();
		int m = nextInt();
		int k = nextInt();
		int[] r = new int[k];
		int[] c = new int[k];
		for (int i = 0; i < k; i++)
		{
			r[i] = nextInt();
			c[i] = nextInt();
		}
		int best = -1;
		int bestr = -1;
		int bestc = -1;
		for (int i = 1; i <= n; i++)
		{
			for (int j = 1; j <= m; j++)
			{
				int d = n + m;
				for (int q = 0; q < k; q++)
				{
					d = Math.min(d, Math.abs(i - r[q]) + Math.abs(j - c[q]));
				}
				if (d < best) continue;
				best = d;
				bestr = i;
				bestc = j;
			}
		}
		out(bestr + " " + bestc);
	}

	private int nextInt() throws Exception
	{
		return input.nextInt();
	}

	private void out(String s)
	{
		output.println(s);
	}

	public void run() {
		try {
			solve();
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		} finally {
			output.close();
		}
	}

	public Solution() throws IOException {
		input = new Scanner(new FileReader("input.txt"));
		output = new PrintWriter("output.txt");
	}

	public static void main(String[] args) throws IOException {
		Locale.setDefault(Locale.US);
		new Thread(new Solution()).start();
	}
}


import java.awt.Point;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args)throws IOException, URISyntaxException {
        Reader.init(new FileInputStream("input.txt"));
        StringBuilder s=new StringBuilder();
        boolean[][]vis=new boolean[Reader.nextInt()][Reader.nextInt()];
        int k=Reader.nextInt(),r,c;
        Queue<Point>q=new LinkedList<Point>();
        while(k-->0) {
            r=Reader.nextInt()-1;
            c=Reader.nextInt()-1;
            vis[r][c]=true;
            q.add(new Point(r,c));
        }
        Point end=null;
        int[]x={0,0,1,-1},y={1,-1,0,0};
        int a,b,i;
        while(!q.isEmpty()) {
            end=q.poll();
            for(i=0;i<4;i++) {
                a=end.x+x[i];
                b=end.y+y[i];
                if(a>=0&&b>=0&&a<vis.length&&b<vis[a].length&&!vis[a][b]) {
                    vis[a][b]=true;
                    q.add(new Point(a,b));
                }
            }
        }
        s.append(end.x+1).append(' ').append(end.y+1);
        PrintWriter p=new PrintWriter("output.txt");
        p.println(s);
        p.close();
    }
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) throws UnsupportedEncodingException {
        reader = new BufferedReader(
                     new InputStreamReader(input, "UTF-8") );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static String nextLine() throws IOException {
        return reader.readLine();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }

    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
}


import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.LinkedList;
import java.util.Scanner;

public class C {
    static class Struct {
        int x, y, count;

        public Struct(int xx, int yy, int c) {
            x = xx;
            y = yy;
            count = c;
        }
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(new FileReader("input.txt"));
        int n = sc.nextInt();
        int m = sc.nextInt();
        FileWriter fw=new FileWriter("output.txt");
        boolean[][] grid = new boolean[n][m];
        int[] dx = new int[] { 1, 0, -1, 0 };
        int[] dy = new int[] { 0, -1, 0, 1 };
        int k = sc.nextInt();
        LinkedList<Struct> a = new LinkedList<Struct>();
        for (int i = 0; i < k; i++) {
            a.add(new Struct(sc.nextInt() - 1, sc.nextInt() - 1, 0));
        }
        int max = Integer.MIN_VALUE, maxX = -1, maxY = -1;
        while (!a.isEmpty()) {
            Struct tmp = a.remove();
            if (grid[tmp.x][tmp.y] == true)
                continue;
            grid[tmp.x][tmp.y] = true;
            if (tmp.count > max) {
                max = tmp.count;
                maxX = tmp.x;
                maxY = tmp.y;
            }
            for (int i = 0; i < 4; i++) {
                int nx = tmp.x + dx[i];
                int ny = tmp.y + dy[i];
                if (nx < n && nx >= 0 && ny < m && ny >= 0) {
                    if (grid[nx][ny] == false) {
                        a.add(new Struct(nx, ny, tmp.count + 1));
                    }
                }
            }
        }
        fw.write((maxX + 1) + " " + (maxY + 1)+"\n");
        System.out.println((maxX + 1) + " " + (maxY + 1));
        fw.flush();
    }
}


import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.ArrayDeque;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream;
        try {
            inputStream = new FileInputStream("input.txt");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        OutputStream outputStream;
        try {
            outputStream = new FileOutputStream("output.txt");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FireAgain solver = new FireAgain();
        solver.solve(1, in, out);
        out.close();
    }

    static class FireAgain {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int k = in.nextInt();
            int INF = 10000000;
            int[][] g = new int[n][m];
            for (int[] temp : g) Arrays.fill(temp, -1);
            ArrayDeque<IntPair> q = new ArrayDeque<>();
            for (int i = 0; i < k; i++) {
                int x = in.nextInt() - 1;
                int y = in.nextInt() - 1;
                g[x][y] = 0;
                q.add(new IntPair(x, y));
            }
            while (!q.isEmpty()) {
                IntPair cur = q.poll();
                int x = cur.getFirst();
                int y = cur.getSecond();
                for (int i = -1; i <= 1; i++) {
                    for (int j = -1; j <= 1; j++) {
                        if (i == 0 && j == 0 || Math.abs(i) + Math.abs(j) != 1) continue;
                        int xx = x + i;
                        int yy = y + j;
                        if (xx < 0 || xx >= n || yy < 0 || yy >= m) continue;
                        if (g[xx][yy] != -1) continue;
                        g[xx][yy] = g[x][y] + 1;
                        q.add(new IntPair(xx, yy));
                    }
                }
            }
            int ans = 0, x = -1, y = -1;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (g[i][j] >= ans) {
                        ans = g[i][j];
                        x = i + 1;
                        y = j + 1;
                    }
                }
            }
            out.println(x + " " + y);
        }

    }

    static class IntPair implements Comparable<IntPair> {
        int first;
        int second;

        public IntPair(int first, int second) {
            this.first = first;
            this.second = second;
        }

        public int compareTo(IntPair a) {
            if (second == a.second) {
                return Integer.compare(first, a.first);
            }
            return Integer.compare(second, a.second);
        }

        public String toString() {
            return "<" + first + ", " + second + ">";
        }

        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            IntPair a = (IntPair) o;

            if (first != a.first) return false;
            return second == a.second;
        }

        public int hashCode() {
            int result = first;
            result = 31 * result + second;
            return result;
        }

        public int getFirst() {
            return first;
        }

        public int getSecond() {
            return second;
        }

    }

    static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					try {
						if (new File("input.txt").exists())
							System.setIn(new FileInputStream("input.txt"));
					} catch (SecurityException e) {}
					new Main().run();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	int N;
	int M;
	boolean[][] used;
	Queue<Integer> queue;

	int[] dx = { -1, 0, 1, 0 };
	int[] dy = { 0, -1, 0, 1 };
	int ans = -1;

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter("output.txt");

		N = nextInt();
		M = nextInt();
		used = new boolean [N][M];
		queue = new ArrayDeque<Integer> (N * M);
		for (int K = nextInt(); K --> 0; )
			addState(nextInt() - 1, nextInt() - 1);
		while (!queue.isEmpty()) {
			int cv = queue.poll();
			int cx = cv / M;
			int cy = cv % M;
			for (int d = 0; d < dx.length; d++) {
				int nx = cx + dx[d];
				int ny = cy + dy[d];
				if (0 <= nx && nx < N && 0 <= ny && ny < M && !used[nx][ny])
					addState(nx, ny);
			}
		}
		out.println((1 + ans / M) + " " + (1 + ans % M));
		out.close();
	}

	void addState(int x, int y) {
		used[x][y] = true;
		queue.add(ans = code(x, y));
	}

	int code(int x, int y) {
		return x * M + y;
	}

	String nextToken() throws IOException {
		while (!st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}

		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();

			if (s == null) {
				return true;
			}

			st = new StringTokenizer(s);
		}

		return false;
	}
}


// package Practice1.CF35;

import java.io.*;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class CF035C {
    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(new File("input.txt")/*System.in*/);
        int n = s.nextInt();
        int m = s.nextInt();
        int k = s.nextInt();
//        pair[] arr = new pair[n];
        Queue<pair> q = new LinkedList<>();
        PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
        boolean[][] visited = new boolean[n][m];
        for (int i = 0; i < k; i++) {
            int x = s.nextInt() - 1;
            int y  = s.nextInt() - 1;
            visited[x][y] = true;
            pair p = new pair(x,y);
//            arr[i] = p;
            q.add(p);
        }

        q.add(null);
        int[] dx = {0,0,1,-1};
        int[] dy = {1,-1,0,0};
        int ansX = q.peek().x;
        int ansY = q.peek().y;
        while(true){
            if(q.peek() == null){
                q.poll();
                q.add(null);
            }
            pair p = q.poll();
            if(p == null){
                break;
            }
            for (int i = 0; i < 4; i++) {
                if(isValid(p.x + dx[i],p.y+dy[i],n,m) && !visited[p.x + dx[i]][p.y+dy[i]]){
                    q.add(new pair(p.x + dx[i],p.y+dy[i]));
                    ansX = p.x + dx[i];
                    ansY = p.y + dy[i];
                    visited[ansX][ansY] = true;
                }
            }
        }
        out.println((ansX+1) + " " + (ansY+1));
        out.close();

    }

    public static boolean isValid(int x, int y,int n, int m){
        return x >= 0 && x < n && y >= 0 && y < m;
    }

    private static class pair{
        int x;
        int y;

        public pair(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}


import java.util.*;
import java.io.*;

public class SolutionC{
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(new File("input.txt"));
		PrintWriter output = new PrintWriter("output.txt");
		int N = sc.nextInt();
		int M = sc.nextInt();
		int K = sc.nextInt();
		int[] x = new int[K];
		int[] y = new int[K];
		for(int i = 0 ; i < K ; i++){
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		int max = -1, max_x = -1, max_y = -1;
		for(int i = 1 ; i <= N ; i++){
			for(int j = 1 ; j <= M ; j++){
				int min = Integer.MAX_VALUE;
				for(int k = 0 ; k < K ; k++){
					min = Math.min(min, Math.abs(x[k] - i) + Math.abs(y[k] - j));
				}
				if(min > max){
					max = min;
					max_x = i;
					max_y = j;
				}
			}
		}
		output.println(max_x + " " + max_y);
		output.flush();
	}
}


import java.io.*;
import java.util.*;
public class j
{
public static void main(String a[])throws IOException
{
BufferedReader b = new BufferedReader(new FileReader("input.txt"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
int l=0,x2=0,x=0,y1=0,y=0,max=-1,min=100000,x1=0,n=0,j=0,k=0,p=0,m=0,i=0;
String s;
s=b.readLine();
StringTokenizer c=new StringTokenizer(s);
n=Integer.parseInt(c.nextToken());
m=Integer.parseInt(c.nextToken());
k=Integer.parseInt(b.readLine());
int e[][]=new int[k][2];
s=b.readLine();
StringTokenizer z=new StringTokenizer(s);
for(i=0;i<k;i++)
{
e[i][0]=Integer.parseInt(z.nextToken());
e[i][1]=Integer.parseInt(z.nextToken());
}
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
for(l=0;l<k;l++)
{
p=(int)Math.abs(e[l][0]-i)+(int)Math.abs(e[l][1]-j);
if(p<min)
{
min=p;
x1=i;
y1=j;
}
}
if(min>max)
{
max=min;
x=x1;
y=y1;
}
min=100000;
}
}
out.print(x+" "+y);
out.close();
}
}


import java.awt.Point;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.PrintWriter;
import java.util.Scanner;

public class C {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(new FileReader(new File("input.txt")));
        PrintWriter out = new PrintWriter(new File("output.txt"));
        int n = in.nextInt();
        int m = in.nextInt();
        int[][] T = new int[n][m];
        int k = in.nextInt();
        int[] X = new int[k];
        int[] Y = new int[k];
        for (int i = 0; i < k; i++) {
            X[i] = in.nextInt() - 1;
            Y[i] = in.nextInt() - 1;
        }
        int max = 0;
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++) {
                int min = Integer.MAX_VALUE;
                for (int ii = 0; ii < k; ii++)
                    min = Math.min(min,
                            Math.abs(i - X[ii]) + Math.abs(j - Y[ii]));
                max = Math.max(max, T[i][j] = min);
            }
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                if (T[i][j] == max) {
                    out.println((i + 1) + " " + (j + 1));
                    out.flush();
                    return;
                }

    }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;

public class ProblemC {

	static int[] dx = {1, 0, 0, -1};
	static int[] dy = {0, 1, -1, 0};

	public static void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new FileReader("input.txt"));
		PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
//		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
//		PrintWriter out = new PrintWriter(System.out);

		String[] nm = s.readLine().split(" ");
		int n = Integer.valueOf(nm[0]);
		int m = Integer.valueOf(nm[1]);
		int k = Integer.valueOf(s.readLine());

		int[][] dp = new int[n][m];
		for (int i = 0 ; i < n ; i++) {
			Arrays.fill(dp[i], Integer.MAX_VALUE);
		}
		String[] st = s.readLine().split(" ");
		int[][] trees = new int[k][2];
		for (int l = 0 ; l < k ; l++) {
			trees[l][0] = Integer.valueOf(st[l*2])-1;
			trees[l][1] = Integer.valueOf(st[l*2+1])-1;
		}

		int maxtime = -1;
		int max_x = -1;
		int max_y = -1;
		for (int i = 0 ; i < n ; i++) {
			for (int j = 0 ; j < m ; j++) {
				int minDist = n+m;
				for (int l = 0 ; l < k ; l++) {
					minDist = Math.min(minDist, Math.abs(i - trees[l][0]) + Math.abs(j - trees[l][1]));
				}
				if (maxtime < minDist) {
					maxtime = minDist;
					max_x = i+1;
					max_y = j+1;
				}
			}
		}

		out.println(max_x + " " + max_y);
		out.flush();
	}

	public static void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
}


import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Problem implements Runnable {

    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer tok = new StringTokenizer("");

    private void init() throws FileNotFoundException {
        Locale.setDefault(Locale.US);
        String fileName = "";
     /*   if (ONLINE_JUDGE && fileName.isEmpty()) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            if (fileName.isEmpty()) {*/
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
          /*  } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new PrintWriter(fileName + ".out");
           /* }
        }*/
    }

    String readString() {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    long readLong() {
        return Long.parseLong(readString());
    }

    double readDouble() {
        return Double.parseDouble(readString());
    }

    int[] readIntArray(int size) {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = readInt();
        }
        return a;
    }

    public static void main(String[] args) {
        //new Thread(null, new _Solution(), "", 128 * (1L << 20)).start();
        new Problem().run();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    @Override
    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            init();
            solve();
            out.close();
            time();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    int[][] dist;
    int n, m;
    P v;
    ArrayDeque<P> q = new ArrayDeque<>();

    private void solve() throws IOException {
        n = readInt();
        m = readInt();
        int k = readInt();
        dist = new int[n][m];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                dist[i][j] = -1;
        for (int i = 0; i < k; i++) {
            int x = readInt() - 1, y = readInt() - 1;
            dist[x][y] = 0;
            q.add(new P(x, y));
        }
        bfs();
        out.println(v.x + 1 + " " + (v.y + 1));
    }

    public void bfs() {
        int[] dx = {0, 1, 0, -1};
        int[] dy = {1, 0, -1, 0};
        while (!q.isEmpty()) {
            v = q.poll();
            for (int i = 0; i < 4; i++) {
                int nx = v.x + dx[i];
                int ny = v.y + dy[i];
                if (inside(nx, ny) && dist[nx][ny] == -1) {
                    q.add(new P(nx, ny));
                    dist[nx][ny] = dist[v.x][v.y] + 1;
                }
            }
        }
    }

    public boolean inside(int x, int y) {
        if (x < n && y < m && x >= 0 && y >= 0) {
            return true;
        }
        return false;
    }
}

class P {
    int x, y;

    public P(int x, int y) {
        this.x = x;
        this.y = y;
    }
}


import javax.annotation.processing.SupportedSourceVersion;
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;

public class Main {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(new FileReader("input.txt")); // new InputReader(inputStream);
        PrintWriter out = new PrintWriter("output.txt"); //new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(in, out);
        out.close();
    }

    private static class TaskB {

        static final long max = 1000000000000000000L;
        static final double eps = 0.0000001;
        static final long mod = 1000000007;
        static int N, M, K;
        static long X, Y;
        static boolean F[][][];
        static int D[][];

        void solve(InputReader in, PrintWriter out) throws IOException {

            N = in.nextInt();
            M = in.nextInt();
            K = in.nextInt();

            F = new boolean[K][N][M];
            D = new int[N][M];

            for (int i = 0; i < N; i++)
                for (int j = 0; j < M; j++)
                    D[i][j] = Integer.MAX_VALUE;

            List<Pair> list = new ArrayList<>();

            for (int i = 0; i < K; i++) {
                list.add(new Pair(in.nextInt() - 1, in.nextInt() - 1));
            }

            for (int i = 0; i < N; i++)
                for (int j = 0; j < M; j++)
                    for (int k = 0; k < K; k++)
                        D[i][j] = Math.min(D[i][j], Math.abs(list.get(k).X - i) + Math.abs(list.get(k).Y - j));

            int res = Integer.MIN_VALUE;
            for (int j = 0; j < N; j++)
                for (int k = 0; k < M; k++)
                    if (D[j][k] > res) {
                        X = j + 1;
                        Y = k + 1;
                        res = D[j][k];
                    }

            out.println(X + " " + Y);

        }

        void bfs(int K, Pair P) {

            Queue<Pair> Q = new LinkedList<>();
            F[K][P.X][P.Y] = true;
            D[P.X][P.Y] = 0;
            Q.add(P);

            while (!Q.isEmpty()) {

                P = Q.poll();
                int X = P.X;
                int Y = P.Y;

                if (check(X - 1, Y) && !F[K][X - 1][Y]) {
                    F[K][X - 1][Y] = true;
                    if (D[X - 1][Y] > D[X][Y] + 1) {
                        D[X - 1][Y] = D[X][Y] + 1;
                        Q.add(new Pair(X - 1, Y));
                    }
                }

                if (check(X + 1, Y) && !F[K][X + 1][Y]) {
                    F[K][X + 1][Y] = true;
                    if (D[X + 1][Y] > D[X][Y] + 1) {
                        D[X + 1][Y] = D[X][Y] + 1;
                        Q.add(new Pair(X + 1, Y));
                    }
                }

                if (check(X, Y - 1) && !F[K][X][Y - 1]) {
                    F[K][X][Y - 1] = true;
                    if (D[X][Y - 1] > D[X][Y] + 1) {
                        D[X][Y - 1] = D[X][Y] + 1;
                        Q.add(new Pair(X, Y - 1));
                    }
                }

                if (check(X, Y + 1) && !F[K][X][Y + 1]) {
                    F[K][X][Y + 1] = true;
                    if (D[X][Y + 1] > D[X][Y] + 1) {
                        D[X][Y + 1] = D[X][Y] + 1;
                        Q.add(new Pair(X, Y + 1));
                    }
                }

            }

        }

        boolean check(int X, int Y) {
            return !(X < 0 || X >= N || Y < 0 || Y >= M);
        }

        class Pair {
            int X, Y;

            Pair(int X, int Y) {
                this.X = X;
                this.Y = Y;
            }
        }

        long gcd(long A, long B) {
            if (B == 0) return A;
            return gcd(B, A % B);
        }

        boolean isPrime(long n) {
            if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
                return false;
            for (long i = 5, j = 2; i * i <= n; i += j, j = 6 - j)
                if (n % i == 0)
                    return false;
            return true;
        }

        boolean isEqual(double A, double B) {
            return Math.abs(A - B) < eps;
        }

        double dist(double X1, double Y1, double X2, double Y2) {
            return Math.sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2));
        }

        boolean nextPer(int[] data) {
            int i = data.length - 1;
            while (i > 0 && data[i] < data[i - 1]) {
                i--;
            }
            if (i == 0) {
                return false;
            }
            int j = data.length - 1;
            while (data[j] < data[i - 1]) {
                j--;
            }
            int temp = data[i - 1];
            data[i - 1] = data[j];
            data[j] = temp;
            Arrays.sort(data, i, data.length);
            return true;
        }

        long pow(long A, long B, long MOD) {
            if (B == 0) {
                return 1;
            }
            if (B == 1) {
                return A;
            }
            long val = pow(A, B / 2, MOD);
            if (B % 2 == 0) {
                return val * val % MOD;
            } else {
                return val * (val * A % MOD) % MOD;
            }
        }
    }

    private static class InputReader {
        StringTokenizer st;
        BufferedReader br;

        public InputReader(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public InputReader(FileReader s) throws FileNotFoundException {
            br = new BufferedReader(s);
        }

        public String next() {
            while (st == null || !st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public boolean ready() {
            try {
                return br.ready();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}


import java.util.*;
import java.io.*;

public class Main {
	public static void main(String [] args) throws IOException{
		Scanner in = new Scanner(new FileInputStream("input.txt"));
		//Scanner in = new Scanner(System.in);
		File file = new File("output.txt");
		FileOutputStream fos = new FileOutputStream(file);
		if (!file.exists()) {
		     file.createNewFile();
		}

		int N = in.nextInt();
		int M = in.nextInt();
		int K = in.nextInt();
		int [][] fireTime = new int[N][M];
		for (int i=0; i<K; i++){
			int x = in.nextInt()-1;
			int y = in.nextInt()-1;
			fireTime[x][y] = -1;

			for (int j=1; j<=x+y; j++){
				for (int p=0; p<=j; p++){
					if (x-j+p >= 0 && y-p >=0 && (fireTime[x-j+p][y-p] == 0 || fireTime[x-j+p][y-p] > j)){
						fireTime[x-j+p][y-p] = j;
					}
				}
			}

			for (int j=1; j<=x+M-1-y; j++){
				for (int p=0; p<=j; p++){
					if (x-j+p >= 0 && y+p < M && (fireTime[x-j+p][y+p] == 0 || fireTime[x-j+p][y+p] > j)){
						fireTime[x-j+p][y+p] = j;
					}
				}
			}

			for (int j=1; j<=N-1-x+y; j++){
				for (int p=0; p<j; p++){
					if (x+j-p < N && y-p >= 0 && (fireTime[x+j-p][y-p] == 0 || fireTime[x+j-p][y-p] > j)){
						fireTime[x+j-p][y-p] = j;
					}
				}
			}

			for (int j=1; j<=N-1-x+M-1-y; j++){
				for (int p=0; p<=j; p++){
					//System.out.println(j+" "+p);
					if (x+j-p < N && y+p < M && (fireTime[x+j-p][y+p] == 0 || fireTime[x+j-p][y+p] > j)){
						//System.out.println(j);
						fireTime[x+j-p][y+p] = j;
					}
				}
			}
		}

		int max = -1;
		int tx = 1;
		int ty = 1;
		for (int i=0; i<N; i++){
			for (int j=0; j<M; j++){
				//System.out.print(fireTime[i][j]+" ");
				if (fireTime[i][j] > max){
					max = fireTime[i][j];
					tx = i+1;
					ty = j+1;
				}
			}
			//System.out.println();
		}
		//System.out.println(tx+" "+ty);
		String output = tx+" "+ty;

		byte[] bA = output.getBytes();
		fos.write(bA);
		fos.flush();
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.Collection;
import java.io.FileWriter;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.Objects;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Queue;
import java.util.LinkedList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Nafiur Rahman Khadem Shafin 🙂
 */
public class Main {
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader (inputStream);
		PrintWriter out = new PrintWriter (outputStream);
		ProblemCFireAgain solver = new ProblemCFireAgain ();
		solver.solve (1, in, out);
		out.close ();
	}

	static class ProblemCFireAgain {
		private static final byte[] dx = {-1, 0, 0, 1};
		private static final byte[] dy = {0, -1, 1, 0};
		private static int[][] lvl;
		private static int max;
		private static int n;
		private static int m;
		private static int k;
		private static ProblemCFireAgain.Pair[] bgn;
		private static ProblemCFireAgain.Pair res;

		private static void bfs2d () {
			Queue<ProblemCFireAgain.Pair> bfsq = new LinkedList<ProblemCFireAgain.Pair> ();
			for (ProblemCFireAgain.Pair src : bgn) {
				lvl[src.a][src.b] = 0;
				bfsq.add (src);
			}
			while (!bfsq.isEmpty ()) {
				ProblemCFireAgain.Pair op = bfsq.poll ();
				int plvl = lvl[op.a][op.b];
//			System.out.println ("ber hoise "+op+" "+plvl);
				if (plvl>max) {
					res = op;
					max = plvl;
				}
				for (int i = 0; i<4; i++) {
					int newX = op.a+dx[i];
					int newY = op.b+dy[i];
//				System.out.println (newX+" "+newY+" "+n+" "+m);
					if (newX>0 && newX<=n && newY>0 && newY<=m && lvl[newX][newY] == -1) {
						bfsq.add (new ProblemCFireAgain.Pair (newX, newY));
						lvl[newX][newY] = (plvl+1);
//					System.out.println ("dhukse "+newX+" "+newY);
					}
				}
			}
		}

		public void solve (int testNumber, InputReader _in, PrintWriter _out) {
			/*
			 * file input-output 😮. Multi source bfs. Same as snackdown problem.
			 * */
			try (InputReader in = new InputReader (new FileInputStream ("input.txt"));
				 PrintWriter out = new PrintWriter (new BufferedWriter (new FileWriter ("output.txt")))) {
				n = in.nextInt ();
				m = in.nextInt ();
				k = in.nextInt ();
				bgn = new ProblemCFireAgain.Pair[k];
				for (int i = 0; i<k; i++) {
					bgn[i] = new ProblemCFireAgain.Pair (in.nextInt (), in.nextInt ());
				}
				max = Integer.MIN_VALUE;
				lvl = new int[n+5][m+5];
				for (int i = 0; i<n+4; i++) {
					Arrays.fill (lvl[i], -1);
				}
				bfs2d ();
//			System.out.println (max);
				out.println (res);
			} catch (Exception e) {
//			e.printStackTrace ();
			}
		}

		private static class Pair {
			int a;
			int b;

			Pair (int a, int b) {
				this.a = a;
				this.b = b;
			}

			public String toString () {
				return a+" "+b;
			}

			public boolean equals (Object o) {
				if (this == o) return true;
				if (!(o instanceof ProblemCFireAgain.Pair)) return false;
				ProblemCFireAgain.Pair pair = (ProblemCFireAgain.Pair) o;
				return a == pair.a && b == pair.b;
			}

			public int hashCode () {
				return Objects.hash (a, b);
			}

		}

	}

	static class InputReader implements AutoCloseable {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public InputReader (InputStream stream) {
			reader = new BufferedReader (new InputStreamReader (stream));
			tokenizer = null;
		}

		public String next () {
			while (tokenizer == null || !tokenizer.hasMoreTokens ()) {
				try {
					String str;
					if ((str = reader.readLine ()) != null) tokenizer = new StringTokenizer (str);
					else return null;//to detect eof
				} catch (IOException e) {
					throw new RuntimeException (e);
				}
			}
			return tokenizer.nextToken ();
		}

		public int nextInt () {
			return Integer.parseInt (next ());
		}

		public void close () throws Exception {
			reader.close ();
		}

	}
}


import java.awt.Point;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class FireAgain {

	Point coordinate;
	Queue<Point> q = new LinkedList<Point>();
	int m, n;
	boolean[][] arr;
	PrintStream out ;

	void bfs(Point start) {

		while (!q.isEmpty()) {
			Point front = q.poll();
			Point p = new Point();

			p.x = front.x - 1;
			p.y = front.y;
			if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1) {
				if (!arr[p.x][p.y]) {
					arr[p.x][p.y] = true;
					q.add(p);
				}
			}

			p = new Point();
			p.x = front.x + 1;
			p.y = front.y;
			if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1)
				if (!arr[p.x][p.y]) {
					arr[p.x][p.y] = true;
					q.add(p);
				}

			p = new Point() ;
			p.x = front.x;
			p.y = front.y + 1;
			if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1)
				if (!arr[p.x][p.y]) {
					arr[p.x][p.y] = true;
					q.add(p);
				}

			p = new Point() ;
			p.x = front.x;
			p.y = front.y - 1;
			if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1)
				if (!arr[p.x][p.y]) {
					arr[p.x][p.y] = true;
					q.add(p);
				}

			if (q.size() == 0)
				out.print(front.x + " " + front.y);
		}
	}

	/**
	 * @param args
	 * @throws FileNotFoundException
	 */
	public static void main(String[] args) throws FileNotFoundException {
		// TODO Auto-generated method stub
		FireAgain fa = new FireAgain();
		Scanner Scan = new Scanner(new FileInputStream("input.txt"));
		fa.out = new PrintStream(new File("output.txt"));
		fa.n = Scan.nextInt();
		fa.m = Scan.nextInt();
		int k = Scan.nextInt();
		fa.arr = new boolean[2001][2001];

		for (int i = 0; i < k; i++) {
			fa.coordinate = new Point();
			fa.coordinate.x = Scan.nextInt();
			fa.coordinate.y = Scan.nextInt();
			fa.q.add(fa.coordinate);
			fa.arr[fa.coordinate.x][fa.coordinate.y] = true;
		}

		fa.bfs(fa.q.peek());

	}

}


import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class Main implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public static void mergeSort(int[] a) {
            mergeSort(a, 0, a.length - 1);
    }

    private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
            final int MAGIC_VALUE = 50;
            if (leftIndex < rightIndex) {
                    if (rightIndex - leftIndex <= MAGIC_VALUE) {
                            insertionSort(a, leftIndex, rightIndex);
                    } else {
                            int middleIndex = (leftIndex + rightIndex) / 2;
                            mergeSort(a, leftIndex, middleIndex);
                            mergeSort(a, middleIndex + 1, rightIndex);
                            merge(a, leftIndex, middleIndex, rightIndex);
                    }
            }
    }

    private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
            int length1 = middleIndex - leftIndex + 1;
            int length2 = rightIndex - middleIndex;
            int[] leftArray = new int[length1];
            int[] rightArray = new int[length2];
            System.arraycopy(a, leftIndex, leftArray, 0, length1);
            System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
            for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
                    if (i == length1) {
                            a[k] = rightArray[j++];
                    } else if (j == length2) {
                            a[k] = leftArray[i++];
                    } else {
                            a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
                    }
            }
    }

    private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
            for (int i = leftIndex + 1; i <= rightIndex; i++) {
                    int current = a[i];
                    int j = i - 1;
                    while (j >= leftIndex && a[j] > current) {
                            a[j + 1] = a[j];
                            j--;
                    }
                    a[j + 1] = current;
            }
    }

    public static void main(String[] args) {
        new Main().run();
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    int mini = Integer.MAX_VALUE;
    int maxi = Integer.MIN_VALUE;
    int ans = 0;
    int ans2 = 0;
    int sum = 0;

    void solve() throws IOException {
        int n = readInt();
        int m = readInt();
        int maxi=0;
        int  [][] a = new int [n][m];
        int k = readInt();
        ArrayDeque<Point> dq = new ArrayDeque<Point> ();
        Point p = new Point();
        for (int i = 0; i<n; i++)
            for (int j= 0; j<m; j++){
                a[i][j]=Integer.MAX_VALUE;
            }
        for (int i = 0; i<k; i++){
            int x = readInt()-1;
            int y = readInt()-1;
            p.x=x;
            p.y=y;
            dq.add(new Point(x,y));
            a[x][y]=0;
        }
        while (!dq.isEmpty()){
            Point v = dq.pollFirst();
            Point u = new Point();
            if (v.x-1!=-1) {
                if (a[v.x-1][v.y]>a[v.x][v.y]+1){
                    a[v.x-1][v.y]=a[v.x][v.y]+1;
                    maxi=max(maxi,a[v.x-1][v.y]);
                    u.x=v.x-1;
                    u.y=v.y;
                    dq.add(new Point(u.x,u.y));
                }
            }
            if (v.y-1!=-1) {
                if (a[v.x][v.y-1]>a[v.x][v.y]+1){
                    a[v.x][v.y-1]=a[v.x][v.y]+1;
                    maxi=max(maxi,a[v.x][v.y-1]);
                    u.y=v.y-1;
                    u.x=v.x;
                    dq.add(new Point(u.x,u.y));
                }
            }
            if (v.x+1!=n) {
                if (a[v.x+1][v.y]>a[v.x][v.y]+1){
                    a[v.x+1][v.y]=a[v.x][v.y]+1;
                    maxi=max(maxi,a[v.x+1][v.y]);
                    u.x=v.x+1;
                    u.y=v.y;
                    dq.add(new Point(u.x,u.y));
                }
            }
            if (v.y+1!=m) {
                if (a[v.x][v.y+1]>a[v.x][v.y]+1){
                    a[v.x][v.y+1]=a[v.x][v.y]+1;
                    maxi=max(maxi,a[v.x][v.y+1]);
                    u.y=v.y+1;
                    u.x=v.x;
                    dq.add(new Point(u.x,u.y));
                }
            }
        }
        for (int i =0; i<n; i++)
            for (int j =0; j<m; j++){
                if (maxi==a[i][j]) {
                    out.print((i+1) + " " + (j+1));
                    return;
                }
            }

      }

    char c[];

    void per (int left, int right){
        if(left == right){
            for (int i = 0; i<=right;i++){
                out.print(c[i]);
            }
            out.println();
        }
        else {
            for (int i = left; i <=right; i++){
                char k = c[left];
                c[left] = c[i];
                c[i] = k;
                per(left+1,right);
                k = c[left];
                c[left] = c[i];
                c[i] = k;
            }
        }
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class C35
{

	public static int mod = 1000000007;
	public static long INF = (1L << 60);

	static int n,m;
	static class Pair
	{
		int x,y;
		Pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
	}
	static boolean[][] burned;
	static int[] dx={-1,0,1,0};
	static int[] dy={0,-1,0,1};
	static boolean isvalid(int x,int y)
	{
		return x>=0&&x<n&&y>=0&&y<m;
	}
	public static void main(String[] args) throws IOException
	{
		Scanner in = new Scanner("input.txt");
		PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
		n=in.nextInt();
		m=in.nextInt();
		burned=new boolean[n][m];
		int k=in.nextInt();
		Queue<Pair> queue=new LinkedList<>();
		Pair prev=null;
		for(int i=0;i<k;i++)
		{
			int x=in.nextInt();
			int y=in.nextInt();
			burned[x-1][y-1]=true;
			queue.add(prev=new Pair(x-1, y-1));
		}
		while(!queue.isEmpty())
		{
			Queue<Pair> tempqueue=new LinkedList<>();
		for(Pair p : queue)
		{
			int x=p.x;
			int y=p.y;
			prev=p;
			for(int i=0;i<4;i++)
			{
				if(isvalid(x+dx[i], y+dy[i])&&!burned[x+dx[i]][y+dy[i]])
				{
					tempqueue.add(new Pair(x+dx[i], y+dy[i]));
					burned[x+dx[i]][y+dy[i]]=true;
				}
			}
		}
		queue=tempqueue;
		}
		out.printf("%d %d\n",(prev.x+1),(prev.y+1));
		out.close();

	}

	public static long pow(long x, long n)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p))
		{
			if ((n & 1) != 0)
			{
				res = (res * p);
			}
		}
		return res;
	}

	public static long pow(long x, long n, long mod)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p) % mod)
		{
			if ((n & 1) != 0)
			{
				res = (res * p % mod);
			}
		}
		return res;
	}

	public static long gcd(long n1, long n2)
	{
		long r;
		while (n2 != 0)
		{
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long lcm(long n1, long n2)
	{
		long answer = (n1 * n2) / (gcd(n1, n2));
		return answer;
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(String s) throws FileNotFoundException {	br = new BufferedReader(new FileReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}
	}
}


import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class R035CRetry {
    public void debug(Object... objects) { System.err.println(Arrays.deepToString(objects)); }
    public static final int INF = 987654321;
    public static final long LINF = 987654321987654321L;
    public static final double EPS = 1e-9;

    Scanner scanner;
    PrintWriter out;
    boolean[][] bss;

    public R035CRetry() {
        try {
            this.scanner = new Scanner(new File("input.txt"));
            this.out = new PrintWriter("output.txt");
        } catch(FileNotFoundException ex) { ex.printStackTrace(); }
    }

    class Point implements Comparable<Point> {
        int x, y, count;
        Point(int x, int y) { this.x = x; this.y = y; }
        public int hashCode() { return x * 17 + y; }
        public boolean equals(Object o) {
            if(!(o instanceof Point)) return false;
            Point that = (Point)o;
            return this.x == that.x && this.y == that.y;
        }
        public int compareTo(Point that) { return this.count - that.count; }
        public String toString()  { return "(" + x + ", " + y + ":" + count + ")"; }
    }

    int[] dx = new int[] {  0, 0, -1, 1 };
    int[] dy= new int[] { -1, 1,  0, 0 };
    int n, m;

    Queue<Point> q;

    Point bfs() {
        int max = -INF;
        Point p = null;
        while(!q.isEmpty()) {
            Point cur = q.remove();
            if(max < cur.count) { max = cur.count; p = cur; }
            for(int i=0; i<dx.length; i++) {
                int nx = cur.x + dx[i];
                int ny = cur.y + dy[i];
                if(nx < 0 || nx >= n) { continue; }
                if(ny < 0 || ny >= m) { continue; }
                Point np = new Point(nx, ny);
                if(bss[nx][ny] ) { continue; }
                np.count = cur.count+1;
                bss[nx][ny] = true;
                q.add(np);
            }
        }
        return p;
    }

    private void solve() {
        this.n = scanner.nextInt();
        this.m = scanner.nextInt();
        this.bss = new boolean[n][m];
        int k = scanner.nextInt();
        q = new LinkedList<Point>();
        for(int i=0; i<k; i++) {
            int x = scanner.nextInt() - 1;
            int y = scanner.nextInt() - 1;
            Point init = new Point(x, y);
            init.count = 1;
            q.add(init);
            bss[x][y] = true;
        }
        Point p = bfs();
        out.println((p.x+1) + " " + (p.y+1));
    }

    private void finish() { this.out.close(); }

    public static void main(String[] args) {
        R035CRetry obj = new R035CRetry();
        obj.solve();
        obj.finish();
    }
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Watermelon {
    static int[][] ans;static int n,m;static boolean[][] vis;
    public static void main(String[] args) throws IOException {
        Scanner sc=new Scanner(new File("input.txt"));
//        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter("output.txt");
        int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();
        Queue<Integer> pq=new ArrayDeque<>();
        boolean[] vis=new boolean[n*m];
        for(int i=0;i<k;i++){
            int r=sc.nextInt()-1,c=sc.nextInt()-1;
            pq.add(m*r+c);
            vis[m*r+c]=true;
        }
        sc.close();
        int ans=0;
        while(pq.size()!=0){
            int x=pq.remove();

            ans=x;
            if(n!=1 && x%n==0){
                if(x+m<n*m&&!vis[x+m]){
                    pq.add(x+m);
                    vis[x+m]=true;
                }
                if(x-m>=0&&!vis[x-m]){
                    pq.add(x-m);
                    vis[x-m]=true;
                }
                if(x+1<n*m&&!vis[x+1]){
                    pq.add(x+1);
                    vis[x+1]=true;
                }
            }
            else if(n!=1 && (x+1)%n==0){
                if(x+m<n*m&&!vis[x+m]){
                    pq.add(x+m);
                    vis[x+m]=true;
                }
                if(x-m>=0&&!vis[x-m]){
                    pq.add(x-m);
                    vis[x-m]=true;
                }
                if(x-1>=0&&!vis[x-1]){
                    pq.add(x-1);
                    vis[x-1]=true;
                }
            }
            else{
                if(x+m<n*m&&!vis[x+m]){
                    pq.add(x+m);
                    vis[x+m]=true;
                }
                if(x-m>=0&&!vis[x-m]){
                    pq.add(x-m);
                    vis[x-m]=true;
                }
                if(x-1>=0&&!vis[x-1]){
                    pq.add(x-1);
                    vis[x-1]=true;
                }
                if(x+1<n*m&&!vis[x+1]){
                    pq.add(x+1);
                    vis[x+1]=true;
                }
            }
        }
        pw.println((ans/m+1)+" "+(ans%m+1));
        pw.close();
    }

    static class Reader{
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }

            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

}


import java.io.*;
import java.util.LinkedList;

public class Solution {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader("input.txt"));
        PrintWriter out = new PrintWriter("output.txt");

        String[] raw = in.readLine().split(" ");
        int n = Integer.parseInt(raw[0]);
        int m = Integer.parseInt(raw[1]);

        int k = Integer.parseInt(in.readLine());

        raw = in.readLine().split(" ");

        boolean[][] map = new boolean[n][m];
        LinkedList<Point> queue = new LinkedList<>();

        for (int i = 0; i < k; i++) {
            Point fireStarter = new Point(Integer.parseInt(raw[i * 2]) - 1, Integer.parseInt(raw[i * 2 + 1]) - 1);

            queue.addLast(fireStarter);
        }

        int treesLeft = n * m;

        while (true) {
            Point firepoint = queue.removeFirst();

            if (map[firepoint.x][firepoint.y])
                continue;

            treesLeft--;
            map[firepoint.x][firepoint.y] = true;

            if (treesLeft == 0) {
                out.printf("%d %d", firepoint.x + 1, firepoint.y + 1);
                out.flush();
                return;
            }

            if (firepoint.x > 0 && !map[firepoint.x - 1][firepoint.y])
                queue.add(new Point(firepoint.x - 1, firepoint.y));

            if (firepoint.y > 0 && !map[firepoint.x][firepoint.y - 1])
                queue.add(new Point(firepoint.x, firepoint.y - 1));

            if (firepoint.x < n - 1 && !map[firepoint.x + 1][firepoint.y])
                queue.add(new Point(firepoint.x + 1, firepoint.y));

            if (firepoint.y < m - 1 && !map[firepoint.x][firepoint.y + 1])
                queue.add(new Point(firepoint.x, firepoint.y + 1));

//
//            for (int i = 0; i < n; i++) {
//                for (int j = 0; j < m; j++) {
//                    System.out.printf("%d ", map[i][j] ? 1 : 0);
//                }
//                System.out.println();
//            }
//            System.out.println("\n-------\n");
        }
    }

    private static class Point {
        public int x;
        public int y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}


import java.awt.Point;
import java.io.*;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;

import static java.lang.Integer.*;
import static java.lang.Math.*;
@SuppressWarnings("unused")
public class round35C {
    static class state{
        int x, y, time;
        public state(int xx, int yy, int t){
            x = xx;
            y = yy;
            time = t;
        }
    }
    static int N,M;
    static int [] dx = new int [] {1,-1,0,0};
    static int [] dy = new int [] {0,0,1,-1};
    static Queue<state> bfs = new LinkedList<round35C.state>();
    public static Point runBFS(){
        boolean [][] vis = new boolean [N + 1][M + 1];
        int max = -(int)1e9;
        int bestx = -1;
        int besty = -1;
        while(!bfs.isEmpty()){
            state p = bfs.poll();
            int x = p.x;
            int y = p.y;
            int time = p.time;
            if(vis[x][y])
                continue;
            vis[x][y] = true;
            if(time > max){
                max = time;
                bestx = x + 1;
                besty = y + 1;
            }
            for(int i = 0 ; i < 4 ; ++i){
                int nx = x + dx[i];
                int ny = y + dy[i];
                if(nx < 0 || ny < 0 || nx >= N || ny >= M)
                    continue;
                if(vis[nx][ny] == false)
                    bfs.offer(new state(nx, ny, time + 1));
            }
        }
        return new Point(bestx, besty);
    }
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("input.txt"));
        PrintWriter out = new PrintWriter("output.txt");
        String [] use = null;
        use = br.readLine().split(" ");
        N = parseInt(use[0]);
        M = parseInt(use[1]);
        int K = parseInt(br.readLine());
        use = br.readLine().split(" ");
        for(int i = 0 ; i < 2 * K ; i += 2){
            int f = parseInt(use[i]) - 1;
            int t = parseInt(use[i + 1]) - 1;
            bfs.offer(new state(f, t, 0));
        }
        Point ans = runBFS();
        out.println(ans.x + " " + ans.y);
        out.flush();
        out.close();
    }

}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Solution implements Runnable {
  BufferedReader in;
  PrintWriter out;
  StringTokenizer tok = new StringTokenizer("");

  @Override
  public void run() {
    try {
      init();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    long time = System.currentTimeMillis();
    try {
      solve();
    } catch (Exception e) {
      e.printStackTrace();
    }
    out.close();
    //System.err.println(System.currentTimeMillis() - time);
  }

  private void init() throws FileNotFoundException {
    String file = "123";
    if (!file.equals("")) {
      in = new BufferedReader(new FileReader("input.txt"));
      out = new PrintWriter("output.txt");
    } else {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(System.out);
    }
  }

  public static void main(String[] args) {
    new Thread(new Solution()).start();
  }

  private String readString() {
    while (!tok.hasMoreTokens()) {
      try {
        tok = new StringTokenizer(in.readLine());
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    return tok.nextToken();
  }

  private int readInt() {
    return Integer.parseInt(readString());
  }

  int[] counts = new int[1000];

  private long readLong() {
    return Long.parseLong(readString());
  }

  private void solve() {
    int n = readInt()+2;
    int m = readInt()+2;
    boolean[][] graph = new boolean[n][m];
    for (int i = 0; i < n; i++) {
      graph[i][m-1] = true;
      graph[i][0] = true;
    }
    for (int i = 0; i < m; i++) {
      graph[n-1][i] = true;
      graph[0][i] = true;
    }
    int k = readInt();
    int inFire = 0;
    Queue<Point> q = new ArrayDeque<>();
    for (int i = 0; i < k; i++) {
      int x = readInt();
      int y = readInt();
      Point p = new Point(x, y);
      graph[x][y] = true;
      q.add(p);
    }
    while (!q.isEmpty()) {
      Point current = q.poll();
      inFire++;
      if(!graph[current.x+1][current.y]) {
        graph[current.x+1][current.y] = true;
        q.add(new Point(current.x+1, current.y));
      }
      if(!graph[current.x-1][current.y]) {
        graph[current.x-1][current.y] = true;
        q.add(new Point(current.x-1, current.y));
      }
      if(!graph[current.x][current.y+1]) {
        graph[current.x][current.y+1] = true;
        q.add(new Point(current.x, current.y+1));
      }
      if(!graph[current.x][current.y-1]) {
        graph[current.x][current.y-1] = true;
        q.add(new Point(current.x, current.y-1));
      }
      if(q.isEmpty()) {
        out.print(current.x+" "+current.y);
        return;
      }
    }

  }

  class Point{
    int x, y;

    public Point(int x, int y) {
      this.x = x;
      this.y = y;
    }
  }
}


import java.io.*;
import java.util.StringTokenizer;

import static java.lang.Math.abs;

/**
 * 35C
 *
 * @author artyom
 */
public class FireAgain implements Runnable {
    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer tok;

    private void solve() throws IOException {
        int n = nextInt(), m = nextInt();
        int[][] sources = readIntMatrix(nextInt(), 2);
        int max = -1, maxI = 0, maxJ = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                int min = Integer.MAX_VALUE;
                for (int[] source : sources) {
                    int dist = abs(source[0] - i) + abs(source[1] - j);
                    if (dist < min) {
                        min = dist;
                    }
                }
                if (min > max) {
                    max = min;
                    maxI = i;
                    maxJ = j;
                }
            }
        }
        out.print((maxI + 1) + " " + (maxJ + 1));
    }

    //--------------------------------------------------------------
    public static void main(String[] args) {
        new FireAgain().run();
    }

    @Override
    public void run() {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter(new FileWriter("output.txt"));
            tok = null;
            solve();
            in.close();
            out.close();
        } catch (IOException e) {
            System.exit(0);
        }
    }

    private String nextToken() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private int[][] readIntMatrix(int n, int m) throws IOException {
        int[][] mx = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                mx[i][j] = nextInt() - 1;
            }
        }
        return mx;
    }
}


import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;
import java.io.*;

public class Main {

	void solve() {
		int R = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();
		int[] x = new int[K];
		int[] y = new int[K];
		for (int i = 0; i < K; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}

		int best = -1;
		int bestX = 0;
		int bestY = 0;

		for (int r = 1; r <= R; r++) for (int c = 1; c <= C; c++) {
			int here = R + C;
			for (int i = 0; i < K; i++) {
				int t = abs(r - x[i]) + abs(c - y[i]);
				here = min(here, t);
			}
			if (best < here){
				best = here;
				bestX = r;
				bestY = c;
			}
		}

		out.println(bestX + " " + bestY);
	}

	void print(int[] a) {
		out.print(a[0]);
		for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
		out.println();
	}

	static void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
//		sc = new MyScanner(System.in);
//		out = new PrintWriter(System.out);
		sc = new MyScanner(new FileInputStream(new File("input.txt")));
		out = new PrintWriter(new File("output.txt"));
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}


import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class R035C {
    public void debug(Object... objects) { System.err.println(Arrays.deepToString(objects)); }
    public static final int INF = 987654321;
    public static final long LINF = 987654321987654321L;
    public static final double EPS = 1e-9;

    Scanner scanner;
    PrintWriter out;
    int[][] iss;

    public R035C() {
        try {
            this.scanner = new Scanner(new File("input.txt"));
            this.out = new PrintWriter("output.txt");
        } catch(FileNotFoundException ex) { ex.printStackTrace(); }
    }

    class Point implements Comparable<Point> {
        int x, y, count;
        Point(int x, int y) { this.x = x; this.y = y; }
        public int hashCode() { return x * 17 + y; }
        public boolean equals(Object o) {
            if(!(o instanceof Point)) return false;
            Point that = (Point)o;
            return this.x == that.x && this.y == that.y;
        }
        public int compareTo(Point that) { return this.count - that.count; }
        public String toString()  { return "(" + x + ", " + y + ":" + count + ")"; }
    }

    int[] dx = new int[] {  0, 0, -1, 1 };
    int[] dy= new int[] { -1, 1,  0, 0 };
    int n, m;

    Queue<Point> q;

    Point bfs() {
        int max = -INF;
        Point p = null;
        while(!q.isEmpty()) {
            Point cur = q.remove();
            if(max < cur.count) { max = cur.count; p = cur; }
            for(int i=0; i<dx.length; i++) {
                int nx = cur.x + dx[i];
                int ny = cur.y + dy[i];
                if(nx < 0 || nx >= n) { continue; }
                if(ny < 0 || ny >= m) { continue; }
                Point np = new Point(nx, ny);
                if(iss[nx][ny] != 0) { continue; }
                np.count = cur.count+1;
                iss[nx][ny] = np.count;
                q.add(np);
            }
        }
        return p;
    }

    private void solve() {
        this.n = scanner.nextInt();
        this.m = scanner.nextInt();
        this.iss = new int[n][m];
        int k = scanner.nextInt();
        q = new PriorityQueue<Point>();
        for(int i=0; i<k; i++) {
            int x = scanner.nextInt() - 1;
            int y = scanner.nextInt() - 1;
            Point init = new Point(x, y);
            init.count = 1;
            q.add(init);
            iss[x][y] = 1;
        }
        Point p = bfs();
        out.println((p.x+1) + " " + (p.y+1));
    }

    private void finish() { this.out.close(); }

    public static void main(String[] args) {
        R035C obj = new R035C();
        obj.solve();
        obj.finish();
    }
}


import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author zodiacLeo
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream;
        try
        {
            inputStream = new FileInputStream("input.txt");
        } catch (IOException e)
        {
            throw new RuntimeException(e);
        }
        OutputStream outputStream;
        try
        {
            outputStream = new FileOutputStream("output.txt");
        } catch (IOException e)
        {
            throw new RuntimeException(e);
        }
        FastScanner in = new FastScanner(inputStream);
        FastPrinter out = new FastPrinter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC
    {
        public void solve(int testNumber, FastScanner in, FastPrinter out)
        {
            int n = in.nextInt();
            int m = in.nextInt();
            int p = in.nextInt();
            int[] x = new int[p];
            int[] y = new int[p];
            for (int i = 0; i < p; i++)
            {
                x[i] = in.nextInt();
                y[i] = in.nextInt();
            }

            int X = x[0];
            int Y = y[0];
            int D = -1;
            for (int dx = 1; dx <= n; dx++)
            {
                int x1 = dx;
                int y1 = 1;
                int xx = 0;
                int yy = 0;
                int minD = Integer.MAX_VALUE;
                for (int j = 0; j < p; j++)
                {
                    int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);
                    if (d < minD)
                    {
                        minD = d;
                        xx = x1;
                        yy = y1;
                    }
                }
                if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)
                {
                    D = minD;
                    X = xx;
                    Y = yy;
                }
            }
            for (int dx = 1; dx <= n; dx++)
            {
                int x1 = dx;
                int y1 = m;
                int xx = 0;
                int yy = 0;
                int minD = Integer.MAX_VALUE;
                for (int j = 0; j < p; j++)
                {
                    int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);
                    if (d < minD)
                    {
                        minD = d;
                        xx = x1;
                        yy = y1;
                    }
                }
                if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)
                {
                    D = minD;
                    X = xx;
                    Y = yy;
                }
            }
            for (int dy = 1; dy <= m; dy++)
            {
                int x1 = 1;
                int y1 = dy;
                int xx = 0;
                int yy = 0;
                int minD = Integer.MAX_VALUE;
                for (int j = 0; j < p; j++)
                {
                    int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);
                    if (d < minD)
                    {
                        minD = d;
                        xx = x1;
                        yy = y1;
                    }
                }
                if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)
                {
                    D = minD;
                    X = xx;
                    Y = yy;
                }
            }
            for (int dy = 1; dy <= m; dy++)
            {
                int x1 = n;
                int y1 = dy;
                int xx = 0;
                int yy = 0;
                int minD = Integer.MAX_VALUE;
                for (int j = 0; j < p; j++)
                {
                    int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);
                    if (d < minD)
                    {
                        minD = d;
                        xx = x1;
                        yy = y1;
                    }
                }
                if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)
                {
                    D = minD;
                    X = xx;
                    Y = yy;
                }
            }

            for (int i = 1; i <= Math.min(m, n); i++)
            {
                int x1 = i;
                int y1 = i;
                int xx = 0;
                int yy = 0;
                int minD = Integer.MAX_VALUE;
                for (int j = 0; j < p; j++)
                {
                    int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);
                    if (d < minD)
                    {
                        minD = d;
                        xx = x1;
                        yy = y1;
                    }
                }
                if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)
                {
                    D = minD;
                    X = xx;
                    Y = yy;
                }
            }
            for (int i = 1, ii = m; i <= n && ii >= 1; i++, ii--)
            {
                int x1 = i;
                int y1 = ii;
                int xx = 0;
                int yy = 0;
                int minD = Integer.MAX_VALUE;
                for (int j = 0; j < p; j++)
                {
                    int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);
                    if (d < minD)
                    {
                        minD = d;
                        xx = x1;
                        yy = y1;
                    }
                }
                if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)
                {
                    D = minD;
                    X = xx;
                    Y = yy;
                }
            }
            out.println(X + " " + Y);
        }

    }

    static class FastScanner
    {
        public BufferedReader br;
        public StringTokenizer st;

        public FastScanner(InputStream is)
        {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        public String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

    }

    static class FastPrinter extends PrintWriter
    {
        public FastPrinter(OutputStream out)
        {
            super(out);
        }

        public FastPrinter(Writer out)
        {
            super(out);
        }

    }
}


import java.io.*;
import java.util.*;

public class P035C {
    private class Pair {
        private int x;
        private int y;

        private Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int hashCode() {
            return 37 * x + y;
        }

        public boolean equals(Object other) {
            if (other instanceof Pair) {
                Pair otherPair = (Pair)other;
                return x == otherPair.x && y == otherPair.y;
            }

            return false;
        }
    }

    private boolean[][] visited;
    private final int N;
    private final int M;
    private final int k;
    private ArrayList<Pair> fires = new ArrayList<Pair>();
    private ArrayList<Pair> neighbors = new ArrayList<Pair>();

    public P035C() throws IOException {
        Scanner sc = new Scanner(new File("input.txt"));

        N = sc.nextInt();
        M = sc.nextInt();
        visited = new boolean[N][M];
        k = sc.nextInt();
        for (int i = 0; i < k; i++) {
            int x = sc.nextInt() - 1;
            int y = sc.nextInt() - 1;
            fires.add(new Pair(x, y));
        }
        bfs();
    }

    private void bfs() throws IOException{
        java.util.Queue<Pair> queue = new ArrayDeque<Pair>();
        for (Pair p : fires) {
            queue.add(p);
            visited[p.x][p.y] = true;
        }

        Pair last = fires.get(0);
        while (!queue.isEmpty()) {
            Pair p = last = queue.poll();
            for (Pair pn : getNeighbors(p)) {
                if (!visited[pn.x][pn.y]) {
                    queue.add(pn);
                    visited[pn.x][pn.y] = true;
                }
            }
        }

        PrintWriter output = new PrintWriter(new FileWriter(new File("output.txt")));
        output.printf("%d %d\n", last.x + 1, last.y + 1);
        output.close();
    }

    private Collection<Pair> getNeighbors(Pair p) {
        neighbors.clear();
        if (p.x > 0)   neighbors.add(new Pair(p.x-1, p.y));
        if (p.x < N-1) neighbors.add(new Pair(p.x+1, p.y));
        if (p.y > 0)   neighbors.add(new Pair(p.x, p.y-1));
        if (p.y < M-1) neighbors.add(new Pair(p.x, p.y+1));

        return neighbors;
    }

    public static void main(String[] args) throws IOException {
        P035C solution = new P035C();
    }
}