#1037. [Sdoi2013]escape

[Sdoi2013]escape

Description

image

Format

Input

image

Output

image

Samples

2
4
10 10 5 5
5 6
3 5
7 5
5 3
17
14 12 7 6
7 11
6 9
7 7
1 10
2 20
1 6
2 6
1 1
2 2
5 1
5 2
13 1
12 2
12 7
13 7
12 11
13 11
1
2

Limitation

image