#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#pragma warning (disable: 4996)

int H, W, N, maxn, ret = (1 << 30);
vector<int> X[100009];

int main() {
	scanf("%d%d%d", &H, &W, &N);
	for (int i = 0; i < N; i++) {
		int p, q; scanf("%d%d", &p, &q);
		X[p].push_back(q);
	}
	for (int i = 100000; i >= 0; i--) {
		ret = min(ret, i + maxn);
		for (int j : X[i]) maxn = max(maxn, j);
	}
	cout << ret << endl;
	return 0;
}
