Domino Swap
시간 제한4초메모리 제한1024 MB
같은 색인 인접한 두 칸의 색을 맞바꾸는 연산만으로 시작 격자를 목표 격자로 바꾸거나, 불가능하다고 판정한다.
문제
There is an by grid of black and white squares. In one operation, you can pick any two adjacent squares of the same color and swap the colors of both. For example, here is a valid sequence of two operations on a grid with , :

You are also given a target grid of by black and white squares. Perform at most operations on the starting grid to reach the target grid, or state that it is impossible to do so. You do not need to minimize the number of operations.
It can be shown that if there is a solution, there is one that uses at most operations.
입력
The first line of the input contains a single integer () --- the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers and () --- the number of rows and columns in the grid, respectively.
The -th of the next lines contains characters describing the -th row of the starting grid. The -th of these is '\#' if the square at position is black, and '.' if the square at position is white.
The next lines describe the target grid in the same format as the starting grid.
It is guaranteed that the sum of over all test cases does not exceed .
출력
For each test case, if there is no solution, output a single integer .
Otherwise, the first line of output for each test case should contain a single integer () --- the number of operations you will perform.
The next lines of output should each contain four integers , , , and (, ) --- the two adjacent squares and that are part of this operation.
If there are multiple solutions, print any.
힌트
Here is the sequence of operations described by the output of the first test case:

It is impossible to perform any operations in the second test case, so it is not possible to reach the target grid.