#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int MAX_N = 2000;
int power(int base, int exp) {
int result = 1;
while (exp > 0) {
if (exp % 2 == 1) {
result = (1LL * result * base) % MOD;
}
base = (1LL * base * base) % MOD;
exp /= 2;
}
return result;
}
void precompute_factorials(vector<int>& factorial, vector<int>& inv_factorial, int n) {
factorial[0] = 1;
for (int i = 1; i <= n; ++i) {
factorial[i] = (1LL * factorial[i - 1] * i) % MOD;
}
inv_factorial[n] = power(factorial[n], MOD - 2);
for (int i = n - 1; i >= 0; --i) {
inv_factorial[i] = (1LL * inv_factorial[i + 1] * (i + 1)) % MOD;
}
}
unordered_map<tuple<int, int, int>, ll> memo;
ll dp(int mask, int pos, int a_remaining, int b_remaining, const vector<int>& p1) {
if (pos == p1.size()) {
return (a_remaining == 0 && b_remaining == 0) ? 1 : 0;
}
tuple<int, int, int> state = make_tuple(mask, a_remaining, b_remaining);
if (memo.find(state) != memo.end())
return memo[state];
ll res = 0;
for (int num = 1; num <= p1.size(); num++) {
int bit = num - 1;
if (!(mask & (1 << bit))) {
if (num < p1[pos]) {
if (a_remaining > 0)
res = (res + dp(mask | (1 << bit), pos + 1, a_remaining - 1, b_remaining, p1)) % MOD;
}
else if (num > p1[pos]) {
if (b_remaining > 0)
res = (res + dp(mask | (1 << bit), pos + 1, a_remaining, b_remaining - 1, p1)) % MOD;
}
else {
res = (res + dp(mask | (1 << bit), pos + 1, a_remaining, b_remaining, p1)) % MOD;
}
}
}
return memo[state] = res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n, a, b;
cin >> n >> a >> b;
vector<int> factorial(n + 1), inv_factorial(n + 1);
precompute_factorials(factorial, inv_factorial, n);
vector<int> p1(n);
for (int i = 0; i < n; i++) {
p1[i] = i + 1;
}
memo.clear();
ll answer = dp(0, 0, a, b, p1);
cout << (answer * factorial[n]) % MOD << endl;
}
return 0;
}