#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;
}#include <iostream>
#include <algorithm>
using namespace std;
struct edge{
int num;
int sum;
};
bool cmp1(edge a,edge b){
return a.sum > b.sum;
}
bool cmp2(edge a,edge b){
return a.num < b.num;
}
edge row[2001];
edge col[2001];
int main(){
int M,N,K,L,D;
while(cin >> M ){
cin >> N >> K >> L >> D;
int i;
for(i = 0;i < M;i++){
row[i].num = i + 1;
row[i].sum = 0;
}
for(i = 0;i < N;i++){
col[i].num = i + 1;
col[i].sum = 0;
}
for(i = 0;i < D;i++){
int a,b,x,y;
cin >> a >> b >> x >> y;
if(a == x){
col[min(b,y) - 1].sum++;;
}
if(b == y){
row[min(a,x) - 1].sum++;
}
}
sort(row,row+M,cmp1);
sort(col,col+N,cmp1);
sort(row,row+K,cmp2);
sort(col,col+L,cmp2);
for(i = 0;i < K;i++){
if(i != K - 1)
cout << row[i].num << ' ';
else
cout << row[i].num;
}
cout << endl;