#include <bits/stdc++.h>

using namespace std;

int main() {
    int h, w, n;
    cin >> h >> w >> n;
    vector<pair<int, int>> xs(n);
    int res = h;
    for (int i = 0; i < n; ++i) {
        int x, y; cin >> x >> y;
        xs[i] = {x, y};
    }
    sort(xs.begin(), xs.end());
    int diff = 1;
    for (auto p: xs) {
        if (p.second <= p.first - diff) {
            cout << p.first - 1 << endl;
            goto end;
        } else if (p.second == p.first - diff + 1) {
            diff += 1;
        }
    }
    cout << res << endl;
end:
    return 0;
}

