#t350. 马走日
马走日
The Knight's Tour
Problem Background
Special for beginners, ^_^
Problem Description
In Chinese chess, the knight moves in an "L" shape (日字形).
Write a program that, given an board and the knight's starting position , computes how many paths allow the knight to traverse every point on the board without revisiting the same point.
Input Format
The first line is an integer , the number of test cases.
Each test case contains one line of four integers: the board size and the starting coordinates $n, m, x, y\;(0\le x\le n-1,\;0\le y\le m-1,\;m\le 5,\;n\le 5)$.
Output Format
For each test case, output one line with one integer: the total number of paths by which the knight can traverse the board; means it cannot be traversed.
Sample Input
1
5 4 0 0
Sample Output
32
Constraints
1s, 1024KiB for each test case.