VK Cup 2012 Wild-card Round 2


A. Placing Rectangles
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
30 40
5
5 10
12 4
10 11
6 10
4 9
Output
27.5 0.0 30.0 5.0
-1 -1 -1 -1
15.5 0.0 25.5 11.0
7.4 11.0 27.4 23.0
3.4 11.0 7.4 20.0
Input
41 48
34
36 7
15 26
33 28
31 5
29 10
5 39
5 43
35 8
21 13
8 43
7 27
34 7
19 10
9 39
29 17
12 38
30 14
9 5
41 36
41 25
31 37
31 8
32 29
7 39
21 9
6 35
31 9
7 43
36 5
20 39
18 8
14 5
8 32
8 39
Output
Not available
Input
72 84
29
9 78
51 10
10 77
14 81
18 60
27 13
10 16
21 35
29 69
12 80
22 67
58 40
41 19
11 47
25 64
10 28
9 60
8 52
40 71
15 25
41 12
11 59
11 83
8 36
8 48
27 55
9 58
27 52
61 20
Output
Not available
----------------------------------------------------------------------------------------------------
