#include using namespace std; #define pb push_back #define mp make_pair #define ALL(x) (x).begin(),(x).end() typedef long long ll; typedef pair pii; const int maxn = 3e5 + 70; const int INF = 0x3f3f3f3f; const ll inf = 0x3f3f3f3f3f3f3f3f; const int MOD = 1e9 + 7; const double eps = 1e-7; const double PI = acos(-1.0); int n, m, k; char s[21][51], t[21][51]; int p[51]; bool solve(int d, vector& a, vector& b){ if(d==n+1){ for(int i=0;i a2[26], b2[26]; for(int i=0;i>T; while(T--){ scanf("%d %d",&n,&m); for(int i=1;i<=n;i++){ scanf("%s",s[i]+1); scanf("%s",t[i]+1); } vector a(m), b(m); for(int i=0;i1) putchar(' '); printf("%d",p[i]); } printf("\n"); } else printf("-1\n"); } return 0; }