Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×
J. Jigsaw Jumble
time limit per test
4 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Example
Input
2
4 4
3 1
4 2
3 4
1 2
4 4
3 1
4 2
3 4
1 2
Output
OK
2 2
2 4
1 3
OK
2 2
3 4
1 2