#include<bits/stdc++.h>
#define int long long
#define N 100510
using namespace std;
void read(int &x){
x=0;int y=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-') y=-1;c=getchar();}
while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
x*=y;
}
int n,m1,m2;
struct node
{
int a,b,cnt,last_ti;
bool operator <(const node &A) const{
return a<A.a;
}
}plc[N],plg[N];
int q1[N],q2[N];
int ans;
signed main(){
// freopen("airport3.in","r",stdin);
read(n);read(m1);read(m2);
for(int i=1; i<=m1; i++) read(plc[i].a),read(plc[i].b),plc[i].last_ti=plc[i].b,plc[i].cnt=1;
for(int i=1; i<=m2; i++) read(plg[i].a),read(plg[i].b),plg[i].last_ti=plg[i].b,plg[i].cnt=1;
sort(plc+1,plc+1+m1);sort(plg+1,plg+1+m2);
for(int i=1; i<=m1; i++){
for(int j=1; j<=i-1; j++){
if(plc[i].a>plc[j].last_ti){
plc[i].cnt=0,plc[j].cnt++,plc[j].last_ti=plc[i].b;
break;
}
}
}
for(int i=1; i<=m2; i++){
for(int j=1; j<=i-1; j++){
if(plg[i].a>plg[j].last_ti){
plg[i].cnt=0,plg[j].cnt++,plg[j].last_ti=plg[i].b;
break;
}
}
}
int moo=0;
for(int i=1; i<=m1; i++){
if(plc[i].cnt) q1[++moo]=q1[moo-1]+plc[i].cnt;
}
moo=0;
for(int i=1; i<=m2; i++){
if(plg[i].cnt) q2[++moo]=q2[moo-1]+plg[i].cnt;
}
for(int i=1; i<=n; i++){
int sum=0;
sum+=q1[i];sum+=q2[n-i];
ans=max(sum,ans);
}
printf("%lld",ans);
return 0;
}