#include <bits/stdc++.h>

#define int long long

#define fileopen(a, b) freopen(((std::string)a + ".inp").c_str(), "r", stdin); freopen(((std::string)b + ".out").c_str(), "w", stdout);
#define fileopen1(a) freopen(((std::string)a + ".inp").c_str(), "r", stdin); freopen(((std::string)a + ".out").c_str(), "w", stdout);

#ifdef PICHU_LOCAL_DEF
	#include <chrono>
#endif


using namespace std;

const int MAXN = 3e5 + 5;

int n, q;
int a[MAXN], IT[MAXN << 2], lazy[MAXN << 2];

void upd(int i, int val, int id = 1, int l = 1, int r = n) {
	if (r < i || l > i) return;
	if (l == r) {
		IT[id] = val;
		return;
	}

	int mid = l + r >> 1;

	upd(i, val, id << 1, l, mid);
	upd(i, val, id << 1 | 1, mid + 1, r);

	IT[id] = IT[id << 1] ^ IT[id << 1 | 1];
}

int sum(int u, int v, int id = 1, int l = 1, int r = n) {
	if (r < u || l > v) return 0;
	if (l >= u && r <= v) return IT[id];

	int mid = l + r >> 1;

	return sum(u, v, id << 1, l, mid) ^ sum(u, v, id << 1 | 1, mid + 1, r);
}

signed main() {
	#ifdef PICHU_LOCAL_DEF
		chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
	#endif

	#ifndef PICHU_LOCAL_DEF
		// fileopen1("LAH");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	cin >> n >> q;
	for (int i = 1; i <= n; i++) cin >> a[i], upd(i, a[i]);

	while (q--) {
		int t, x, y;
		cin >> t >> x >> y;
		if (t == 1) {
			a[x] ^= y;
			upd(x, a[x]);
		}
		else cout << sum(x, y) << '\n';
	}

	#ifdef PICHU_LOCAL_DEF
		chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
		std::cout << std::endl;
		std::cout << "Time difference = " << chrono::duration_cast<chrono::milliseconds> (end - begin).count() << "[ms]" << std::endl;
	#endif
}

#include<algorithm>
#include<cstdio>
#define rg register
#define ri rg int
#define defrog(A...) fprintf(stderr,A)

#define getchar() (p1==p2&&(p2=(p1=ibuf)+fread(ibuf,1,1<<15,stdin),p1==p2)?EOF:*p1++)
char ibuf[1<<15],*p1,*p2;
struct{
	inline operator int(){rg char c,f=0;while((c=getchar())<48||c>57)f|=c=='-';ri unsigned a=c&15;while((c=getchar())>=48&&c<=57)a=a*10+(c&15);return f?~a+1:a;}
	
}g90;

const int N=505,M=250250;
int p[N],a[M];

main(){
	for(int T=g90;T--;){
		int n=g90,m=0;
		for(int i=1;i<=n;i++)p[i]=g90;
		for(;;){
			++m;
			int flag=1;
			int pos=n-1;
			while(pos&&(p[pos]<=p[pos+1]||(pos^m)&1)){if(p[pos]>p[pos+1])flag=0;pos--;}
			if(!pos&&flag)break;
			if(!pos){
				if(m&1)pos=1;
				else pos=2;
			}
			std::swap(p[pos],p[pos+1]);
			a[m]=pos;
		}
		--m;
		printf("%d\n",m);
		for(int i=1;i<=m;i++)printf("%d ",a[i]);
		puts("");
	}
}