A number puzzle asks you to connect equal marked numbers on a grid with a single unbroken line. In this problem the grid has the digit 1 written in exactly two distinct cells, and you must decide whether a line satisfying all of the following rules can be drawn.
Equivalently, treat every cell as a vertex and join two cells that are adjacent up, down, left, or right. The question is whether a path that starts at one 1, ends at the other, and visits every cell exactly once exists.
The grid has size m×n, where both m and n are even.
The first line contains the number of test cases T.
Each test case consists of three lines. The first line contains the number of rows m and the number of columns n, separated by a space (2≤m,n≤100; both m and n are even). The second line gives the position of the first 1 as a row i and a column j, and the third line gives the position of the second 1 as a row a and a column b (1≤i,a≤m, 1≤j,b≤n). The two positions are different.
For each test case, print 1 if such a line can be drawn, or −1 if it cannot, on its own line.