#include<iostream>
#include<complex>
#include<map>
#include<algorithm>
#include<set>
#include<queue>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(c)   (c).begin(),(c).end()

typedef complex<int> P;
typedef pair<P,P>    Line;
typedef unsigned long long ull;

const int N = 20;

namespace std{
  bool operator<(const P &a,const P &b){
    if (a.real() != b.real())return a.real() < b.real();
    return a.imag() < b.imag();
  }
}

bool isp(P a,P b,P c){
  complex<double> A(a.real(),a.imag()),B(b.real(),b.imag()),C(c.real(),c.imag());
  return abs(A-C)+abs(B-C) < abs(A-B) + 1e-10;
}

bool isptable[N][N][N];
bool edge[N][N];

enum {icpcgoal=0,acmgoal=1,els=2};
enum {icpc=0,acm=1};
int isgoal[N];

bool isicpc[8];
class state{
public:
  int n;
  int goal;
  short cnt;
  bool lastmove;
  short node[8];
  ull st;
  bool isclear();
  void makest();
  bool isvalid(int,int,vector<P>&);
  bool operator<(const state& a)const;
};

bool state::operator<(const state& a)const{
  return st < a.st;
}

bool state::isclear(){
  int cnt =0;
  rep(i,n){
    if      (isicpc[i] &&isgoal[node[i]]==icpcgoal)cnt++;
    else if (!isicpc[i]&&isgoal[node[i]]==acmgoal )cnt++;
  }
  return cnt == n;
}

bool state::isvalid(int ii,int prev,vector<P>&p){
  rep(i,n){
    if (i == ii)continue;
    if (isptable[prev][node[ii]][node[i]])
      return false;
  }
  rep(i,n){
    REP(j,i+1,n){
      if (node[i] == node[j])return false;
      if (isicpc[i] != isicpc[j] &&
	  edge[node[i]][node[j]])return false;
    }
  }
  return true;
}

void state::makest(){
  st=lastmove;
  rep(i,n){
    st=st*18 + node[i];
  }
}

int bfs(int n,state ini,vector<P> &node,int ma){
  queue<state> Q;  
  set<ull> S;
  ini.lastmove=icpc;
  ini.makest();
  Q.push(ini);
  S.insert(ini.st);
  ini.lastmove=acm;
  ini.makest();
  Q.push(ini);
  S.insert(ini.st);
  if (ini.isclear())return 0;

  while(!Q.empty()){
    state now = Q.front();Q.pop();
    int curmove=now.lastmove==icpc?acm:icpc;
    rep(i,now.n){
      if (curmove==icpc && !isicpc[i])continue;
      if (curmove==acm  && isicpc[i])continue;
      rep(j,n){
	if (!edge[now.node[i]][j])continue;
	state next = now;
	next.cnt++;
	next.lastmove=curmove;
	next.node[i]=j;
	if  (!next.isvalid(i,now.node[i],node))continue;
	sort(next.node,next.node+ma);
	sort(next.node+ma,next.node+next.n);
	next.makest();
	if (S.find(next.st) == S.end()){
	  if (next.isclear()){
	    return next.cnt;
	  }
	  S.insert(next.st);
	  Q.push(next);
	}
      }
    }    
  }
  return -1;
}

int getindex(P &a,map<P,int> &M){
  int index = M.size();
  if (M.find(a) == M.end())M[a]=index;
  return M[a];
}

void make_intersection(vector<Line> ver,vector<Line>hor, map<P,int> &M){
  rep(i,ver.size()){
    rep(j,hor.size()){
      if (ver[i].first.imag()  <= hor[j].first.imag() &&
	  ver[i].second.imag() >= hor[j].first.imag() &&
	  hor[j].first.real()  <= ver[i].first.real() &&
	  hor[j].second.real() >= ver[i].first.real()){
	P ins(ver[i].first.real(),hor[j].first.imag());
	getindex(ins,M);
      }
    }
  }
}

void make_graph(vector<P> node,vector<Line> ver,
		map<P,int> M){
  rep(i,ver.size()){
    vector<int> connect;
    rep(j,node.size()){
      if (isptable[M[ver[i].first]][M[ver[i].second]][j]){
	connect.pb(M[node[j]]);
      }
    }
    rep(j,connect.size()){
      REP(k,j+1,connect.size()){
	edge[connect[j]][connect[k]]=edge[connect[k]][connect[j]]=true;
      }
    }
  }
}

main(){
  int n,ma,mi;
  while(cin>>n>>ma>>mi && n){
    rep(i,N){
      rep(j,N)edge[i][j]=false;
      isgoal[i]=els;
    }
    rep(i,N)rep(j,N)rep(k,N)isptable[i][j][k]=false;
    vector<Line> hor,ver;
    map<P,int> M;
    rep(i,n){
      Line ins;
      cin>>ins.first.real()>>ins.first.imag()
	 >>ins.second.real()>>ins.second.imag();
      getindex(ins.first,M);
      getindex(ins.second,M);
      if (ins.second < ins.first)swap(ins.first,ins.second);
      if (ins.first.real() == ins.second.real())ver.pb(ins);
      else hor.pb(ins);
    }
    
    state ini;
    ini.cnt=0;
    ini.n=ma+mi;
    ini.goal=0;
    rep(i,ma){
      P a;
      cin>>a.real()>>a.imag();
      isicpc[i]=false;
      ini.node[i]  =getindex(a,M);
    }
    rep(i,mi){
      P b;
      cin>>b.real()>>b.imag();
      isicpc[ma+i]=true;
      ini.node[ma+i]  =getindex(b,M);
    }

    rep(i,ma){
      P a;
      cin>>a.real()>>a.imag();
      isgoal[getindex(a,M)]=acmgoal;
    }
    rep(j,mi){
      P a;
      cin>>a.real()>>a.imag();
      isgoal[getindex(a,M)]=icpcgoal;
    }

    make_intersection(ver,hor,M);
    map<P,int>::iterator itr = M.begin();
    vector<P> node(M.size());
    while(itr != M.end()){
      node[(*itr).second]=(*itr).first;
      itr++;
    }

    rep(i,node.size()){
      rep(j,node.size()){
	rep(k,node.size()){
	  if (isp(node[i],node[j],node[k]))isptable[i][j][k]=true;
	}
      }            
    }

    make_graph(node,hor,M);
    make_graph(node,ver,M);
    rep(i,ini.n){
      if (      isicpc[i]&&isgoal[ini.node[i]]==icpcgoal)ini.goal++;
      else if (!isicpc[i]&&isgoal[ini.node[i]]==acmgoal )ini.goal++;
    }

    sort(ini.node,ini.node+ma);
    sort(ini.node+ma,ini.node+ini.n);
    cout << bfs(M.size(),ini,node,ma)<<endl;
  }
  return false;
}

Measured memory_bytes: 5028