//const int N = 1e6;
//int max_h[N];
//void _(){
//	set<pair<int,int> > blocked;
//	int h,w,n;
//	cin >> h >> w >> n;
//	vpii input(n);
//	cin >> input;
//	for(auto cur : input)
//		blocked.insert(cur);
//	int x = 1, y = 1;
//	int ans = 1;
//	while(true){
//		auto taka = mp(x+1,y);
//		if(x+1 > h || blocked.count(taka))
//			break;
//		++x;
//		auto aoki = mp(x,y+1);
//		if(y+1 <= w && !blocked.count(aoki))
//			++y;
//		++ans;
//		max_h[ans] = y;
//	}
//	for(auto cur : blocked){
//		if(max_h[cur.first] >= cur.second)
//			ans = min(ans,cur.first-1);
//	}
//	print(ans);
//}
//
// ================================================ 
// ^^^	ABOVE is what I wrote in my editor	^^^
// ------------------------------------------------ 
// vvv	BELOW is automatically generated 	vvv
// ================================================ 
#include <set>
#include <iomanip>
#include <algorithm> 
#include <cassert>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define mp make_pair 
#define all(v) (v).begin(),(v).end()
#define sz(v) ll(v.size())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
template<typename IT>
ostream &print(IT b, IT e, string sep = " ", ostream &stream = cout){
    for(IT it = b; it != e; ++it){
        stream << *it;
        if(it+1 != e) stream << sep;
    } 
    return stream;
}
template<typename IT> istream &read(IT b, IT e, istream &stream = cin){
    for(IT it = b; it != e; ++it)
        stream >> *it; 
    return stream;
}
template<typename T> ostream &operator<<(ostream &stream, vector<T> &t){
    return print(all(t)," ",stream);
}
template<typename T> ostream &operator<<(ostream &stream, vector<T> &&t){
    return print(all(t)," ",stream);
}
template<typename T> istream &operator>>(istream &stream, vector<T> &t){
    return read(all(t),stream);
}
template<typename F, typename S> ostream &operator<<(ostream &stream, const pair<F,S> t){
    return stream << t.first << ' ' << t.second;
}
template<typename F, typename S> istream &operator>>(istream &stream, pair<F,S> &t){
    return stream >> t.first >> t.second;
}
template <typename T> 
void print(T x, string end = "\n"){
    cout << x << end;
}
template <typename t> 
void print(vector<t> arr,string sep=" "){
    if(arr.empty()){
        return;
    }
    print(arr.begin(),arr.end(),sep);
    cout << '\n';
}
template <typename T> 
void print(vector<vector<T> > arr){
    for(int i = 0; i < sz(arr); ++i){
        cout << "[" << arr[i] << "]";
        if(i+1 < sz(arr))
            cout << ", ";
    }
    cout << '\n';
}
template<typename T>
T _();
const ll MOD = 1e9+7;
template<typename T>
vector<T> operator+(const vector<T> &lhs, const vector<T> &rhs){
    vector<T> ans(lhs);
    assert(ans.size() == rhs.size());
    for(int i = 0; i < rhs.size(); ++i)
        ans[i] += rhs[i];
    return ans;
}
template<typename T>
vector<T> operator+=(vector<T> &lhs, const vector<T> &rhs){
    return lhs = lhs+rhs;
}
template<typename T>
vector<T> operator-(const vector<T> lhs, const vector<T> rhs){
    vector<T> ans(all(lhs));
    assert(ans.size() == rhs.size());
    for(int i = 0; i < rhs.size(); ++i)
        ans[i] -= rhs[i];
    return ans;
}
template<typename T>
vector<T> operator-=(vector<T> &lhs, const vector<T> &rhs){
    return lhs = lhs-rhs;
}
template<typename T>
vector<T> append(vector<T> &lhs, const vector<T> rhs){
    lhs.insert(lhs.end(),all(rhs));
    return lhs;
}
template<typename T>
T max(const vector<T> arr){
    assert(!arr.empty());
    T ans = arr[0];
    for(auto &cur : arr)
        ans = max(ans,cur);
    return ans;
}
template<typename T>
T min(const vector<T> arr){
    assert(!arr.empty());
    T ans = arr[0];
    for(auto &cur : arr)
        ans = min(ans,cur);
    return ans;
}
template<typename T>
T max(const set<T> s){
    assert(!s.empty());
    return *--s.end();
}
template<typename T>
T min(const set<T> s){
    assert(!s.empty());
    return *s.begin();
}
template<typename T, typename G>
vector<T> set_max(vector<T> &base, const vector<G> &comp){
    assert(base.size() == comp.size());
    for(int i = 0; i < (int)comp.size(); ++i)
        base[i] = max(base[i],comp[i]);
    return base;
}
const int N = 1e6;
int max_h[N];
void _(){
	set<pair<int,int> > blocked;
	int h,w,n;
	cin >> h >> w >> n;
	vpii input(n);
	cin >> input;
	for(auto cur : input)
		blocked.insert(cur);
	int x = 1, y = 1;
	int ans = 1;
	while(true){
		auto taka = mp(x+1,y);
		if(x+1 > h || blocked.count(taka))
			break;
		++x;
		auto aoki = mp(x,y+1);
		if(y+1 <= w && !blocked.count(aoki))
			++y;
		++ans;
		max_h[ans] = y;
	}
	for(auto cur : blocked){
		if(max_h[cur.first] >= cur.second)
			ans = min(ans,cur.first-1);
	}
	print(ans);
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(15);
    _();
}


Measured memory_bytes: 12032