#include <iostream>
#include <string>
using namespace std;

int board[32][32];
bool myDiff[64];
int n, noGood;
int BADi, BADj;

/*
   works up to 15, but should just put 13 on judge
 */
int backtrack(int k) {
  if (k >= 2*n - 1) {
    return 1;
  }
  if (k == noGood)
    return backtrack(k+2);
  else {
    int ret = 0;
    for(int i = (0 >? k-n+1); i <= k && i < n; i++) {
      int j = k - i;
      if (i < n && j < n)
        if (!myDiff[i-j+32])
          if (! (i == BADi && j == BADj)) {
            board[i][j] = 1;
            myDiff[i-j+32] = true;

            ret += backtrack(k+2);

            board[i][j] = 0;
            myDiff[i-j+32] = false;
          }
    }
    return ret;
  }
}

int main() {
  int nc; cin >> nc;
  while(nc--) {
    cin >> n >> BADi >> BADj;
    memset(board, 0, sizeof(board));
    memset(myDiff, 0, sizeof(myDiff));
    int totalW = 0;
    noGood = 0; totalW += backtrack(0);
    noGood = 2*n-2; totalW += backtrack(0);
    int totalB = 0;
    totalB += backtrack(1);
    cout << totalW * totalB << endl;
  }
  return 0;
}

