#include"cstdio" #include"queue" #include"cmath" #include"stack" #include"iostream" #include"algorithm" #include"cstring" #include"queue" #include"map" #include"set" #include"vector" #define LL long long #define mems(a,b) memset(a,b,sizeof(a)) #define ls pos<<1 #define rs pos<<1|1 using namespace std; const int N = 1e3+5; const int MOD = 1e9+7; const int INF = 0x3f3f3f3f; int T,n,m,p=1; set s; int ip[N]; int main(){ scanf("%d",&T); while(T--){ scanf("%d%d",&n,&m); for(int i=0;i