# Include <iostream>
# Include <cstdio>
# Include <cstring>
Using namespace STD;
Long long DP [12] [3000];
// 0 indicates the upper part of the horizontal or vertical column. 1 indicates the lower part of the vertical column. Each row is a binary number (<2048)
Int main ()
{
Long long H, W, ANS, I, J, K, tmp1, tmp2, L, C, Cs;
Scanf ("% LLD", & CS );
While (Cs --)
{
Scanf ("% LLD", & H, & W );
If (H * W & 1) {printf ("0 \ n"); continue ;}
If (W> H) {tmp1 = H; H = W; W = tmp1;} // H * 2 ^ W, So let W be the smaller one.
Memset (DP, 0, sizeof (DP ));
Tmp1 = W; L = 1; while (tmp1 --) L * = 2;
For (I = 0; I <L; I ++)
{// Obtain the possible conditions of the first line and assign a value of 1
Tmp1 = I; C = W;
While (c)
{
If (tmp1 & 1) tmp1> = 1, C --;
Else if (tmp1 & 3) break;
Else if (C <2) break;
Else tmp1> = 2, c-= 2;
}
If (! C) DP [0] [I] = 1;
}
For (I = 1; I
{// Recursive Addition
For (j = 0; j <L; j ++)
{// Adds the compatibility status of the underlying layer to each status of each row
For (k = 0; k <L; k ++)
{// Search for the status of integration and Increment
Tmp1 = J; tmp2 = K; C = W;
While (c)
{
If (tmp2 & 1)
{
If (tmp1 & 1) break;
Else tmp1> = 1, tmp2> = 1, C --;
}
Else
{
If (tmp1 & 1) tmp1> = 1, tmp2> = 1, C --;
Else if (C <2 | (tmp1 & 3) | (tmp2 & 3) break;
Else tmp1> = 2, tmp2> = 2, c-= 2;
}
}
If (! C) DP [I] [J] + = DP [I-1] [k];
}
If (I = h-1) break; // The top layer must all be 0, and the result is found to be 0.
}
}
Printf ("% LLD \ n", DP [h-1] [0]);
}
Return 0;
}