#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>
using namespace std;
const int MAX_N = 100;
bool solve(int n, int target_a, int target_b, vector<int> &p1, vector<int> &p2)
{
bitset<MAX_N + 1> used1, used2;
vector<int> p1_wins(n, 0), p2_wins(n, 0);
function<bool(int)> backtrack = [&](int pos) -> bool
{
if (pos == n)
{
return accumulate(p1_wins.begin(), p1_wins.end(), 0) == target_a &&
accumulate(p2_wins.begin(), p2_wins.end(), 0) == target_b;
}
for (int i = 1; i <= n; ++i)
{
if (!used1[i])
{
p1[pos] = i;
used1[i] = true;
for (int j = 1; j <= n; ++j)
{
if (!used2[j])
{
p2[pos] = j;
used2[j] = true;
if (i > j)
p1_wins[pos] = 1;
else if (i < j)
p2_wins[pos] = 1;
if (backtrack(pos + 1))
return true;
used2[j] = false;
p1_wins[pos] = p2_wins[pos] = 0;
}
}
used1[i] = false;
}
}
return false;
};
return backtrack(0);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
{
int n, a, b;
cin >> n >> a >> b;
vector<int> p1(n), p2(n);
bool possible = solve(n, a, b, p1, p2);
if (!possible)
{
cout << "NO\n";
}
else
{
cout << "YES\n";
for (int x : p1)
cout << x << ' ';
cout << '\n';
for (int x : p2)
cout << x << ' ';
cout << '\n';
}
}
return 0;
}