#include using namespace std; typedef long long ll; typedef pair P; #define REP(i,n) for(int i=0;i> N >> K; vector

a(N+1),c(2*N+1),e(N+1); vector b(N+1),d(2*N+1),f(N+1); for(i=1;i<=6;i++){ if(i==1){ for(j=1;j<=N;j++){ int x; cin >> x; a[j].first=x; a[j].second=j; } } if(i==2){ for(j=1;j<=N;j++){ int x; cin >> x; b[j]=x; } } if(i==3){ for(j=1;j<=2*N;j++){ int x; cin >> x; c[j].first=x; c[j].second=j; } } if(i==4){ for(j=1;j<=2*N;j++){ int x; cin >> x; d[j]=x; } } if(i==5){ for(j=1;j<=N;j++){ int x; cin >> x; e[j].first=x; e[j].second=j; } } if(i==6){ for(j=1;j<=N;j++){ int x; cin >> x; f[j]=x; } } } sort(a.begin(),a.end()); sort(c.begin(),c.end()); sort(e.begin(),e.end()); int r=0; vector

aa=a,cc=c,ee=e; vector u,v,w,x; for(i=1;i<=N;i++){ bool f=false; for(j=1;j<=N;j++){ if(aa[j].first==-1) continue; vector t; for(k=1;k<=2*N;k++){ if(cc[k].first==-1) continue; if(ee[i].first