#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define orz 0
#define gc getchar()
#define mo 998244353
#define mod(v)((v)%998244353)
using namespace std;
inline int read(){
int x=0; char s=gc;
while(!isdigit(s))s=gc;
while(isdigit(s))x=(x<<1)+(x<<3)+s-'0',s=gc;
return x;
}
int t1[100001][2]{},t2[100001][2]{};
int main(){
int n = read(),m1 = read(),m2 = read();
for(int i = 0;i < m1;++i){
int m = read(),q = read();
for(int j = 1;j <= n;j ++){
if(m > t1[j][1]){
t1[j][0]++;
t1[j][1] = q;
break;
}
}
}
for(int i = 0;i < m2;++i){
int m = read(),q = read();
for(int j = 1;j <= n;j ++){
if(m > t2[j][1]){
t2[j][0]++;
t2[j][1] = q;
break;
}
}
}
for(int i = 2;i <= n;++i){
t1[i][0] += t1[i-1][0];
t2[i][0] += t2[i-1][0];
}
int ans = 0;
for(int i = 0;i <= n; ++i){
ans = max(ans,t1[i][0]+t2[n-i][0]);
}
cout << ans;
return orz;
}