原题
#include<iostream>
#include<algorithm>
using namespace std;
int m,n,k,l,d,x1,x2,y1,y2;
struct sz{
int w;int p;
};
sz a[1010],b[1010];
bool cmp(const sz& a,const sz& b)
{
if (a.p==b.p) return a.w<b.w;
return a.p>b.p;
}
int main(){
cin>>m>>n>>k>>l>>d;
for(int i=0;i<d;i++){
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
if(x1==x2) a[min(y1,y2)].p++;
else b[min(x1,x2)].p++;
}
for(int i=1;i<=n;i++)a[i].w=i;
for(int i=1;i<=m;i++)b[i].w=i;
sort(a+1,a+n+1,cmp);sort(b+1,b+m+1,cmp);
for(int i=1;i<=k;i++){
cout<<b[i].w<<" ";
}
cout<<endl;
for(int i=1;i<=l;i++){
cout<<a[i].w<<" ";
}
return 0;
}