/* ID: 1292871202 LANG: C++ */ #pragma comment(linker,"/STACK:102400000,102400000") #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; const int MAX = 0x7fffffff; const ll LINF = 0x3f3f3f3f3f3f3f3fLL; const ll LMAX = 0x7fffffffffffffffLL; const double eps = 1e-9; const double pi=acos(-1.0); const int maxn = 100000+5; const int maxm = 100000+5; const int mod = 1e9+7; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 int a[maxn]; int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); //cin.sync_with_stdio(false); //cout.sync_with_stdio(false); int t; cin>>t; while(t--) { int n,k; cin>>n>>k; n--; for(int i=0;i