We have an n × n sized checkerboard where every cell of the board is colored either black or white so that no two cells of the same color are adjacent. The board size, n, will always be odd and all the corner cells of the board are black.
We have m identical bishops at the black cells on the board, where m is at most n. We are given the initial and target configuration of the bishops. You have to move the bishops from the initial configuration to the target configuration in at most 4m moves.
In a move a bishop can only move diagonally but not over another bishop. Two bishops can never be on the same cell at the same time.
Input
The input begins with the number of cases T (1 ≤ T ≤ 100). Then T test cases follow.
Every case starts with n (1 ≤ n < 105) and m (1 ≤ m ≤ n) and n is odd. Then follows m lines describing the initial bishop configuration. Next m lines describe the target configuration. Each line of the configuration contains two integers r, c (1 ≤ r, c ≤ n) where they denote the row and column number of the cell a bishop is at.
Sum of n across all cases will not exceed 105.
No two bishops in the initial configurations will be in the same cell. Same goes for the target configuration.
Output
For each case, output the case number and the number of moves denoted by k. Next k lines contain 4 integers r1, c1, r2, c2 (1 ≤ r1, c1, r2, c2 ≤ n) meaning a bishop is moved from r1, c1 position to r2, c2 position (they can be same cell as well). Check the Sample input/output for further details. Also please be careful with the output format. Unintended whitespaces might cause a wrong answer. You may assume that an answer always exists.
Sample
Sample Input | Sample Output |
---|---|
2 5 2 1 3 5 3 3 1 3 5 1 1 1 1 1 1 | Case 1: 2 1 3 3 5 5 3 3 1 Case 2: 0 |