#include<bits/stdc++.h>
using namespace std;
int m,n;
int k,l;
int d;
struct student{
int pos;
int num;
}row[1009],col[1009];
bool cmp(student s1,student s2)
{
return s1.num>s2.num;
}
bool cmp1(student s1,student s2)
{
return s1.pos>s2.pos;
}
int main()
{
cin>>m>>n;
cin>>k>>l;
cin>>d;
while(d--)
{
int tx,ty,ex,ey;
cin>>tx>>ty>>ex>>ey;
if(ty==ey)
{
int xf=min(tx,ex);
row[xf].pos=xf;
row[xf].num+=1;
}
else if(tx==ex)
{
int xf=min(ty,ey);
col[xf].pos=xf;
col[xf].num+=1;
}
}
sort(row+1,row+m,cmp);
sort(col+1,row+n,cmp);
sort(row+1,row+k+1,cmp1);
sort(col+1,row+l+1,cmp1);
for(int i=1;i<=k;i++)
cout<<row[i].pos<<" ";
cout<<endl;
for(int i=1;i<=l;i++)
cout<<col[i].pos<<" ";
return 0;
}
请大佬看看