#include using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() const int mod = 1000000007; const long long INF = 1LL << 60; using ll = long long; int main() { ll N,M,Q; cin >> N >> M >> Q; vector a(N+1,0),b(N+1,0); rep(i,N){ cin >> a[i+1] >> b[i+1]; } //何番目まで考えるか,最後に選んだペア vector> dp(N+10,vector(N+10,0)); int ans=0; rep(i,N+1)if(i){ rep(j,i+1){ rep(k,j+1){ if(a[j]>a[k]&&b[j]>b[k]) dp[i][j]=max(dp[i][j],dp[i-1][k]+1); } ans=max(ans,dp[i][j]); } } cout << ans << endl; }