#D4892. Shortest Bridge

    ID: 4066 Type: Default 5000ms 536MiB

Shortest Bridge

Shortest Bridge

Example

Input

200 500 800 500 3 400 0 450 500 400 1000 3 600 0 550 500 600 1000

Output

100 600

inputFormat

Input

200 500 800 500 3 400 0 450 500 400 1000 3 600 0 550 500 600 1000

outputFormat

Output

100 600

样例

200 500 800 500
3
400 0
450 500
400 1000
3
600 0
550 500
600 1000
100 600