There's a game called Rune Master Puzzle in iPhone. It's a match puzzle game.
You can swap adjacent Rune Stones in all 8 directions, that's legal. Otherwise, it's illegal.
4 or more Rune Stones in a line(in all 8 directions) is called a Match. We don't consider about the Double and Triple.
Your task is to tell me whether one swap is legal. If it's legal, you should tell me whether it's a Match.
This problem contains several cases.
The first line is an integer T, indicates the number of cases.
Then follow T cases.
Each case has a matrix that 5 * 7. Including only 'Y' (Yellow), 'G' (Green), 'B' (Blue), 'R' (Red), 'P' (Purple).
Then follows a single line formatted as '(x1, y1) (x2, y2)', indicates that the player wants to swap (x1, y1) with (x2, y2). (0 < x1, x2 < 5, 0 < y1, y2 < 7).
For each case, you should output the result.
'Illegal', 'No Match' or 'Match'.