#include <bits/stdc++.h>
using namespace std;
const int N = 12;
bool st[N][N];
int T,m,n,x,y;
int dx[] = {-2,-1,1,2,2,1,-1,-2};
int dy[] = {1,2,2,1,-1,-2,-2,-1};
int ans = 0;
void dfs(int x,int y,int cnt)
{
if ( cnt == n * m )//只有在全部覆盖满的时候答案才加一,即这个搜索树的叶子结点
{
ans++;
return;
}
st[x][y] = 1;
for ( int i = 0;i < 8;i++ )
{
int a = x + dx[i],b = y + dy[i];
if ( a < 0 || a >= m || b < 0 || b >= n ) continue;
if ( st[a][b] ) continue;
dfs(a,b,cnt + 1);
}
st[x][y] = 0;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> T;
while(T--)
{
memset(st,0,sizeof st);
ans = 0;
cin >> m >> n >> x >> y;
dfs(x,y,1);
cout << ans << '\n';
}
return 0;
}