//
// main.cpp
// cpp
//
// Created by Fatih Meric Koc on 28.10.2024.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void solve_game(int t, vector<tuple<int, int, int>> test_cases) {
for (const auto& [n, a, b] : test_cases) {
if (a + b > n) {
cout << "NO" << endl;
continue;
}
vector<int> player1(n), player2(n);
for (int i = 0; i < n; ++i) {
player1[i] = i + 1;
player2[i] = i + 1;
}
sort(player1.begin(), player1.end());
sort(player2.rbegin(), player2.rend());
int a_count = a, b_count = b;
for (int i = 0; i < n; ++i) {
if (a_count > 0 && player1[i] < player2[i]) {
--a_count;
} else if (b_count > 0 && player1[i] > player2[i]) {
--b_count;
} else {
player2[i] = player1[i];
}
}
cout << "YES" << endl;
for (int i = 0; i < n; ++i) {
cout << player1[i] << " ";
}
cout << endl;
for (int i = 0; i < n; ++i) {
cout << player2[i] << " ";
}
cout << endl;
}
}
int main() {
int t;
cin >> t;
vector<tuple<int, int, int>> test_cases(t);
for (int i = 0; i < t; ++i) {
int n, a, b;
cin >> n >> a >> b;
test_cases[i] = make_tuple(n, a, b);
}
solve_game(t, test_cases);
return 0;
}