#include<iostream>
#include<cstring>
using namespace std;
const int N = 11;
bool s[N][N];
int dx[8] = {-2, -1, 1, 2, 2, 1, -1, -2}, dy[8] = {1, 2, 2, 1, -1, -2, -2, -1};
int res = 0;
void dfs(int n, int m, int x, int y, int cnt)
{
cnt++;
if(cnt == n * m)
{
res++;
return ;
}
s[x][y] = true;
for(int i = 0; i < 8; i++)
{
int xi = x + dx[i];
int yi = y + dy[i];
if(xi >= 0 && xi < n && yi >= 0 && yi < m && !s[xi][yi])
{
dfs(n, m, xi, yi, cnt);
}
}
s[x][y] = false;
}
int main()
{
int t;
cin >> t;
while(t--)
{
int n, m, x, y;
memset(s, 0, sizeof(s));
cin >> n >> m >> x >> y;
res = 0;
dfs(n, m, x, y, 0);
cout << res << endl;
}
return 0;
}
你hao