#include int main() { int i, j, k, q, Q, N, T, w[10] = {}; scanf("%d", &Q); for (q = 1; q <= Q; q++) { scanf("%d %d", &N, &T); if (T % 2 != 0 && (T < N || (T >= N && (T - N) % 2 != 0))) { printf("No\n"); continue; } else printf("Yes\n"); if (T % 2 == 0) { k = 0; w[1] = T / 2; } else { k = 1; w[1] = (T - N) / 2; } for (i = 1; i <= N; i++) for (j = i + 1; j <= N; j++) printf("%d %d %d\n", i, j, k + w[i] + w[j]); } fflush(stdout); return 0; }