#include<iostream> #include<map> using namespace std; int main(){ int k,t,n,m,arr[510][510]; map<int,int>maps; cin>>t; while(t--){ cin>>n>>m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>k; maps[k]=j; } } for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ cin>>k; arr[j][maps[k]]=k; } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cout<<arr[i][j]<<" "; }cout<<endl; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)