C. Cat-And-Tree
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Example
Input
10 8 6
3 8
7 3
9 8
6 8
5 9
4 8
2 7
1 6
0 2
6 7 6 4 5 4 7 5 6 6
6 8
2 3
0 3
3 7
5 3
2 4
Output
0
10
10
10
0
10