#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define puba(a) emplace_back((a))
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,S[200001],T[200001];
	ll W,P[200001];
	ll imos[200002]={};
	scan(N>>W);
	rep(i,N){
		scan(S[i]>>T[i]>>P[i]);
		imos[S[i]]+=P[i];
		imos[T[i]]-=P[i];
	}
	ll maximos=0;
	rep(i,200002){
		if(i>0) imos[i]+=imos[i-1];
		chmax(maximos,imos[i]);
	}
	if(maximos<=W) prin("Yes");
	else prin("No");
	return 0;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define li long long
#define pii pair<int, int>
#define vi vector<int>
#define li long long

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

int main() {
	int tests;
	scanf("%d", &tests);
	forn(test, tests) {
		int n;
		scanf("%d", &n);
		vi start(n);
		forn(i, n) {
			scanf("%d", &start[i]);
		}
		while(true) {
			vi a = start;
			vi turns;
			while(true) {
				bool sorted = true;
				forn(i, n - 1)  {
					if (a[i] > a[i + 1]) {
						sorted = false;
						break;
					}
				}
				if (sorted) {
					break;
				}
				// forn(i, n) {
				// 	printf("%d ", a[i]);
				// }
				// printf("\n");
				/*if (turns.size() == 2) {
					break;
				}*/
				int turn = turns.size() % 2;
				bool found = false;
				for (int i = turn; i + 1 < n; i += 2) {
					if (a[i] > a[i + 1]) {
						swap(a[i], a[i + 1]);
						turns.pb(i);
						found = true;
						break;
					}
				}
				if (!found) {
					while(true) {
						int pos = rand() % (n - 1);
						if (pos % 2 == turn) {
							swap(a[pos], a[pos + 1]);
							turns.pb(pos);
							break;
						}
					}
				}
			}
			if (turns.size() <= n * n) {
				printf("%d\n", (int)turns.size());
				for (int x: turns) {
					printf("%d ", x + 1);
				}
				printf("\n");
				break;
			}
		}
	}
}