#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  long long h,w,n,cnt=0;
  cin >> h >> w >> n;
  long long x[n],y[n],ans=h;
  pair<long long, long long> p[n];
  for(int i=0;i<n;i++){
    cin >> x[i] >> y[i];
    p[i]=make_pair(x[i], y[i]);
  }
  sort(p,p+n);
  map<pair<ll, ll> ,int> mp;
  for(int i=0;i<n;i++){
    if(p[i].first-cnt==p[i].second){
      cnt++;
    }else if(p[i].first-cnt>p[i].second){
      if(mp[{p[i].first-1ll, p[i].second-1ll}]==0){
        ans=min(ans, p[i].first-1);
      }
    }
    mp[{p[i].first, p[i].second}]++;
  }
  cout << ans << endl;
  return 0;
}
