QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#310235#509. Birthday giftjasper166100 ✓495ms122240kbC++173.1kb2024-01-21 09:30:242024-01-21 09:30:24

Judging History

你现在查看的是最新测评结果

  • [2024-01-21 09:30:24]
  • 评测
  • 测评结果:100
  • 用时:495ms
  • 内存:122240kb
  • [2024-01-21 09:30:24]
  • 提交

answer

#include "bits/stdc++.h"
// @JASPER'S BOILERPLATE
using namespace std;
using ll = long long;

#ifdef JASPER
#include "debug.h"
#else
#define debug(...) 166
#endif

const int N = 2e5 + 5;
const int K = 20;

int n, m, q;
int a[N];
vector <int> adj[N];
// Euler-tour LCA
int tin[N], dep[N], tree[N << 1], lg[N << 1];
pair <int, int> up[K][N << 1];
int timer = 0;

void dfs(int u, int p) {
    tree[++timer] = u;
    tin[u] = timer;
    for (int v : adj[u]) {
        if (v ^ p) {
            dep[v] = dep[u] + 1;
            dfs(v, u);
            tree[++timer] = u;
        }
    }
}
void prepare() {
    dfs(1, 0);

    lg[1] = 0;
    for (int i = 2; i <= timer; ++i) lg[i] = lg[i / 2] + 1;
    for (int i = 1; i <= timer; ++i)
        up[0][i] = {dep[tree[i]], tree[i]};
    for (int k = 1; k < K; ++k) {
        int step = 1 << (k - 1);
        for (int i = 1; i + step <= timer; ++i)
            up[k][i] = min(up[k - 1][i], up[k - 1][i + step]);
    }
}
int lca(int u, int v) {
    int l = tin[u], r = tin[v];
    if (l > r) swap(l, r);
    int k = lg[r - l + 1];
    return min(up[k][l], up[k][r - (1 << k) + 1]).second;
}
// End of LCA

set <int> same[N], diff[N];
signed main() {
    cin.tie(0) -> sync_with_stdio(0);
    
    cin >> n >> m >> q;
    for (int i = 1; i < n; ++i) {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    prepare();
    for (int i = 1; i <= m; ++i) cin >> a[i]; 

    for (int i = 1; i <= m; ++i)
        same[a[i]].insert(i);
    for (int i = 1; i < m; ++i) {
        int p = lca(a[i], a[i + 1]);
        diff[p].insert(i);
    }

    for (int _q = 1; _q <= q; ++_q) {
        int cmd, x, y, u;
        cin >> cmd >> x >> y;

        // debug(cmd, x, y);
        if (cmd == 1) {
            same[a[x]].erase(x);
            if (2 <= x) {
                int p = lca(a[x], a[x - 1]);
                diff[p].erase(x - 1);
            }
            if (x < m) {
                int p = lca(a[x], a[x + 1]);
                diff[p].erase(x);
            }
            
            a[x] = y;

            same[a[x]].insert(x);
            if (2 <= x) {
                int p = lca(a[x], a[x - 1]);
                diff[p].insert(x - 1);
            }
            if (x < m) {
                int p = lca(a[x], a[x + 1]);
                diff[p].insert(x);
            }
        }
        else {
            cin >> u;   
            // debug(u, ":", same[u], ":", diff[u]);
            pair <int, int> ans = {-1, -1};
            // On the same branch
            auto it_s = same[u].lower_bound(x);
            // On two separated branch
            auto it_d = diff[u].lower_bound(x);
            if (it_s != same[u].end() && *it_s <= y) {
                ans = make_pair(*it_s, *it_s);
            }
            else if (it_d != diff[u].end() && *it_d + 1 <= y) {
                ans = make_pair(*it_d, *it_d + 1);
            }
            cout << ans.first << " " << ans.second << "\n";
        }
    }  
}



Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 0ms
memory: 27088kb

input:

5 4 4
1 2
3 1
3 4
5 3
4 5 2 3
2 1 3 1
1 3 5
2 3 4 5
2 1 3 1

output:

2 3
3 3
-1 -1

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 4ms
memory: 27144kb

input:

100 100 100
17 24
56 46
90 76
6 10
85 51
13 29
63 58
79 68
44 3
9 13
62 100
30 74
6 28
70 59
59 43
19 20
87 76
81 75
67 82
42 33
91 46
59 68
6 25
56 60
7 31
21 32
94 67
20 39
28 50
8 5
88 76
64 28
1 27
6 21
47 73
62 16
53 51
83 65
93 76
92 61
35 43
14 15
58 61
33 9
38 16
72 25
34 76
3 7
17 16
5 16
4...

output:

77 77
-1 -1
28 28
49 49
-1 -1
-1 -1
-1 -1
62 63
54 55
22 23
47 47
48 48
-1 -1
6 6
44 45
26 26
57 57
-1 -1
26 26
-1 -1
-1 -1
91 91
-1 -1
43 44
-1 -1
-1 -1
-1 -1
-1 -1
24 25
93 93
-1 -1
15 16
91 91
63 63
44 45
-1 -1
30 30
16 17
-1 -1
11 12
36 36
34 35
37 37
23 24
-1 -1
-1 -1
-1 -1
6 7
59 59
70 70
44 45

result:

ok 51 lines

Test #3:

score: 0
Accepted
time: 8ms
memory: 27116kb

input:

100 100 100
8 13
44 33
3 10
33 81
83 71
3 1
51 44
57 9
95 67
47 42
74 94
38 56
44 68
33 7
54 75
29 42
58 23
2 8
49 77
49 92
30 9
11 60
86 71
13 17
100 54
89 61
14 18
9 5
21 19
60 84
82 71
98 49
2 37
1 50
34 8
42 45
93 88
2 1
6 7
11 48
20 3
18 64
16 3
22 2
4 3
51 55
72 70
13 46
19 54
94 97
2 6
2 5
31...

output:

-1 -1
16 17
1 2
60 60
34 35
82 83
24 25
52 53
62 63
77 77
16 17
28 29
-1 -1
13 14
95 96
-1 -1
-1 -1
-1 -1
34 35
23 24
3 3
13 14
21 22
45 45
34 34
46 47
-1 -1
11 12
43 44
-1 -1
40 41
50 50
13 13
52 53
-1 -1
11 12
48 49
75 76
18 19
27 28
13 14
-1 -1
1 2
47 47
34 34
-1 -1
27 28
27 28
13 14
63 63
6 7
11...

result:

ok 57 lines

Test #4:

score: 0
Accepted
time: 4ms
memory: 27156kb

input:

100 100 100
17 24
56 46
90 76
6 10
85 51
13 29
63 58
79 68
44 3
9 13
62 100
30 74
6 28
70 59
59 43
19 20
87 76
81 75
67 82
42 33
91 46
59 68
6 25
56 60
7 31
21 32
94 67
20 39
28 50
8 5
88 76
64 28
1 27
6 21
47 73
62 16
53 51
83 65
93 76
92 61
35 43
14 15
58 61
33 9
38 16
72 25
34 76
3 7
17 16
5 16
4...

output:

49 49
6 6
93 94
28 28
83 84
47 47
6 6
54 55
50 50
41 41
37 38
7 7
41 41
47 48
44 45
41 41
8 9
47 48
49 49
41 41
54 55
18 18
7 7
61 62
99 100
8 9
11 12
41 41
49 49
24 25
27 28
36 37
2 3
4 5
5 6
91 91
10 11
45 46
9 10
4 5
47 47
9 10
25 26
16 17

result:

ok 44 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 27128kb

input:

100 100 100
23 16
38 29
19 31
29 68
36 32
7 28
27 72
3 2
96 49
79 42
5 6
62 87
88 66
41 34
5 10
88 97
2 35
71 49
52 17
60 54
51 11
56 46
81 49
11 9
13 8
31 76
10 14
99 58
95 78
5 3
16 9
4 2
9 12
22 11
10 17
100 50
86 56
43 57
50 14
9 18
30 49
82 72
6 8
3 44
14 26
2 30
70 53
38 39
28 61
43 8
24 18
64...

output:

67 67
37 38
14 14
77 78
31 31
20 21
67 67
33 33
67 67
12 12
24 25
14 14
17 18
93 94
67 67
27 27
67 67
12 12
82 83
67 67
15 15
17 18
13 13
19 20
12 12
23 23
1 2
12 12
14 15
84 84
67 67
22 23
84 84
37 38
67 67
33 34
20 21
84 84
84 84
37 38
31 32
17 18
84 84
67 67
84 84
23 23
67 67
1 2
12 12
12 12
23 2...

result:

ok 54 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 27136kb

input:

100 100 100
27 20
65 66
19 41
88 53
70 71
11 8
99 98
93 100
19 8
9 24
68 54
46 38
74 60
6 47
9 28
5 7
9 31
87 73
90 83
4 5
26 20
48 26
26 39
50 14
20 19
51 52
59 84
9 17
57 62
54 56
34 10
33 40
12 16
91 70
33 16
18 17
67 78
65 73
56 70
25 4
12 4
2 4
96 85
1 2
65 77
59 64
53 63
79 58
97 78
75 65
80 9...

output:

49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
...

result:

ok 100 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 27216kb

input:

100 100 100
2 4
3 2
1 51
67 64
84 67
49 20
35 39
58 79
42 41
13 17
56 76
5 4
43 9
70 56
54 66
8 28
1 2
14 12
53 90
12 21
12 15
85 51
20 13
62 55
69 55
95 54
59 55
99 76
98 85
69 87
69 75
32 30
26 19
61 57
68 55
71 57
52 53
45 20
11 46
82 52
44 37
5 7
37 25
14 25
10 31
48 15
70 89
13 18
52 57
56 86
5...

output:

49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
...

result:

ok 100 lines

Test #8:

score: 0
Accepted
time: 3ms
memory: 27148kb

input:

100 100 100
27 20
65 66
19 41
88 53
70 71
11 8
99 98
93 100
19 8
9 24
68 54
46 38
74 60
6 47
9 28
5 7
9 31
87 73
90 83
4 5
26 20
48 26
26 39
50 14
20 19
51 52
59 84
9 17
57 62
54 56
34 10
33 40
12 16
91 70
33 16
18 17
67 78
65 73
56 70
25 4
12 4
2 4
96 85
1 2
65 77
59 64
53 63
79 58
97 78
75 65
80 9...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 100 lines

Test #9:

score: 0
Accepted
time: 7ms
memory: 27092kb

input:

100 100 100
2 4
3 2
1 51
67 64
84 67
49 20
35 39
58 79
42 41
13 17
56 76
5 4
43 9
70 56
54 66
8 28
1 2
14 12
53 90
12 21
12 15
85 51
20 13
62 55
69 55
95 54
59 55
99 76
98 85
69 87
69 75
32 30
26 19
61 57
68 55
71 57
52 53
45 20
11 46
82 52
44 37
5 7
37 25
14 25
10 31
48 15
70 89
13 18
52 57
56 86
5...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 100 lines

Test #10:

score: 0
Accepted
time: 3ms
memory: 27136kb

input:

100 100 100
27 20
65 66
19 41
88 53
70 71
11 8
99 98
93 100
19 8
9 24
68 54
46 38
74 60
6 47
9 28
5 7
9 31
87 73
90 83
4 5
26 20
48 26
26 39
50 14
20 19
51 52
59 84
9 17
57 62
54 56
34 10
33 40
12 16
91 70
33 16
18 17
67 78
65 73
56 70
25 4
12 4
2 4
96 85
1 2
65 77
59 64
53 63
79 58
97 78
75 65
80 9...

output:

49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
...

result:

ok 52 lines

Test #11:

score: 0
Accepted
time: 4ms
memory: 27152kb

input:

100 100 100
2 4
3 2
1 51
67 64
84 67
49 20
35 39
58 79
42 41
13 17
56 76
5 4
43 9
70 56
54 66
8 28
1 2
14 12
53 90
12 21
12 15
85 51
20 13
62 55
69 55
95 54
59 55
99 76
98 85
69 87
69 75
32 30
26 19
61 57
68 55
71 57
52 53
45 20
11 46
82 52
44 37
5 7
37 25
14 25
10 31
48 15
70 89
13 18
52 57
56 86
5...

output:

49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
...

result:

ok 51 lines

Test #12:

score: 0
Accepted
time: 0ms
memory: 27204kb

input:

100 100 100
17 24
56 46
90 76
6 10
85 51
13 29
63 58
79 68
44 3
9 13
62 100
30 74
6 28
70 59
59 43
19 20
87 76
81 75
67 82
42 33
91 46
59 68
6 25
56 60
7 31
21 32
94 67
20 39
28 50
8 5
88 76
64 28
1 27
6 21
47 73
62 16
53 51
83 65
93 76
92 61
35 43
14 15
58 61
33 9
38 16
72 25
34 76
3 7
17 16
5 16
4...

output:

49 49
93 94
6 6
41 41
47 47
-1 -1
43 44
7 7
11 12
-1 -1
-1 -1
26 27
6 6
44 45
50 50
43 43
47 48
-1 -1
41 41
-1 -1
6 6
99 100
41 41
12 13
-1 -1
-1 -1
-1 -1
41 41
-1 -1
-1 -1
26 27
-1 -1
13 14
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
18 18
-1 -1
-1 -1
4 5
-1 -1
-1 -1
26 27

result:

ok 45 lines

Test #13:

score: 0
Accepted
time: 7ms
memory: 27092kb

input:

100 100 100
8 13
44 33
3 10
33 81
83 71
3 1
51 44
57 9
95 67
47 42
74 94
38 56
44 68
33 7
54 75
29 42
58 23
2 8
49 77
49 92
30 9
11 60
86 71
13 17
100 54
89 61
14 18
9 5
21 19
60 84
82 71
98 49
2 37
1 50
34 8
42 45
93 88
2 1
6 7
11 48
20 3
18 64
16 3
22 2
4 3
51 55
72 70
13 46
19 54
94 97
2 6
2 5
31...

output:

77 77
11 12
45 45
-1 -1
59 60
11 12
59 60
43 43
-1 -1
-1 -1
-1 -1
74 74
-1 -1
11 12
74 74
-1 -1
43 43
-1 -1
-1 -1
71 72
-1 -1
21 21
74 74
24 25
45 45
34 34
74 74
34 34
21 21
11 12
-1 -1
22 22
-1 -1
24 25
71 72
-1 -1
74 74
45 46
74 74
-1 -1
-1 -1
-1 -1
11 12
-1 -1
74 74
51 51
45 46
24 25
74 74
-1 -1
...

result:

ok 55 lines

Test #14:

score: 0
Accepted
time: 3ms
memory: 27112kb

input:

100 100 100
23 16
38 29
19 31
29 68
36 32
7 28
27 72
3 2
96 49
79 42
5 6
62 87
88 66
41 34
5 10
88 97
2 35
71 49
52 17
60 54
51 11
56 46
81 49
11 9
13 8
31 76
10 14
99 58
95 78
5 3
16 9
4 2
9 12
22 11
10 17
100 50
86 56
43 57
50 14
9 18
30 49
82 72
6 8
3 44
14 26
2 30
70 53
38 39
28 61
43 8
24 18
64...

output:

-1 -1
14 14
67 67
-1 -1
20 21
37 38
27 27
37 38
-1 -1
-1 -1
13 13
93 94
85 85
67 67
12 12
2 3
37 38
-1 -1
17 18
12 12
33 34
-1 -1
1 2
67 67
-1 -1
-1 -1
17 18
77 77
85 85
67 67
-1 -1
27 27
85 85
82 83
-1 -1
31 32
-1 -1
37 38
-1 -1
-1 -1
12 12
-1 -1
12 12
85 85
-1 -1
67 67
-1 -1
-1 -1
56 56
67 67
-1 -...

result:

ok 52 lines

Test #15:

score: 0
Accepted
time: 3ms
memory: 27204kb

input:

100 100 100
1 57
58 1
30 1
2 28
51 1
1 2
3 1
33 1
75 1
53 3
55 1
1 19
63 4
9 1
83 3
1 39
99 3
90 1
44 1
17 1
1 72
11 1
22 1
15 1
14 1
59 2
93 1
88 1
1 8
3 65
46 3
79 1
5 1
82 1
2 85
78 1
38 1
1 29
1 92
26 2
2 64
3 41
2 37
1 27
48 1
3 62
7 1
43 2
42 2
84 1
10 1
13 1
89 7
1 97
52 1
73 1
2 95
69 2
36 2...

output:

-1 -1
53 53
-1 -1
29 30
53 53
-1 -1
65 66
-1 -1
8 9
-1 -1
53 53
-1 -1
59 60
2 2
63 64
53 53
21 22
53 53
68 69
-1 -1
72 73
53 53
53 53
-1 -1
-1 -1
-1 -1
-1 -1
53 53
2 2
53 53
2 2
8 9
53 53
5 5
-1 -1
-1 -1
77 78
53 53
53 53
57 58
67 68
2 2
-1 -1
-1 -1
2 2
-1 -1
-1 -1

result:

ok 47 lines

Test #16:

score: 0
Accepted
time: 3ms
memory: 27140kb

input:

100 100 100
8 5
64 62
57 94
75 57
19 43
9 35
34 5
30 47
24 63
100 43
42 95
99 56
5 14
24 8
72 79
89 97
96 45
91 71
5 1
41 45
3 15
69 85
76 4
39 67
72 65
40 84
25 89
15 90
1 4
26 3
29 41
59 53
31 15
21 11
13 9
32 46
41 60
74 58
25 48
57 73
48 58
10 1
68 2
23 87
25 54
3 1
39 19
7 12
36 30
30 3
28 15
1...

output:

-1 -1
7 8
95 95
-1 -1
72 72
72 72
72 72
72 72
5 5
-1 -1
-1 -1
72 72
72 72
51 52
5 6
15 16
72 72
72 72
5 6
34 35
21 22
72 72
96 96
95 95
-1 -1
72 72
72 72
34 35
41 42
56 56
-1 -1
34 35
-1 -1
-1 -1
11 12
-1 -1
3 4
7 8
-1 -1
72 72
-1 -1
37 38
51 52
-1 -1
72 72
-1 -1
72 72
8 9
72 72
72 72
10 11
72 72
-1...

result:

ok 53 lines

Test #17:

score: 0
Accepted
time: 0ms
memory: 27152kb

input:

100 100 100
43 42
75 74
33 34
77 76
85 84
39 38
76 75
81 82
17 18
41 40
72 71
62 61
54 55
50 48
2 3
36 35
5 4
27 28
64 61
10 11
32 33
24 23
60 59
52 51
54 52
30 31
19 20
89 91
92 91
94 93
92 93
15 16
10 9
53 52
22 21
16 17
46 47
23 22
95 94
36 37
65 68
83 82
89 88
63 60
99 100
6 7
77 78
59 58
78 79
...

output:

62 62
35 35
-1 -1
67 67
8 8
38 38
72 72
-1 -1
11 11
67 67
19 19
33 33
-1 -1
-1 -1
39 39
67 67
25 25
71 71
93 93
22 22
39 39
88 88
-1 -1
28 28
8 8
-1 -1
-1 -1
-1 -1
-1 -1
15 15
-1 -1
55 55
35 35
50 50
-1 -1
48 48
93 93
39 39
8 8
-1 -1
100 100
-1 -1
-1 -1
55 55
70 70
92 92
94 94
96 96
34 34
18 18
19 1...

result:

ok 62 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 27156kb

input:

100 100 100
77 78
14 15
57 56
59 58
11 10
54 53
89 88
93 94
2 3
94 95
99 98
43 42
80 79
69 68
25 24
46 47
13 14
41 40
48 47
76 75
55 54
18 19
68 67
32 33
49 48
12 13
45 46
7 6
78 79
5 6
85 84
5 4
36 35
31 30
63 64
50 51
62 63
83 84
34 35
2 1
69 70
90 89
85 86
51 52
97 98
39 40
30 29
65 66
23 22
67 6...

output:

62 62
72 72
99 99
11 11
-1 -1
78 78
-1 -1
31 31
81 81
-1 -1
71 71
-1 -1
-1 -1
59 59
42 42
25 25
-1 -1
-1 -1
35 35
-1 -1
-1 -1
73 73
-1 -1
-1 -1
56 56
15 15
-1 -1
-1 -1
50 50
15 15
56 56
-1 -1
40 40
41 41
-1 -1
1 1
-1 -1
82 82
-1 -1
-1 -1
-1 -1
52 52
-1 -1
-1 -1
54 54
20 20
-1 -1
-1 -1
20 20
27 27
-1...

result:

ok 56 lines

Test #19:

score: 0
Accepted
time: 3ms
memory: 27128kb

input:

100 100 100
1 68
77 1
1 76
1 81
52 1
1 33
22 1
1 53
1 20
46 1
1 86
1 58
1 5
1 30
95 1
1 44
82 1
1 4
19 1
48 1
1 23
1 69
85 1
1 27
1 93
36 1
94 1
1 35
40 1
1 28
1 57
73 1
11 1
84 1
1 51
1 71
1 45
1 29
41 1
1 3
1 78
80 1
14 1
56 1
39 1
1 89
1 32
1 37
9 1
88 1
15 1
8 1
92 1
43 1
38 1
1 26
2 1
34 1
1 25...

output:

18 19
11 12
23 24
-1 -1
30 31
1 2
-1 -1
25 26
-1 -1
18 19
11 12
4 5
16 17
12 13
3 4
-1 -1
5 6
8 9
14 15
6 7
-1 -1
9 10
1 2
57 58
-1 -1
98 98
24 25
-1 -1
-1 -1
17 18
59 60
24 25
57 58
25 26
17 18
11 12
41 42
58 59
12 13
18 19
41 42
-1 -1
-1 -1
99 99
52 53
99 99
1 2
65 66
4 5
-1 -1
28 29
74 75
40 41
4...

result:

ok 55 lines

Test #20:

score: 0
Accepted
time: 3ms
memory: 27128kb

input:

100 100 100
21 22
97 98
90 89
7 8
33 32
83 81
67 64
71 69
51 50
81 80
85 87
51 52
79 80
78 77
39 40
34 33
10 11
48 49
94 95
20 19
73 74
72 71
29 30
66 65
15 16
4 3
69 70
31 30
41 42
45 46
100 97
59 58
61 62
86 85
34 35
57 58
11 12
26 25
46 47
45 44
55 54
90 91
23 24
82 78
72 73
2 1
79 78
97 99
76 77...

output:

37 38
39 39
54 54
87 87
50 50
30 30
-1 -1
65 65
36 36
-1 -1
41 41
-1 -1
84 84
-1 -1
-1 -1
83 83
81 81
86 86
-1 -1
-1 -1
60 60
-1 -1
-1 -1
1 1
-1 -1
-1 -1
55 55
-1 -1
16 16
35 35
28 28
54 54
-1 -1
9 9
6 7
31 31
54 54
74 74
-1 -1
-1 -1
-1 -1
26 26
-1 -1
35 35
-1 -1
74 74
25 25
-1 -1
43 43
30 30
4 4
36...

result:

ok 52 lines

Test #21:

score: 0
Accepted
time: 0ms
memory: 27136kb

input:

100 100 100
14 13
27 28
3 2
65 66
12 13
33 32
71 72
30 31
74 73
36 35
50 51
35 34
49 50
60 61
19 20
97 96
38 39
48 46
55 54
31 32
68 67
63 61
41 40
34 33
15 16
5 4
81 80
48 49
15 14
71 70
89 88
92 94
46 47
75 76
80 79
60 59
61 62
6 5
37 36
69 70
8 7
43 42
17 18
52 53
29 28
77 78
96 98
10 9
52 51
27 ...

output:

2 2
33 33
44 44
-1 -1
82 82
2 2
55 55
-1 -1
11 11
20 20
67 67
57 57
29 29
-1 -1
-1 -1
82 82
24 24
-1 -1
33 33
-1 -1
29 29
33 33
53 53
41 41
13 13
3 3
-1 -1
15 15
13 13
-1 -1
65 65
-1 -1
9 9
3 3
-1 -1
72 72
-1 -1
-1 -1
-1 -1
-1 -1
35 35
82 82
20 20
-1 -1
-1 -1
20 20
-1 -1
20 20
-1 -1
53 53

result:

ok 50 lines

Test #22:

score: 0
Accepted
time: 0ms
memory: 27092kb

input:

100 100 100
1 37
1 16
47 1
58 1
1 90
1 85
1 13
1 41
1 57
80 1
1 11
2 100
1 7
96 1
1 26
1 75
8 1
65 1
1 99
2 93
1 28
1 2
1 50
76 1
32 1
17 1
1 25
21 1
9 1
70 1
42 2
2 45
1 88
1 97
1 94
35 1
66 1
1 36
63 1
1 33
84 2
2 73
1 43
1 83
44 1
89 1
81 2
1 31
1 48
1 22
1 19
72 1
1 79
2 54
1 23
74 1
29 1
1 61
6...

output:

2 3
22 23
18 19
8 9
14 15
7 8
12 13
63 64
5 6
14 15
-1 -1
-1 -1
69 70
16 17
-1 -1
7 8
2 3
4 5
-1 -1
11 12
-1 -1
97 97
-1 -1
4 5
1 2
10 11
6 7
46 47
58 59
12 13
11 12
71 71
-1 -1
15 16
71 71
42 43
71 71
-1 -1
71 71
17 18
71 71
73 74
71 71
3 4
27 27
-1 -1
14 15
10 11
71 71
-1 -1

result:

ok 50 lines

Test #23:

score: 0
Accepted
time: 0ms
memory: 27160kb

input:

100 100 100
62 63
70 71
61 62
51 50
23 24
94 95
3 4
73 74
40 41
56 57
97 96
68 69
10 9
42 43
99 100
83 82
13 12
87 86
24 25
80 79
93 94
44 43
55 56
32 33
19 18
51 52
54 55
26 27
46 45
6 5
11 12
76 75
44 45
60 59
53 54
15 16
34 33
95 96
3 2
46 47
68 67
70 69
65 64
32 31
58 57
17 16
21 22
85 86
91 92
...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1

result:

ok 42 lines

Test #24:

score: 0
Accepted
time: 0ms
memory: 27116kb

input:

100 100 100
42 41
10 11
75 74
89 88
11 12
70 71
58 59
50 49
5 4
82 81
3 2
18 17
29 30
64 65
87 88
51 50
19 18
38 39
76 77
28 29
34 35
77 78
94 93
47 46
56 55
36 37
14 15
16 17
39 40
94 95
98 99
57 56
30 31
62 63
69 68
7 6
91 90
27 28
85 86
79 80
9 10
68 67
2 1
7 8
22 23
73 74
45 44
58 57
36 35
24 25...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 53 lines

Test #25:

score: 0
Accepted
time: 11ms
memory: 27156kb

input:

100 100 100
63 62
71 70
62 61
51 50
24 23
95 94
4 3
74 73
41 40
57 56
97 96
69 68
10 9
43 42
1 100
83 82
13 12
87 86
25 24
80 79
94 93
44 43
56 55
33 32
19 18
52 51
55 54
27 26
46 45
6 5
12 11
76 75
45 44
60 59
54 53
16 15
34 33
96 95
3 2
47 46
68 67
70 69
65 64
32 31
58 57
17 16
22 21
86 85
92 91
8...

output:

49 50
49 50
-1 -1
-1 -1
-1 -1
49 50
49 50
49 50
-1 -1
49 50
49 50
-1 -1
49 50
49 50
-1 -1
49 50
49 50
49 50
49 50
49 50
-1 -1
-1 -1
49 50
-1 -1
49 50
-1 -1
49 50
49 50
49 50
49 50
49 50
49 50
49 50
49 50
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
49 50
-1 -1
-1 -1
49 50
49 50
-1 -1
49 50
49 50

result:

ok 47 lines

Test #26:

score: 0
Accepted
time: 3ms
memory: 27180kb

input:

12 40 78
12 1
1 7
4 1
1 2
1 11
1 8
9 1
1 5
10 1
6 1
1 3
4 9 7 9 12 12 9 7 4 8 1 7 10 7 1 2 3 4 12 8 10 4 1 3 11 8 12 1 5 1 2 10 12 2 4 4 8 9 8 5
2 29 39 1
1 28 3
2 1 9 1
1 15 4
1 32 9
2 7 31 1
2 3 23 12
1 8 9
2 3 19 1
2 34 34 1
1 28 9
1 34 12
1 31 7
1 36 11
2 26 26 1
2 37 37 1
2 38 38 1
2 2 38 1
2 8...

output:

30 30
1 2
11 11
5 5
11 11
-1 -1
-1 -1
-1 -1
-1 -1
11 11
11 11
3 4
2 3
30 30
11 11
37 38
23 23
23 23
-1 -1
23 23
-1 -1
-1 -1
11 11
30 31
17 18
9 9
-1 -1
14 15
-1 -1
-1 -1
9 9
-1 -1
19 20
9 9
9 9
9 9
5 5
12 12
-1 -1
9 9

result:

ok 40 lines

Test #27:

score: 0
Accepted
time: 3ms
memory: 27156kb

input:

100 100 100
32 47
11 22
44 41
13 90
43 15
1 2
18 9
16 24
15 9
34 52
17 6
20 62
77 53
89 83
1 12
17 68
75 64
29 19
71 49
72 73
39 20
35 66
41 35
27 4
80 76
33 27
7 1
26 28
45 13
61 54
70 31
40 5
42 8
28 56
49 37
35 11
42 65
4 2
28 54
93 54
26 36
19 23
60 76
6 64
72 66
91 46
32 20
8 3
10 14
60 8
57 21...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 100 lines

Subtask #2:

score: 18
Accepted

Test #28:

score: 18
Accepted
time: 8ms
memory: 27284kb

input:

500 500 500
1 431
1 61
1 52
366 1
126 1
465 1
1 40
1 378
1 108
1 276
75 1
1 430
95 1
1 314
1 236
91 1
118 1
267 1
1 150
1 467
153 1
1 216
53 1
1 43
1 438
1 393
1 44
416 1
419 1
111 1
1 42
1 9
1 244
251 1
355 1
461 1
1 407
1 24
1 412
94 1
1 124
1 414
148 1
489 1
1 376
1 330
1 18
1 418
1 141
1 408
84 ...

output:

83 84
19 20
75 76
198 199
26 27
49 50
198 199
45 46
104 105
-1 -1
18 19
209 210
17 18
98 99
69 70
-1 -1
57 58
-1 -1
-1 -1
-1 -1
40 41
96 97
14 15
-1 -1
49 50
36 37
323 324
257 258
20 21
-1 -1
358 359
9 10
18 19
-1 -1
181 182
-1 -1
252 253
44 45
-1 -1
347 347
347 347
-1 -1
357 358
216 217
347 347
211...

result:

ok 234 lines

Test #29:

score: 0
Accepted
time: 4ms
memory: 27352kb

input:

500 500 500
417 418
46 45
169 170
117 118
129 130
175 176
387 386
263 262
126 127
64 65
108 107
98 99
346 345
384 385
392 391
151 152
98 97
62 61
446 445
349 348
87 88
94 95
268 267
111 112
231 232
394 395
109 110
404 403
258 257
214 215
338 339
416 415
366 367
154 153
426 427
342 341
269 268
491 49...

output:

444 444
28 28
141 141
204 204
145 145
433 433
-1 -1
263 263
108 108
-1 -1
97 97
131 131
-1 -1
14 14
254 254
178 178
-1 -1
375 375
-1 -1
21 21
491 491
449 449
81 81
112 112
168 168
173 173
94 94
36 36
426 426
112 112
120 120
170 170
482 482
9 9
186 186
77 77
153 153
241 241
74 74
-1 -1
-1 -1
-1 -1
90...

result:

ok 261 lines

Test #30:

score: 0
Accepted
time: 8ms
memory: 27228kb

input:

500 500 500
429 428
102 103
469 473
484 483
96 98
126 125
201 204
314 319
123 124
154 153
67 66
3 2
188 187
411 409
216 212
394 391
119 118
353 354
171 172
497 498
341 339
360 361
406 413
351 353
338 344
55 54
76 77
302 304
62 63
178 177
390 387
425 427
207 205
277 275
50 51
352 350
88 85
320 324
47...

output:

276 276
217 217
264 264
296 296
288 288
342 342
446 447
-1 -1
321 321
497 498
109 110
345 345
253 253
264 264
135 135
109 110
253 253
407 408
285 285
-1 -1
181 181
164 164
12 12
496 496
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
353 353
-1 -1
374 374
217 217
207 208
-1 -1
474 474
486 486
109 110
309 309
27 27
10...

result:

ok 247 lines

Test #31:

score: 0
Accepted
time: 3ms
memory: 27256kb

input:

500 500 500
263 264
82 83
162 164
410 409
134 136
133 134
498 495
315 316
201 200
13 14
401 400
96 95
74 75
173 174
305 307
178 177
184 182
404 400
148 147
305 303
336 338
21 22
267 266
200 198
438 447
160 158
359 362
220 219
71 70
268 269
471 472
45 46
242 241
360 354
285 284
128 130
41 40
154 155
...

output:

-1 -1
-1 -1
-1 -1
293 293
-1 -1
174 174
102 102
423 423
346 346
323 323
58 58
250 250
84 84
55 56
274 274
480 480
54 54
-1 -1
181 181
-1 -1
55 56
446 446
185 185
-1 -1
36 37
293 293
-1 -1
-1 -1
75 75
34 34
293 293
253 253
43 44
92 92
-1 -1
120 120
-1 -1
383 383
-1 -1
-1 -1
488 488
-1 -1
471 471
193 ...

result:

ok 244 lines

Test #32:

score: 0
Accepted
time: 3ms
memory: 27296kb

input:

500 500 500
232 1
316 1
296 1
357 1
266 1
6 262
3 289
131 1
428 3
188 2
23 1
2 403
1 244
1 321
1 405
309 1
399 7
1 185
1 54
91 1
260 1
97 1
1 162
401 1
1 187
1 288
8 348
165 2
125 1
4 413
364 1
1 17
26 1
1 99
1 16
1 389
161 1
179 1
285 3
1 136
217 3
7 317
365 5
145 1
2 349
434 2
1 419
1 155
134 2
1 ...

output:

22 23
285 286
188 189
-1 -1
351 352
-1 -1
270 271
75 76
193 194
6 7
161 162
38 39
-1 -1
34 35
309 310
-1 -1
73 74
235 236
239 240
346 347
-1 -1
-1 -1
-1 -1
72 73
-1 -1
-1 -1
18 19
193 194
-1 -1
-1 -1
57 58
-1 -1
207 208
-1 -1
-1 -1
266 267
-1 -1
162 163
19 20
177 178
63 64
159 160
76 77
185 186
442 ...

result:

ok 275 lines

Test #33:

score: 0
Accepted
time: 3ms
memory: 27236kb

input:

500 500 500
285 283
316 308
30 31
65 63
435 434
8 7
6 7
295 292
429 428
319 316
39 40
58 56
107 109
159 157
453 455
229 226
379 388
490 476
50 52
119 121
42 43
21 22
481 483
92 91
250 246
34 35
287 290
74 76
215 211
197 199
488 471
463 457
100 101
305 302
499 495
116 115
132 128
224 227
213 216
109 ...

output:

49 49
280 280
-1 -1
-1 -1
164 164
86 87
166 166
-1 -1
-1 -1
54 54
161 162
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
288 288
433 433
154 154
102 102
-1 -1
127 127
465 466
263 263
-1 -1
496 496
149 149
199 200
-1 -1
286 286
258 259
-1 -1
11 12
395 395
147 147
250 251
164 164
-1 -1
339 340
11 12
138 138
-1 -1
181 ...

result:

ok 259 lines

Test #34:

score: 0
Accepted
time: 7ms
memory: 27236kb

input:

500 500 500
398 2
172 1
1 269
110 1
370 1
139 1
1 249
41 1
332 2
209 1
1 408
1 146
296 1
207 1
1 190
1 438
1 42
1 102
385 1
114 1
3 1
1 206
1 292
1 288
1 429
311 1
1 234
1 193
392 1
220 1
238 1
297 1
1 330
413 1
1 57
1 388
1 239
1 326
472 2
1 78
72 1
210 1
1 135
1 298
1 134
91 1
52 1
157 1
1 246
484...

output:

37 38
186 187
49 50
40 41
94 95
159 160
59 60
95 96
216 217
172 173
390 391
367 368
41 42
-1 -1
-1 -1
126 127
51 52
328 329
14 15
395 396
130 131
195 196
233 234
127 128
59 60
149 150
11 12
35 36
107 108
216 217
21 22
-1 -1
34 35
63 64
-1 -1
1 2
55 56
400 401
-1 -1
24 25
-1 -1
26 27
-1 -1
-1 -1
131 ...

result:

ok 250 lines

Test #35:

score: 0
Accepted
time: 7ms
memory: 27356kb

input:

500 500 500
360 361
11 10
186 187
247 248
109 110
64 63
221 220
213 212
201 202
77 76
371 372
143 142
249 250
146 145
295 294
152 151
281 282
212 211
419 418
303 302
342 343
367 368
217 216
297 298
455 456
301 302
369 368
246 247
46 45
272 271
479 477
31 32
185 186
203 202
485 486
277 278
402 401
33...

output:

169 169
19 19
-1 -1
203 203
43 43
188 188
-1 -1
352 352
312 312
486 486
48 48
116 116
141 141
440 440
337 337
-1 -1
455 455
310 310
296 296
-1 -1
-1 -1
-1 -1
132 132
82 82
154 154
149 149
207 207
309 309
346 346
-1 -1
80 80
118 118
359 359
-1 -1
245 245
207 207
194 194
25 25
-1 -1
314 314
386 386
57...

result:

ok 250 lines

Test #36:

score: 0
Accepted
time: 7ms
memory: 27268kb

input:

500 500 500
397 252
100 22
5 4
289 451
240 128
87 155
231 212
208 115
65 125
364 339
112 31
58 242
285 283
224 227
34 41
375 410
15 8
199 34
294 367
417 271
251 256
178 93
71 92
236 157
314 489
361 437
58 48
83 201
28 131
441 402
475 286
387 290
260 267
174 244
303 262
87 84
293 449
268 253
31 115
4...

output:

249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 ...

result:

ok 500 lines

Test #37:

score: 0
Accepted
time: 3ms
memory: 27348kb

input:

500 500 500
48 71
10 33
19 12
293 251
268 288
130 206
281 482
36 98
190 185
53 218
381 364
208 22
47 65
336 411
159 156
322 313
253 331
253 385
88 86
289 312
492 309
66 143
261 335
225 128
76 188
409 259
299 443
18 154
45 62
235 160
37 12
217 28
395 281
8 60
40 53
465 348
97 19
141 42
424 301
396 35...

output:

249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 ...

result:

ok 500 lines

Test #38:

score: 0
Accepted
time: 0ms
memory: 27356kb

input:

500 500 500
2 3
187 234
85 124
259 289
322 435
260 262
63 97
406 260
94 17
119 151
81 240
312 310
435 496
77 23
33 6
329 467
172 233
74 189
51 40
20 83
99 244
498 478
472 427
62 12
358 450
299 294
261 265
345 312
169 250
276 296
39 131
193 79
186 248
326 258
185 104
12 46
12 225
326 444
16 28
421 43...

output:

249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 ...

result:

ok 500 lines

Test #39:

score: 0
Accepted
time: 0ms
memory: 27296kb

input:

500 500 500
397 252
100 22
5 4
289 451
240 128
87 155
231 212
208 115
65 125
364 339
112 31
58 242
285 283
224 227
34 41
375 410
15 8
199 34
294 367
417 271
251 256
178 93
71 92
236 157
314 489
361 437
58 48
83 201
28 131
441 402
475 286
387 290
260 267
174 244
303 262
87 84
293 449
268 253
31 115
4...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 500 lines

Test #40:

score: 0
Accepted
time: 4ms
memory: 27212kb

input:

500 500 500
48 71
10 33
19 12
293 251
268 288
130 206
281 482
36 98
190 185
53 218
381 364
208 22
47 65
336 411
159 156
322 313
253 331
253 385
88 86
289 312
492 309
66 143
261 335
225 128
76 188
409 259
299 443
18 154
45 62
235 160
37 12
217 28
395 281
8 60
40 53
465 348
97 19
141 42
424 301
396 35...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 500 lines

Test #41:

score: 0
Accepted
time: 4ms
memory: 27248kb

input:

500 500 500
2 3
187 234
85 124
259 289
322 435
260 262
63 97
406 260
94 17
119 151
81 240
312 310
435 496
77 23
33 6
329 467
172 233
74 189
51 40
20 83
99 244
498 478
472 427
62 12
358 450
299 294
261 265
345 312
169 250
276 296
39 131
193 79
186 248
326 258
185 104
12 46
12 225
326 444
16 28
421 43...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 500 lines

Test #42:

score: 0
Accepted
time: 4ms
memory: 27264kb

input:

500 500 500
397 252
100 22
5 4
289 451
240 128
87 155
231 212
208 115
65 125
364 339
112 31
58 242
285 283
224 227
34 41
375 410
15 8
199 34
294 367
417 271
251 256
178 93
71 92
236 157
314 489
361 437
58 48
83 201
28 131
441 402
475 286
387 290
260 267
174 244
303 262
87 84
293 449
268 253
31 115
4...

output:

249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 ...

result:

ok 244 lines

Test #43:

score: 0
Accepted
time: 0ms
memory: 27220kb

input:

500 500 500
48 71
10 33
19 12
293 251
268 288
130 206
281 482
36 98
190 185
53 218
381 364
208 22
47 65
336 411
159 156
322 313
253 331
253 385
88 86
289 312
492 309
66 143
261 335
225 128
76 188
409 259
299 443
18 154
45 62
235 160
37 12
217 28
395 281
8 60
40 53
465 348
97 19
141 42
424 301
396 35...

output:

249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 ...

result:

ok 243 lines

Test #44:

score: 0
Accepted
time: 4ms
memory: 27216kb

input:

500 500 500
2 3
187 234
85 124
259 289
322 435
260 262
63 97
406 260
94 17
119 151
81 240
312 310
435 496
77 23
33 6
329 467
172 233
74 189
51 40
20 83
99 244
498 478
472 427
62 12
358 450
299 294
261 265
345 312
169 250
276 296
39 131
193 79
186 248
326 258
185 104
12 46
12 225
326 444
16 28
421 43...

output:

249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 250
249 ...

result:

ok 237 lines

Test #45:

score: 0
Accepted
time: 3ms
memory: 27280kb

input:

500 500 500
257 2
433 2
336 1
1 147
4 467
1 248
276 4
256 2
3 393
1 90
3 397
2 392
1 225
378 3
1 178
1 107
4 132
2 442
37 1
135 1
1 201
3 445
1 95
61 1
3 438
491 2
46 1
1 36
372 3
3 379
1 12
1 157
35 1
350 1
119 1
203 1
1 111
395 3
3 269
1 83
2 126
406 8
484 3
1 76
1 184
1 25
2 258
1 279
1 342
476 4...

output:

-1 -1
-1 -1
-1 -1
120 120
120 120
-1 -1
342 342
120 120
120 120
120 120
120 120
-1 -1
-1 -1
4 5
120 120
-1 -1
-1 -1
120 120
210 210
-1 -1
354 355
-1 -1
337 337
337 337
197 197
429 429
-1 -1
197 197
252 253
120 120
-1 -1
120 120
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
13 13
337 337
13 13
120 120
244 244
-1 -1
...

result:

ok 257 lines

Test #46:

score: 0
Accepted
time: 3ms
memory: 27256kb

input:

500 500 500
415 416
412 411
95 96
488 487
166 167
205 206
356 357
22 23
179 180
439 441
219 220
376 375
98 99
177 176
259 260
251 252
383 384
493 494
24 23
399 398
92 91
92 93
332 333
275 274
200 201
259 258
78 77
327 326
74 75
90 91
217 216
144 145
460 459
334 335
26 27
253 254
375 374
8 7
441 442
...

output:

198 198
13 13
142 142
189 189
260 260
500 500
41 41
221 221
-1 -1
-1 -1
39 39
-1 -1
410 410
-1 -1
196 196
-1 -1
-1 -1
102 102
244 244
244 244
-1 -1
33 33
413 413
28 28
-1 -1
-1 -1
248 248
-1 -1
479 479
8 8
130 130
373 373
233 233
486 486
430 430
78 78
-1 -1
282 282
403 403
417 417
-1 -1
-1 -1
453 45...

result:

ok 268 lines

Test #47:

score: 0
Accepted
time: 0ms
memory: 27236kb

input:

500 500 500
468 465
90 89
416 417
398 397
250 249
332 330
132 133
434 433
31 30
406 405
445 447
461 459
499 495
305 304
206 207
82 81
265 266
431 429
476 477
467 466
104 105
42 41
29 28
76 75
482 483
7 8
50 51
444 443
449 447
408 407
181 180
387 385
287 288
46 45
336 335
109 110
255 256
436 439
137 ...

output:

219 219
94 94
-1 -1
166 166
248 248
-1 -1
-1 -1
-1 -1
230 231
28 28
88 88
-1 -1
375 375
187 187
13 13
26 26
234 234
198 198
74 74
258 258
-1 -1
410 410
-1 -1
403 403
459 459
110 110
198 198
-1 -1
-1 -1
333 333
311 311
139 139
-1 -1
3 3
-1 -1
209 209
-1 -1
-1 -1
114 114
-1 -1
314 315
50 50
-1 -1
-1 -...

result:

ok 256 lines

Test #48:

score: 0
Accepted
time: 8ms
memory: 27220kb

input:

500 500 500
1 219
285 1
261 1
237 1
1 112
1 6
53 1
70 1
1 325
306 1
1 173
1 184
1 94
61 1
477 1
135 1
375 1
380 1
1 189
301 1
402 1
405 1
470 1
186 1
1 428
1 258
1 372
1 187
15 1
1 455
1 456
1 155
1 418
464 1
463 1
1 63
1 467
376 1
1 235
1 55
462 1
78 1
312 1
1 475
1 441
163 1
383 1
1 215
1 161
107 ...

output:

-1 -1
-1 -1
-1 -1
217 217
-1 -1
1 2
336 337
-1 -1
282 282
-1 -1
-1 -1
12 13
217 217
217 217
364 364
217 217
84 85
282 282
217 217
15 15
217 217
217 217
282 282
-1 -1
217 217
-1 -1
15 15
-1 -1
217 217
41 41
217 217
41 41
47 47
15 15
41 41
-1 -1
-1 -1
351 351
-1 -1
77 77
47 47
139 139
15 15
-1 -1
15 1...

result:

ok 224 lines

Test #49:

score: 0
Accepted
time: 3ms
memory: 27296kb

input:

500 500 500
368 369
191 192
82 83
36 37
171 170
487 486
489 490
4 3
275 274
470 469
190 189
494 496
232 233
226 227
67 68
324 323
167 166
252 253
205 206
491 489
361 363
33 34
251 252
426 427
77 78
349 350
187 188
222 224
19 18
402 401
311 309
172 173
421 420
374 372
409 408
35 36
47 48
405 406
46 4...

output:

-1 -1
-1 -1
-1 -1
93 93
168 168
-1 -1
-1 -1
250 250
5 5
342 342
424 424
39 39
164 164
411 411
141 141
65 65
54 54
443 443
-1 -1
176 176
-1 -1
88 88
-1 -1
-1 -1
-1 -1
233 233
180 180
-1 -1
-1 -1
118 118
111 111
82 82
422 423
242 242
233 233
296 296
115 115
247 247
395 395
228 228
-1 -1
224 224
117 11...

result:

ok 248 lines

Test #50:

score: 0
Accepted
time: 7ms
memory: 27232kb

input:

500 500 500
192 1
1 337
1 207
440 1
1 144
1 466
1 44
1 19
180 1
1 41
1 154
98 1
355 1
145 1
130 1
261 1
1 413
1 456
1 458
115 1
327 1
1 95
242 1
195 1
257 1
209 1
194 1
247 1
1 147
1 425
1 401
279 1
438 1
1 275
1 107
7 1
1 141
382 1
1 292
87 1
1 182
221 1
74 1
1 354
61 1
1 239
229 1
1 10
405 1
14 1
...

output:

-1 -1
-1 -1
-1 -1
-1 -1
132 132
-1 -1
97 97
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
7 7
42 42
-1 -1
96 96
-1 -1
299 299
262 262
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
47 47
-1 -1
256 256
-1 -1
-1 -1
-1 -1
273 273
282 282
-1 -1
204 204
153 153
-1 -1
-1 -1
-1 -1
270 270
129 129
-1 -1
-1 -1
242 242
-1 -1
-1 -1
-1 -...

result:

ok 247 lines

Test #51:

score: 0
Accepted
time: 0ms
memory: 27292kb

input:

500 500 500
148 149
239 241
402 404
157 156
188 183
186 187
214 215
359 350
90 92
98 99
11 12
471 470
427 421
242 241
361 362
258 264
16 17
245 247
464 454
179 180
108 109
5 6
454 449
436 440
107 106
104 105
189 184
265 263
389 391
430 433
209 207
322 323
102 104
492 495
467 457
62 61
460 439
97 96
...

output:

-1 -1
-1 -1
269 269
-1 -1
178 179
-1 -1
-1 -1
162 162
370 370
-1 -1
-1 -1
-1 -1
335 336
270 270
-1 -1
84 84
127 127
-1 -1
174 174
-1 -1
-1 -1
185 185
325 325
-1 -1
98 98
-1 -1
401 401
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
24...

result:

ok 241 lines

Test #52:

score: 0
Accepted
time: 0ms
memory: 27240kb

input:

500 500 500
415 416
412 411
95 96
488 487
166 167
205 206
356 357
22 23
179 180
439 441
219 220
376 375
98 99
177 176
259 260
251 252
383 384
493 494
24 23
399 398
92 91
92 93
332 333
275 274
200 201
259 258
78 77
327 326
74 75
90 91
217 216
144 145
460 459
334 335
26 27
253 254
375 374
8 7
441 442
...

output:

-1 -1
128 128
-1 -1
180 180
357 357
-1 -1
226 226
46 46
325 325
-1 -1
-1 -1
201 201
-1 -1
-1 -1
-1 -1
466 466
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
318 318
334 334
466 466
-1 -1
-1 -1
372 372
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
346 346
-1 -1
196 196
-1 -1
220 220
-1...

result:

ok 261 lines

Test #53:

score: 0
Accepted
time: 0ms
memory: 27212kb

input:

500 500 500
325 326
308 306
249 247
180 179
100 99
202 200
57 56
296 297
48 47
486 480
202 203
219 220
336 340
261 260
61 59
88 89
120 123
222 218
214 215
63 62
125 126
420 419
440 436
238 240
167 165
461 472
176 174
456 466
41 42
229 238
211 210
155 152
437 425
133 131
364 363
173 171
30 29
453 439...

output:

-1 -1
-1 -1
-1 -1
-1 -1
338 338
-1 -1
-1 -1
292 292
68 68
360 360
-1 -1
150 150
-1 -1
-1 -1
-1 -1
87 87
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
202 202
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
463 463
282 283
-1 -1
383 383
-1 -1
-1 -1
79 79
311 311
143 143
-1 -1
-1 -1
-1 -1
183 ...

result:

ok 254 lines

Test #54:

score: 0
Accepted
time: 5ms
memory: 27296kb

input:

500 500 500
485 484
427 426
466 465
212 211
23 22
161 160
300 299
44 43
356 355
255 254
232 231
443 442
69 68
398 397
397 396
301 300
239 238
158 157
321 320
320 319
411 410
296 295
154 153
496 495
281 280
499 498
119 118
177 176
100 99
243 242
359 358
403 402
120 119
418 417
126 125
21 20
83 82
419...

output:

249 250
249 250
249 250
249 250
249 250
-1 -1
249 250
249 250
-1 -1
249 250
249 250
-1 -1
249 250
249 250
249 250
249 250
-1 -1
249 250
249 250
249 250
249 250
249 250
-1 -1
-1 -1
249 250
249 250
249 250
-1 -1
-1 -1
249 250
-1 -1
-1 -1
249 250
249 250
249 250
-1 -1
249 250
249 250
249 250
-1 -1
249 ...

result:

ok 249 lines

Test #55:

score: 0
Accepted
time: 3ms
memory: 27176kb

input:

278 466 138
97 96
119 118
79 78
116 117
126 129
193 195
25 26
217 211
273 277
144 145
58 59
275 273
44 45
21 22
191 192
252 250
167 166
64 65
176 175
168 169
38 39
118 113
9 8
196 195
15 16
39 40
182 184
23 22
252 253
31 30
271 264
212 210
98 96
166 168
169 170
191 190
257 250
82 81
143 144
120 116
...

output:

167 167
-1 -1
134 134
128 128
225 225
53 53
141 141
368 368
-1 -1
-1 -1
-1 -1
174 174
251 252
201 201
289 289
345 345
199 199
264 264
289 289
-1 -1
201 201
44 45
-1 -1
161 161
-1 -1
230 230
417 417
74 74
374 374
-1 -1
-1 -1
292 292
399 399
297 298
-1 -1
21 21
79 79
191 191
26 27
155 155
399 399
128 ...

result:

ok 73 lines

Test #56:

score: 0
Accepted
time: 0ms
memory: 27304kb

input:

500 500 500
484 485
426 427
466 465
211 212
22 23
161 160
299 300
44 43
355 356
254 255
232 231
443 442
69 68
397 398
397 396
301 300
239 238
158 157
321 320
320 319
410 411
295 296
153 154
496 495
280 281
499 498
118 119
176 177
100 99
242 243
358 359
402 403
120 119
417 418
125 126
21 20
82 83
418...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 234 lines

Test #57:

score: 0
Accepted
time: 4ms
memory: 27276kb

input:

500 500 500
335 336
64 63
74 75
468 469
88 87
447 448
51 50
332 331
328 329
79 78
481 482
299 300
103 102
203 202
313 312
155 154
137 136
206 207
233 232
277 276
298 299
383 382
480 481
458 459
323 324
205 206
263 262
296 297
162 163
37 36
374 375
117 118
442 441
433 434
111 110
400 399
127 126
169 ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 242 lines

Test #58:

score: 0
Accepted
time: 3ms
memory: 27216kb

input:

500 500 500
441 214
447 454
127 90
355 61
288 312
309 365
79 257
5 254
70 332
186 196
178 258
264 431
29 120
73 289
267 211
469 93
143 192
44 41
41 2
66 47
108 237
43 228
125 26
187 470
205 125
240 152
107 16
215 389
395 352
498 500
184 159
85 144
11 18
194 336
131 200
404 383
329 358
48 10
73 414
1...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 500 lines

Subtask #3:

score: 26
Accepted

Test #59:

score: 26
Accepted
time: 6ms
memory: 27896kb

input:

2000 2000 2000
327 1
1629 1
1570 1
1791 1
623 1
2 850
1549 1
2 1613
1719 1
439 1
1 245
718 1
17 1
1 1384
1312 1
938 2
2 1732
1 487
1605 3
1502 1
1 1919
1 464
123 1
958 1
494 1
1 1913
1499 1
1 387
1 1297
1 551
1 1278
1 1842
536 1
1 304
2 1363
1691 2
1 1435
1451 2
848 1
2 1854
8 1
5 1987
1 449
1766 2
...

output:

549 550
-1 -1
437 437
623 624
437 437
-1 -1
698 699
437 437
-1 -1
-1 -1
-1 -1
437 437
-1 -1
437 437
1623 1623
437 437
437 437
802 803
437 437
437 437
509 510
437 437
-1 -1
701 702
235 236
576 577
530 531
437 437
-1 -1
437 437
437 437
-1 -1
540 541
-1 -1
308 308
-1 -1
916 917
-1 -1
934 935
807 808
43...

result:

ok 991 lines

Test #60:

score: 0
Accepted
time: 6ms
memory: 27936kb

input:

2000 2000 2000
1223 1222
760 761
512 513
569 570
1680 1679
55 54
367 368
98 99
517 516
926 925
1127 1126
1117 1118
1533 1534
1063 1064
1337 1338
1565 1564
675 674
353 352
738 737
240 239
534 535
1713 1712
697 698
1610 1609
1913 1914
864 865
490 489
823 822
26 27
1443 1442
1855 1854
1395 1396
462 463...

output:

-1 -1
1238 1238
-1 -1
1697 1697
854 854
683 683
-1 -1
1605 1605
1695 1695
186 186
-1 -1
-1 -1
787 787
1590 1590
349 349
11 11
-1 -1
1537 1537
1652 1652
1014 1014
155 155
903 903
1449 1449
1210 1210
1705 1705
497 497
1170 1170
717 717
1062 1062
-1 -1
137 137
1220 1220
-1 -1
986 986
988 988
-1 -1
1131...

result:

ok 975 lines

Test #61:

score: 0
Accepted
time: 8ms
memory: 27856kb

input:

2000 2000 2000
181 180
578 577
1560 1562
137 138
1874 1870
1940 1938
1750 1751
1814 1812
1420 1425
311 312
346 347
1143 1141
929 930
52 51
1740 1739
444 442
1705 1704
864 860
1705 1708
1716 1712
225 224
629 627
1608 1605
570 569
993 990
488 487
1250 1252
1787 1790
1344 1343
1372 1374
481 480
678 677...

output:

-1 -1
856 857
-1 -1
783 784
565 565
1003 1003
172 172
1249 1249
288 288
1660 1660
-1 -1
459 459
1667 1667
972 972
1716 1716
-1 -1
430 430
-1 -1
1603 1603
1347 1347
106 107
868 868
-1 -1
-1 -1
172 172
953 953
1407 1407
313 313
-1 -1
204 204
898 898
-1 -1
1894 1894
-1 -1
235 235
92 93
537 537
1393 139...

result:

ok 992 lines

Test #62:

score: 0
Accepted
time: 3ms
memory: 27836kb

input:

2000 2000 2000
714 715
1565 1569
575 576
279 276
224 223
916 913
1660 1671
922 931
41 42
996 989
184 185
66 65
51 52
744 748
106 107
925 930
467 463
296 295
917 927
1436 1443
374 373
1978 1957
287 286
1417 1403
818 819
712 713
1661 1652
305 306
1802 1800
1316 1313
970 969
965 967
392 388
334 331
125...

output:

-1 -1
-1 -1
1443 1443
-1 -1
-1 -1
699 699
719 720
518 519
150 150
1988 1988
681 681
507 507
316 316
1351 1351
1504 1504
1482 1482
625 625
1239 1240
1412 1412
-1 -1
-1 -1
1191 1191
352 352
1243 1244
-1 -1
496 496
1335 1335
1324 1324
-1 -1
396 397
-1 -1
993 993
-1 -1
249 250
-1 -1
1341 1342
1398 1398
...

result:

ok 995 lines

Test #63:

score: 0
Accepted
time: 6ms
memory: 27884kb

input:

2000 2000 2000
1 1462
1 946
1573 6
3 1090
1670 3
1 1270
1 168
1737 2
1 278
510 2
1408 1
1 1604
2 877
1271 2
1 441
1 153
186 1
3 823
2 471
592 1
1322 1
1 1026
1 504
1 145
654 1
347 1
1 1072
3 1732
1 528
1076 2
718 1
2 1793
137 1
1 1885
1 40
1266 2
1046 1
272 1
2 1165
219 1
1280 1
1 1196
1 1545
1 384
...

output:

-1 -1
1256 1257
388 389
1280 1281
778 778
815 816
111 111
-1 -1
398 399
-1 -1
49 50
208 209
877 878
481 482
111 111
1514 1515
838 839
652 653
511 512
275 276
369 370
111 111
-1 -1
98 99
145 146
111 111
191 192
-1 -1
814 815
-1 -1
510 511
1305 1306
-1 -1
913 914
855 856
-1 -1
-1 -1
797 798
717 718
16...

result:

ok 1028 lines

Test #64:

score: 0
Accepted
time: 4ms
memory: 27824kb

input:

2000 2000 2000
363 365
1406 1407
1634 1653
430 431
1015 1016
206 205
1422 1423
225 224
794 796
503 505
799 800
1321 1322
1314 1315
1860 1856
1699 1701
1991 1996
1583 1578
408 407
288 289
920 917
1891 1896
1472 1474
1021 1019
797 804
809 806
343 342
937 936
280 279
682 684
1064 1061
1748 1750
1375 13...

output:

201 201
1226 1226
335 335
1409 1409
570 571
715 716
1716 1716
1180 1180
1110 1111
351 351
207 208
1459 1459
460 460
1786 1786
1485 1485
-1 -1
-1 -1
1914 1914
493 494
1210 1210
1331 1331
-1 -1
-1 -1
-1 -1
-1 -1
201 201
-1 -1
1113 1113
-1 -1
1202 1202
1986 1987
-1 -1
-1 -1
786 786
768 768
1572 1572
-1...

result:

ok 1037 lines

Test #65:

score: 0
Accepted
time: 6ms
memory: 27816kb

input:

2000 2000 2000
1010 1
358 1
1 668
1 1954
1053 1
1322 1
1 1388
1 1329
1 517
134 1
1 1697
1375 1
2 1261
1488 1
382 1
1 483
1 363
2 1685
1 1360
159 1
1255 1
3 1994
157 1
453 1
1631 1
1 1000
1 1075
2 780
654 2
1234 1
1 644
1 1333
1 1385
1 1667
613 1
1 652
1 1869
1 1890
1807 1
862 1
1273 1
1 73
1 1540
1 ...

output:

483 484
-1 -1
122 123
-1 -1
953 954
-1 -1
-1 -1
22 23
866 867
493 494
665 666
228 229
1386 1387
-1 -1
1 2
463 464
14 15
530 531
-1 -1
207 208
317 318
582 583
323 324
71 72
1265 1266
1001 1002
214 215
162 163
-1 -1
950 951
-1 -1
111 112
599 600
-1 -1
781 782
1447 1448
260 261
928 929
205 206
64 65
34...

result:

ok 1000 lines

Test #66:

score: 0
Accepted
time: 3ms
memory: 27844kb

input:

2000 2000 2000
1499 1502
1145 1146
348 347
20 19
772 776
1773 1772
855 854
1779 1781
1742 1746
1504 1503
1010 1009
824 823
147 148
845 846
1020 1021
1946 1945
243 244
681 682
1419 1418
1697 1692
1476 1475
643 645
1846 1847
712 711
1982 1981
1531 1532
1826 1825
1949 1950
408 407
826 828
1433 1437
289...

output:

615 615
88 88
-1 -1
566 566
915 915
814 814
-1 -1
1963 1964
117 117
-1 -1
533 533
591 591
1759 1759
-1 -1
701 701
766 766
944 944
1678 1679
-1 -1
1362 1363
1797 1798
909 909
1896 1896
478 478
1648 1648
-1 -1
-1 -1
698 698
775 775
-1 -1
236 236
1845 1845
101 101
1468 1468
1170 1170
308 308
-1 -1
1522...

result:

ok 1000 lines

Test #67:

score: 0
Accepted
time: 4ms
memory: 27828kb

input:

2000 2000 2000
119 22
899 1850
475 263
1247 1137
278 838
247 170
245 292
1673 58
220 306
124 1396
922 815
872 1666
1331 275
1674 481
982 1438
19 8
604 23
2 65
1307 978
1866 948
163 1838
227 276
1191 1117
393 282
975 69
106 18
1398 1431
627 1227
654 347
1748 169
236 598
45 142
1405 1177
113 4
1195 57...

output:

-1 -1
792 793
-1 -1
296 297
941 942
-1 -1
467 468
1797 1798
1351 1352
1370 1371
856 857
200 201
1125 1126
-1 -1
358 359
40 41
440 441
978 979
-1 -1
230 231
487 488
-1 -1
477 478
17 18
-1 -1
-1 -1
27 28
231 232
390 391
1226 1226
-1 -1
-1 -1
705 706
103 104
-1 -1
567 568
230 231
312 313
475 476
850 85...

result:

ok 1000 lines

Test #68:

score: 0
Accepted
time: 4ms
memory: 27764kb

input:

2000 2000 2000
883 879
901 900
1458 1460
1655 1656
872 871
37 36
730 731
1537 1536
692 695
1300 1305
838 837
1814 1806
1339 1346
1646 1643
586 584
168 169
608 609
255 254
1513 1511
1973 1976
285 287
1299 1301
500 501
1173 1174
1161 1155
334 333
1225 1228
185 186
320 321
391 392
558 559
1836 1826
124...

output:

-1 -1
875 875
1797 1797
120 121
1704 1705
-1 -1
1369 1369
405 405
-1 -1
1414 1415
1504 1505
554 554
-1 -1
959 959
255 255
-1 -1
1987 1987
1750 1751
-1 -1
-1 -1
1990 1990
-1 -1
-1 -1
1837 1838
1793 1793
748 748
-1 -1
1945 1946
1070 1070
-1 -1
377 377
-1 -1
155 155
-1 -1
1204 1204
537 537
987 987
423 ...

result:

ok 1000 lines

Test #69:

score: 0
Accepted
time: 0ms
memory: 27828kb

input:

2000 2000 2000
392 109
1664 1297
1693 1752
1933 1267
1731 1771
1729 1424
1039 1405
1654 1745
145 548
142 240
759 311
717 481
153 105
1298 1658
1290 1351
306 280
585 650
1063 1048
1295 1945
12 680
1036 1008
1836 1156
47 607
7 743
1006 1010
20 60
1911 1756
267 572
1495 1290
1947 1456
43 25
773 803
77 ...

output:

999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999...

result:

ok 2000 lines

Test #70:

score: 0
Accepted
time: 4ms
memory: 27748kb

input:

2000 2000 2000
494 258
366 388
2000 1927
13 4
777 712
1063 1843
460 966
135 68
80 143
805 979
1457 1297
1088 1105
64 31
818 851
228 210
1264 1861
1694 1491
570 857
250 164
1144 1010
1348 1269
58 715
1140 1097
133 635
189 279
1685 1700
451 959
432 237
1198 1550
1891 1490
504 536
1001 1
1034 1004
1012...

output:

999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999...

result:

ok 2000 lines

Test #71:

score: 0
Accepted
time: 4ms
memory: 27804kb

input:

2000 2000 2000
1256 1216
139 98
1480 1150
1542 1988
1208 1349
1624 1497
275 549
1573 1117
1203 1718
1138 1149
1607 1272
1275 1249
1145 1360
562 390
192 738
16 97
1447 1092
1085 1046
421 125
594 723
351 62
1999 1897
759 32
1090 1143
1014 1725
1044 1265
1440 1088
39 596
1421 1360
10 11
1247 1513
821 3...

output:

999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999...

result:

ok 2000 lines

Test #72:

score: 0
Accepted
time: 16ms
memory: 27828kb

input:

2000 2000 2000
392 109
1664 1297
1693 1752
1933 1267
1731 1771
1729 1424
1039 1405
1654 1745
145 548
142 240
759 311
717 481
153 105
1298 1658
1290 1351
306 280
585 650
1063 1048
1295 1945
12 680
1036 1008
1836 1156
47 607
7 743
1006 1010
20 60
1911 1756
267 572
1495 1290
1947 1456
43 25
773 803
77 ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 2000 lines

Test #73:

score: 0
Accepted
time: 3ms
memory: 27808kb

input:

2000 2000 2000
494 258
366 388
2000 1927
13 4
777 712
1063 1843
460 966
135 68
80 143
805 979
1457 1297
1088 1105
64 31
818 851
228 210
1264 1861
1694 1491
570 857
250 164
1144 1010
1348 1269
58 715
1140 1097
133 635
189 279
1685 1700
451 959
432 237
1198 1550
1891 1490
504 536
1001 1
1034 1004
1012...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 2000 lines

Test #74:

score: 0
Accepted
time: 4ms
memory: 27692kb

input:

1844 1948 1651
1 498
1503 1
1 431
1224 1
3 1417
1832 1
1050 1
1 1059
1 1189
2 1633
1 252
1448 1
1 877
329 1
465 1
696 1
1109 1
1 839
1 829
1 935
541 2
1 1292
29 1
16 1
1 1252
1 558
1 1775
1 1311
1 1497
2 1496
1235 3
1657 1
1 1661
1 420
533 1
1 1201
1476 1
939 1
1196 1
1565 1
885 1
1 1372
226 1
1 170...

output:

575 575
575 575
-1 -1
575 575
575 575
1132 1132
-1 -1
-1 -1
575 575
575 575
1277 1278
575 575
575 575
106 107
1132 1132
1132 1132
1501 1502
575 575
1132 1132
575 575
575 575
1243 1244
1132 1132
-1 -1
575 575
575 575
575 575
1039 1040
575 575
575 575
-1 -1
575 575
575 575
-1 -1
-1 -1
-1 -1
575 575
57...

result:

ok 819 lines

Test #75:

score: 0
Accepted
time: 3ms
memory: 27844kb

input:

2000 2000 2000
1256 1216
139 98
1480 1150
1542 1988
1208 1349
1624 1497
275 549
1573 1117
1203 1718
1138 1149
1607 1272
1275 1249
1145 1360
562 390
192 738
16 97
1447 1092
1085 1046
421 125
594 723
351 62
1999 1897
759 32
1090 1143
1014 1725
1044 1265
1440 1088
39 596
1421 1360
10 11
1247 1513
821 3...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 2000 lines

Test #76:

score: 0
Accepted
time: 3ms
memory: 27736kb

input:

2000 2000 2000
392 109
1664 1297
1693 1752
1933 1267
1731 1771
1729 1424
1039 1405
1654 1745
145 548
142 240
759 311
717 481
153 105
1298 1658
1290 1351
306 280
585 650
1063 1048
1295 1945
12 680
1036 1008
1836 1156
47 607
7 743
1006 1010
20 60
1911 1756
267 572
1495 1290
1947 1456
43 25
773 803
77 ...

output:

999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999...

result:

ok 988 lines

Test #77:

score: 0
Accepted
time: 7ms
memory: 27808kb

input:

2000 2000 2000
494 258
366 388
2000 1927
13 4
777 712
1063 1843
460 966
135 68
80 143
805 979
1457 1297
1088 1105
64 31
818 851
228 210
1264 1861
1694 1491
570 857
250 164
1144 1010
1348 1269
58 715
1140 1097
133 635
189 279
1685 1700
451 959
432 237
1198 1550
1891 1490
504 536
1001 1
1034 1004
1012...

output:

999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999...

result:

ok 989 lines

Test #78:

score: 0
Accepted
time: 3ms
memory: 27820kb

input:

2000 2000 2000
1256 1216
139 98
1480 1150
1542 1988
1208 1349
1624 1497
275 549
1573 1117
1203 1718
1138 1149
1607 1272
1275 1249
1145 1360
562 390
192 738
16 97
1447 1092
1085 1046
421 125
594 723
351 62
1999 1897
759 32
1090 1143
1014 1725
1044 1265
1440 1088
39 596
1421 1360
10 11
1247 1513
821 3...

output:

999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999...

result:

ok 1045 lines

Test #79:

score: 0
Accepted
time: 0ms
memory: 27836kb

input:

2000 2000 2000
1 235
2 773
1 1332
469 1
2 1987
496 1
938 1
1 1559
1521 2
1 67
1 513
1 950
1 431
781 1
1 89
31 1
1358 1
1 1453
2 2000
1 1782
33 1
2 1795
1 205
2 738
385 1
1 1073
851 1
987 1
4 703
1 1097
1 628
1363 1
1207 1
1 1434
3 1745
1 386
984 2
1 939
1777 5
2 1581
1 130
398 1
1804 1
1 1013
1256 1...

output:

-1 -1
-1 -1
-1 -1
-1 -1
539 540
1018 1018
1018 1018
1018 1018
1018 1018
59 60
-1 -1
1018 1018
681 681
-1 -1
1104 1104
1545 1546
-1 -1
-1 -1
320 320
320 320
-1 -1
320 320
-1 -1
681 681
-1 -1
1216 1217
1018 1018
681 681
681 681
-1 -1
173 173
-1 -1
-1 -1
-1 -1
-1 -1
681 681
-1 -1
-1 -1
681 681
1018 101...

result:

ok 986 lines

Test #80:

score: 0
Accepted
time: 3ms
memory: 27928kb

input:

2000 2000 2000
995 997
1188 1189
688 687
1900 1898
184 185
1493 1492
149 150
90 89
1433 1434
908 907
1033 1032
183 184
1693 1691
675 674
191 192
1628 1632
1046 1047
1637 1636
1707 1708
1737 1735
378 377
1847 1846
1240 1241
1330 1331
846 845
380 379
1516 1518
1358 1357
1766 1767
392 393
1061 1062
536...

output:

330 330
417 417
1150 1150
39 39
722 722
-1 -1
-1 -1
1668 1668
875 875
1631 1631
1525 1525
-1 -1
304 304
1161 1161
1924 1924
1411 1411
1475 1475
1335 1335
-1 -1
1238 1238
369 369
-1 -1
1764 1764
-1 -1
1187 1187
-1 -1
9 9
-1 -1
225 225
711 711
1393 1394
-1 -1
901 901
1204 1204
-1 -1
-1 -1
1055 1055
18...

result:

ok 974 lines

Test #81:

score: 0
Accepted
time: 4ms
memory: 27836kb

input:

2000 2000 2000
1289 1291
1517 1518
795 793
1523 1527
902 908
501 502
1062 1065
1698 1694
886 887
1543 1536
197 198
1021 1020
1208 1209
96 95
1334 1333
1112 1110
1628 1627
341 342
1255 1264
120 121
1144 1145
151 150
222 223
1595 1598
1476 1477
315 318
1867 1863
71 70
1866 1860
518 517
822 817
1444 14...

output:

1134 1134
1620 1620
-1 -1
1565 1565
846 846
1157 1158
-1 -1
-1 -1
995 995
1554 1554
1710 1710
-1 -1
1469 1469
213 213
1280 1281
1979 1979
1280 1281
-1 -1
1126 1126
-1 -1
963 963
1092 1092
625 626
431 431
75 75
-1 -1
-1 -1
-1 -1
-1 -1
1308 1309
619 619
-1 -1
306 307
1211 1212
605 605
-1 -1
-1 -1
251 ...

result:

ok 995 lines

Test #82:

score: 0
Accepted
time: 9ms
memory: 27900kb

input:

2000 2000 2000
1539 1
1158 1
1 957
3 1635
148 1
1196 1
1948 1
2 1414
1 534
4 1244
839 1
1 282
2 650
488 1
2 1074
225 1
49 1
1 1957
549 1
231 1
171 1
663 1
1 1139
253 1
636 1
1062 2
1 809
1 1278
987 1
1 1125
1 1137
1 830
1 379
1 539
372 1
1442 2
1107 1
479 1
2 1669
430 1
1686 1
3 1433
186 1
1823 2
52...

output:

1518 1518
495 496
1518 1518
-1 -1
1518 1518
1518 1518
-1 -1
1518 1518
1518 1518
-1 -1
-1 -1
-1 -1
1518 1518
-1 -1
1518 1518
664 665
-1 -1
-1 -1
1518 1518
1518 1518
1518 1518
1518 1518
-1 -1
43 44
1518 1518
-1 -1
167 168
1518 1518
1518 1518
1518 1518
-1 -1
1518 1518
1518 1518
-1 -1
1518 1518
318 319
...

result:

ok 1008 lines

Test #83:

score: 0
Accepted
time: 8ms
memory: 27808kb

input:

2000 2000 2000
481 480
598 599
1268 1270
357 356
47 48
1357 1359
76 77
273 272
1298 1296
561 560
1624 1618
1119 1118
622 623
1203 1204
344 345
1215 1217
1547 1548
1664 1656
482 483
685 686
740 737
100 99
1474 1473
515 514
131 132
678 679
915 916
61 62
617 616
451 452
306 305
546 545
1482 1484
1286 1...

output:

-1 -1
412 412
924 924
-1 -1
456 456
1439 1439
-1 -1
-1 -1
211 211
-1 -1
963 963
761 761
-1 -1
799 799
564 564
-1 -1
75 75
995 995
-1 -1
-1 -1
-1 -1
1958 1958
351 351
-1 -1
1161 1161
1216 1216
989 989
-1 -1
768 768
845 845
-1 -1
1441 1441
-1 -1
1285 1286
-1 -1
1439 1439
989 989
96 96
1387 1388
-1 -1
...

result:

ok 984 lines

Test #84:

score: 0
Accepted
time: 3ms
memory: 27776kb

input:

2000 2000 2000
1 1462
1 946
1573 6
3 1090
1670 3
1 1270
1 168
1737 2
1 278
510 2
1408 1
1 1604
2 877
1271 2
1 441
1 153
186 1
3 823
2 471
592 1
1322 1
1 1026
1 504
1 145
654 1
347 1
1 1072
3 1732
1 528
1076 2
718 1
2 1793
137 1
1 1885
1 40
1266 2
1046 1
272 1
2 1165
219 1
1280 1
1 1196
1 1545
1 384
...

output:

-1 -1
-1 -1
-1 -1
1744 1744
1447 1447
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
747 747
-1 -1
1451 1451
79 79
-1 -1
-1 -1
-1 -1
-1 -1
843 843
929 929
201 201
-1 -1
1001 1001
-1 -1
1407 1407
-1 -1
-1 -1
1749 1749
-1 -1
1520 1520
-1 -1
-1 -1
-1 -1
-1 -1
218 218
-1 -1
1270 1270
523 523
-1 -1
-1 -1
-1 -...

result:

ok 965 lines

Test #85:

score: 0
Accepted
time: 8ms
memory: 27900kb

input:

2000 2000 2000
1006 1007
745 751
1905 1901
1382 1378
43 42
1790 1786
1927 1931
61 62
1325 1320
1244 1234
1884 1885
198 197
687 683
1282 1287
1870 1848
785 794
1897 1881
1708 1703
1470 1462
726 722
1097 1095
815 807
827 830
1775 1779
1980 1979
1485 1472
1523 1527
879 873
802 803
262 261
90 91
1145 11...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1120 1120
-1 -1
-1 -1
-1 -1
293 293
-1 -1
-1 -1
-1 -1
1576 1576
1239 1239
589 589
-1 -1
1020 1020
-1 -1
-1 -1
887 887
1747 1747
1319 1319
-1 -1
-1 -1
-1 -1
825 825
-1 -1
-1 -1
-1 -1
-1 -1
278 278
-1 -1
1290 1290
-1 -1
1392 1393
-1 -1
-1 -1
1353 1353
-1 -1
1469 1469
9 9
...

result:

ok 997 lines

Test #86:

score: 0
Accepted
time: 3ms
memory: 27896kb

input:

2000 2000 2000
714 715
1565 1569
575 576
279 276
224 223
916 913
1660 1671
922 931
41 42
996 989
184 185
66 65
51 52
744 748
106 107
925 930
467 463
296 295
917 927
1436 1443
374 373
1978 1957
287 286
1417 1403
818 819
712 713
1661 1652
305 306
1802 1800
1316 1313
970 969
965 967
392 388
334 331
125...

output:

-1 -1
575 575
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
337 337
-1 -1
969 969
-1 -1
502 502
854 854
-1 -1
-1 -1
-1 -1
-1 -1
636 636
280 280
-1 -1
1349 1349
695 695
1046 1047
-1 -1
1117 1117
-1 -1
-1 -1
-1 -1
-1 -1
276 277
-1 -1
1062 1062
-1 -1
922 922
-1 -1
120 120
-1 -1
1626 1626
-1 -1
-1 -1
-1 -1
243 24...

result:

ok 1001 lines

Test #87:

score: 0
Accepted
time: 4ms
memory: 27824kb

input:

2000 2000 2000
1735 2
1165 2
819 1
4 1497
4 1863
1 1036
2 1148
354 2
187 2
2 294
1040 5
1 19
1366 1
940 2
873 2
1367 4
4 1947
1206 8
7 1517
1915 16
168 1
1 96
1182 5
1151 2
1808 4
1 1981
2 1358
2 1260
747 3
2 839
173 1
1 87
1068 1
2 1125
1074 4
1916 4
74 1
9 1078
1 16
3 882
1 365
494 1
387 1
1380 7
...

output:

1050 1050
-1 -1
1316 1316
-1 -1
-1 -1
-1 -1
-1 -1
1342 1342
-1 -1
-1 -1
-1 -1
-1 -1
551 551
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
590 590
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
970 970
1475 1475
-1 -1
970 970
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1179 1179
-1...

result:

ok 1007 lines

Test #88:

score: 0
Accepted
time: 3ms
memory: 27856kb

input:

2000 2000 2000
1460 1461
892 891
49 48
1046 1047
290 289
656 657
359 360
1383 1384
1552 1551
1679 1678
1022 1023
930 931
1290 1289
1394 1393
977 978
1581 1582
1078 1077
688 689
1164 1165
528 529
1097 1098
216 217
1270 1269
1328 1327
752 753
1305 1306
1016 1017
564 565
130 131
795 794
1967 1966
1328 ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 1007 lines

Test #89:

score: 0
Accepted
time: 3ms
memory: 27940kb

input:

2000 2000 2000
1346 1345
180 181
654 653
1732 1731
1664 1665
1982 1981
146 145
1297 1296
641 640
1622 1621
1053 1054
1975 1976
690 689
389 390
1131 1132
1752 1753
400 401
870 869
310 311
924 923
924 925
1118 1119
1658 1659
602 603
826 825
1674 1675
1501 1500
967 968
1095 1094
717 718
839 838
849 850...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 999 lines

Test #90:

score: 0
Accepted
time: 8ms
memory: 27852kb

input:

2000 2000 2000
1461 1460
892 891
49 48
1047 1046
290 289
657 656
360 359
1384 1383
1552 1551
1679 1678
1023 1022
931 930
1290 1289
1394 1393
978 977
1582 1581
1078 1077
689 688
1165 1164
529 528
1098 1097
217 216
1270 1269
1328 1327
753 752
1306 1305
1017 1016
565 564
131 130
795 794
1967 1966
1329 ...

output:

999 1000
999 1000
999 1000
999 1000
-1 -1
-1 -1
-1 -1
999 1000
-1 -1
-1 -1
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
999 1000
-1 -1
999 1000
999 1000
-1 -1
-1 -1
-1 -1
999 1000
999 1000
999 1000
999 1000
999 1000
-1 -1
999 1000
999 1000
999 1000
999 1000
-1 -1
...

result:

ok 988 lines

Test #91:

score: 0
Accepted
time: 0ms
memory: 27824kb

input:

2000 2000 2000
121 175
402 513
1251 94
323 157
292 522
937 784
897 103
164 1234
91 448
468 1973
1862 356
1121 903
294 300
377 772
975 1986
349 259
884 1096
550 1324
558 519
100 57
638 1072
911 386
792 522
444 63
223 258
1588 1984
1332 914
967 1334
443 55
2 1
74 43
134 1349
1126 1082
424 102
319 137
...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 2000 lines

Subtask #4:

score: 44
Accepted

Test #92:

score: 44
Accepted
time: 415ms
memory: 116372kb

input:

200000 200000 200000
6 145055
13 158705
103390 2
122835 9
5357 1
152789 4
11 95208
13 191082
7 119987
14 87414
3 75783
68281 12
1 6544
166920 15
70312 9
15 175178
2472 1
6 112219
69710 14
4 42989
27 166753
5 20509
164987 9
25454 2
6 65689
28773 3
5639 2
130989 18
144899 8
162589 33
30 191496
11 8018...

output:

51644 51645
119664 119664
119598 119598
119598 119598
-1 -1
27209 27210
153253 153254
119598 119598
119598 119598
58254 58255
-1 -1
125933 125934
-1 -1
51113 51114
119598 119598
79385 79385
131260 131261
-1 -1
-1 -1
22097 22098
119598 119598
87122 87123
119598 119598
119598 119598
-1 -1
119598 11959...

result:

ok 100247 lines

Test #93:

score: 0
Accepted
time: 359ms
memory: 119092kb

input:

200000 200000 200000
197327 197323
192711 192716
24685 24686
174109 174112
140063 140056
186287 186289
131747 131746
193603 193596
198886 198889
150606 150604
114573 114574
73773 73772
12596 12597
167037 167038
125524 125520
163783 163786
72703 72702
101225 101220
124895 124898
137359 137362
195848 ...

output:

-1 -1
36690 36691
35522 35522
77370 77371
5763 5763
83228 83228
147884 147884
135820 135821
130276 130276
174718 174719
127773 127773
97322 97322
169173 169173
-1 -1
-1 -1
67538 67538
148373 148373
190053 190053
152810 152810
58940 58941
93470 93470
160830 160830
92047 92047
59065 59065
192664 19266...

result:

ok 99847 lines

Test #94:

score: 0
Accepted
time: 348ms
memory: 121272kb

input:

200000 200000 200000
198581 198584
101716 101717
144590 144591
49692 49691
135801 135803
59994 59995
126614 126613
183495 183496
70459 70458
15801 15800
34615 34616
600 601
149505 149506
34204 34205
93048 93049
181014 181012
58116 58115
96365 96363
49748 49746
94032 94031
19674 19675
45426 45425
178...

output:

59139 59139
-1 -1
116447 116447
20111 20111
181945 181945
139414 139414
140436 140437
-1 -1
-1 -1
111096 111096
-1 -1
119517 119517
-1 -1
52628 52629
171421 171421
101362 101362
161093 161093
15652 15652
130347 130348
48263 48263
32145 32145
-1 -1
69958 69958
176250 176250
70317 70317
108507 108507
...

result:

ok 99490 lines

Test #95:

score: 0
Accepted
time: 439ms
memory: 116100kb

input:

200000 200000 200000
1 44135
2 122482
179000 1
19788 1
2 157166
1 8353
1 11874
1 162746
1 22560
32364 1
2 135156
17927 1
1 44935
1 19228
73709 1
1 89454
92519 1
117965 1
1 24989
180261 2
22543 1
1090 1
183471 1
1 192257
182909 1
1399 1
3 190647
2 198985
1 37926
198542 1
1 59508
166233 4
2 109525
1 8...

output:

11554 11555
78649 78649
78649 78649
83701 83702
137971 137972
78649 78649
78649 78649
78649 78649
150093 150094
78649 78649
78649 78649
-1 -1
78649 78649
80284 80285
-1 -1
-1 -1
82724 82725
16296 16297
113629 113630
-1 -1
-1 -1
78649 78649
1028 1029
112548 112549
103491 103492
-1 -1
-1 -1
78649 7864...

result:

ok 99721 lines

Test #96:

score: 0
Accepted
time: 426ms
memory: 116312kb

input:

200000 200000 200000
2 102344
65144 1
53472 1
1 196968
1 172486
1 152196
1 106880
151679 3
92743 1
2 152136
1 119918
1 21446
2 128624
168892 3
189470 1
3 190287
174599 1
31752 1
1 40994
109665 1
26120 1
70471 1
1 67872
148088 1
2 106045
1 74022
1 68899
1 75391
74126 1
1 68554
1 110580
1 173882
1 608...

output:

167960 167960
-1 -1
100394 100394
967 968
100394 100394
-1 -1
-1 -1
100394 100394
167960 167960
1017 1018
100394 100394
100394 100394
100394 100394
167960 167960
-1 -1
-1 -1
100394 100394
155516 155516
-1 -1
100394 100394
-1 -1
9618 9619
100394 100394
100394 100394
-1 -1
100394 100394
-1 -1
100394 1...

result:

ok 99889 lines

Test #97:

score: 0
Accepted
time: 419ms
memory: 118468kb

input:

200000 200000 200000
146508 146523
185513 185518
79011 79012
6002 6003
193149 193150
76517 76519
158356 158355
113199 113203
10132 10131
22110 22111
24919 24920
2539 2538
130395 130380
170639 170638
174853 174829
7951 7950
101201 101200
72756 72754
112201 112204
941 940
171059 171063
5628 5627
71422...

output:

-1 -1
116602 116602
109209 109210
-1 -1
12506 12507
-1 -1
-1 -1
5684 5685
14885 14885
162453 162453
174077 174077
70109 70109
50811 50811
132370 132371
32500 32501
-1 -1
70535 70535
33907 33908
118910 118910
-1 -1
-1 -1
59615 59615
-1 -1
22486 22487
128864 128865
94162 94162
40567 40567
-1 -1
3848 3...

result:

ok 100079 lines

Test #98:

score: 0
Accepted
time: 428ms
memory: 116220kb

input:

200000 200000 200000
1 29946
89366 1
1 847
9587 1
1 43295
105625 1
2 35098
118150 2
1 26173
1 18383
2 149968
1 24513
14175 1
141447 1
77283 1
1 93016
70981 1
1 182702
1 191379
46106 1
125110 1
2 172333
95404 2
166183 3
78947 2
2 182336
1 10717
1 81024
1 78129
191138 4
3 111406
36371 1
64831 1
33887 ...

output:

155191 155191
155191 155191
155191 155191
155191 155191
1133 1134
12421 12422
155191 155191
155191 155191
155191 155191
155191 155191
155191 155191
155191 155191
155191 155191
82395 82396
-1 -1
155191 155191
185574 185575
19 20
33653 33653
176237 176238
155191 155191
155191 155191
-1 -1
32567 32568
...

result:

ok 100000 lines

Test #99:

score: 0
Accepted
time: 476ms
memory: 116148kb

input:

200000 200000 200000
7133 64560
163531 72546
796 22653
94057 69495
69034 131487
932 47226
31629 88389
21280 127027
44849 31927
167661 96248
32051 7852
31122 13619
188553 128120
14231 69287
92587 71367
101815 3701
44357 119724
10783 157959
35198 58167
48002 85335
105778 69021
162158 15633
19888 10949...

output:

117913 117913
86151 86152
-1 -1
63019 63020
156801 156802
95957 95958
117913 117913
9561 9562
117913 117913
140578 140579
2473 2474
-1 -1
58893 58894
117913 117913
121815 121816
102814 102815
117913 117913
26451 26452
-1 -1
-1 -1
-1 -1
117913 117913
36301 36302
-1 -1
80340 80341
117913 117913
40155 ...

result:

ok 100000 lines

Test #100:

score: 0
Accepted
time: 445ms
memory: 116576kb

input:

200000 200000 200000
122240 3
75449 2
186949 1
56217 1
190363 10
1 84725
106626 3
5 152269
147396 1
71581 1
8 122656
4 72452
8 149011
5 69886
109294 1
134362 3
145573 13
5 157810
1 160476
113725 3
134409 2
1080 1
96357 3
163540 1
1 7082
61992 2
51952 1
2 19461
25217 1
1 93965
38552 1
1 78765
1 3037
...

output:

167056 167056
-1 -1
167056 167056
4556 4557
167056 167056
104779 104780
-1 -1
167056 167056
167056 167056
39422 39423
167056 167056
167056 167056
-1 -1
-1 -1
6419 6420
167056 167056
-1 -1
167056 167056
-1 -1
167056 167056
5070 5071
-1 -1
167056 167056
167056 167056
167056 167056
18529 18530
31171 31...

result:

ok 100000 lines

Test #101:

score: 0
Accepted
time: 381ms
memory: 122140kb

input:

200000 200000 200000
178761 178760
81486 81487
198961 198962
125038 125039
89278 89277
192072 192073
21674 21675
47556 47555
21891 21890
46570 46571
120027 120026
171827 171828
130346 130347
3147 3146
21264 21265
175718 175717
162218 162217
5025 5024
47976 47977
181074 181073
192387 192385
103960 10...

output:

133371 133371
57947 57947
-1 -1
113436 113436
96309 96309
130233 130233
51031 51031
60671 60671
-1 -1
-1 -1
60915 60915
80672 80672
2443 2443
151489 151489
157738 157738
199043 199043
24488 24488
39198 39198
116492 116492
-1 -1
101035 101035
7420 7420
-1 -1
-1 -1
126326 126326
24444 24444
51873 5187...

result:

ok 100000 lines

Test #102:

score: 0
Accepted
time: 255ms
memory: 116212kb

input:

200000 200000 200000
120576 165391
178560 163657
119678 109211
151212 172030
100260 100153
93664 64216
182359 103007
114624 103692
155550 107618
4556 34041
156678 102246
5896 13822
103534 117315
128257 144166
84540 52080
21331 10762
44450 88818
138761 197491
103096 110560
1038 608
124404 102717
8879...

output:

99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
9...

result:

ok 200000 lines

Test #103:

score: 0
Accepted
time: 245ms
memory: 116144kb

input:

200000 200000 200000
30821 31249
115469 111273
17444 81852
2477 524
156442 184395
28476 74222
12531 77422
284 530
5483 31212
147983 139058
115608 123264
129510 102634
1642 5075
26002 65633
69216 22831
157739 175390
2616 76194
67267 81163
122137 141380
130388 186563
123252 114240
9295 5650
171686 164...

output:

99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
9...

result:

ok 200000 lines

Test #104:

score: 0
Accepted
time: 234ms
memory: 116120kb

input:

200000 200000 200000
73793 27451
124569 125503
147442 112985
123040 151756
39181 34893
84824 38539
50388 50287
11004 519
121890 114081
47428 91334
181822 171215
91638 69209
162342 140315
14962 19837
172304 181823
137480 152433
57690 78559
50163 28331
44497 55492
100063 104656
10234 58665
4025 5479
9...

output:

99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
9...

result:

ok 200000 lines

Test #105:

score: 0
Accepted
time: 248ms
memory: 116264kb

input:

200000 200000 200000
120576 165391
178560 163657
119678 109211
151212 172030
100260 100153
93664 64216
182359 103007
114624 103692
155550 107618
4556 34041
156678 102246
5896 13822
103534 117315
128257 144166
84540 52080
21331 10762
44450 88818
138761 197491
103096 110560
1038 608
124404 102717
8879...

output:

89999 90000
29999 30000
79999 80000
49999 50000
39999 40000
39999 40000
9999 10000
9999 10000
69999 70000
99999 100000
99999 100000
79999 80000
99999 100000
69999 70000
49999 50000
69999 70000
39999 40000
89999 90000
29999 30000
99999 100000
19999 20000
89999 90000
49999 50000
-1 -1
99999 100000
599...

result:

ok 200000 lines

Test #106:

score: 0
Accepted
time: 248ms
memory: 116212kb

input:

200000 200000 200000
30821 31249
115469 111273
17444 81852
2477 524
156442 184395
28476 74222
12531 77422
284 530
5483 31212
147983 139058
115608 123264
129510 102634
1642 5075
26002 65633
69216 22831
157739 175390
2616 76194
67267 81163
122137 141380
130388 186563
123252 114240
9295 5650
171686 164...

output:

19999 20000
49999 50000
99999 100000
59999 60000
79999 80000
29999 30000
59999 60000
69999 70000
39999 40000
29999 30000
59999 60000
59999 60000
-1 -1
29999 30000
-1 -1
69999 70000
29999 30000
9999 10000
19999 20000
59999 60000
19999 20000
49999 50000
29999 30000
99999 100000
39999 40000
59999 60000...

result:

ok 200000 lines

Test #107:

score: 0
Accepted
time: 226ms
memory: 116192kb

input:

200000 200000 200000
73793 27451
124569 125503
147442 112985
123040 151756
39181 34893
84824 38539
50388 50287
11004 519
121890 114081
47428 91334
181822 171215
91638 69209
162342 140315
14962 19837
172304 181823
137480 152433
57690 78559
50163 28331
44497 55492
100063 104656
10234 58665
4025 5479
9...

output:

9999 10000
9999 10000
99999 100000
89999 90000
49999 50000
79999 80000
49999 50000
9999 10000
49999 50000
9999 10000
69999 70000
79999 80000
69999 70000
89999 90000
59999 60000
79999 80000
19999 20000
99999 100000
19999 20000
69999 70000
49999 50000
59999 60000
79999 80000
49999 50000
99999 100000
8...

result:

ok 200000 lines

Test #108:

score: 0
Accepted
time: 486ms
memory: 116264kb

input:

200000 200000 200000
120576 165391
178560 163657
119678 109211
151212 172030
100260 100153
93664 64216
182359 103007
114624 103692
155550 107618
4556 34041
156678 102246
5896 13822
103534 117315
128257 144166
84540 52080
21331 10762
44450 88818
138761 197491
103096 110560
1038 608
124404 102717
8879...

output:

99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
9...

result:

ok 100258 lines

Test #109:

score: 0
Accepted
time: 440ms
memory: 116216kb

input:

200000 200000 200000
30821 31249
115469 111273
17444 81852
2477 524
156442 184395
28476 74222
12531 77422
284 530
5483 31212
147983 139058
115608 123264
129510 102634
1642 5075
26002 65633
69216 22831
157739 175390
2616 76194
67267 81163
122137 141380
130388 186563
123252 114240
9295 5650
171686 164...

output:

99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
9...

result:

ok 100164 lines

Test #110:

score: 0
Accepted
time: 452ms
memory: 116132kb

input:

200000 200000 200000
73793 27451
124569 125503
147442 112985
123040 151756
39181 34893
84824 38539
50388 50287
11004 519
121890 114081
47428 91334
181822 171215
91638 69209
162342 140315
14962 19837
172304 181823
137480 152433
57690 78559
50163 28331
44497 55492
100063 104656
10234 58665
4025 5479
9...

output:

99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
99999 100000
9...

result:

ok 100202 lines

Test #111:

score: 0
Accepted
time: 494ms
memory: 116344kb

input:

200000 200000 200000
127413 1
139828 2
10429 1
4 196116
141265 1
1 96461
1 185980
74200 1
1 19879
1 66886
1 73274
1 73735
143805 2
1 150929
1 101566
1 196923
68159 1
1 13676
53552 1
46170 1
189945 1
79198 1
100140 1
182341 1
5 175180
156311 1
192402 3
95550 1
38383 1
165182 1
14426 1
171042 1
1 1245...

output:

-1 -1
136453 136453
158950 158951
136453 136453
136453 136453
-1 -1
136453 136453
-1 -1
-1 -1
136453 136453
42044 42045
136453 136453
136453 136453
136453 136453
20709 20710
-1 -1
136453 136453
74957 74958
-1 -1
136453 136453
28002 28003
67399 67400
136453 136453
2746 2747
-1 -1
109290 109290
109290...

result:

ok 99917 lines

Test #112:

score: 0
Accepted
time: 377ms
memory: 121504kb

input:

200000 200000 200000
23852 23851
81601 81602
179712 179711
147268 147269
60125 60124
151552 151554
199646 199648
123707 123706
22172 22171
119485 119484
88279 88280
27662 27663
156809 156810
77485 77484
180492 180493
177890 177889
104668 104669
172197 172196
190893 190892
49583 49582
171727 171726
8...

output:

19867 19867
-1 -1
-1 -1
77085 77085
67924 67924
139759 139759
72742 72742
-1 -1
111724 111724
91332 91332
-1 -1
-1 -1
147865 147865
-1 -1
-1 -1
12681 12681
60752 60752
105458 105458
-1 -1
-1 -1
184612 184612
49496 49496
116110 116110
-1 -1
-1 -1
113117 113117
-1 -1
-1 -1
-1 -1
-1 -1
76304 76304
-1 -...

result:

ok 100279 lines

Test #113:

score: 0
Accepted
time: 414ms
memory: 118556kb

input:

200000 200000 200000
129217 129215
87025 87029
22546 22547
46106 46107
187321 187308
154382 154383
13943 13944
152689 152681
168239 168242
122368 122366
134756 134754
140938 140940
176767 176768
185431 185430
40044 40045
100864 100854
33357 33356
161348 161344
105348 105341
13942 13943
21099 21100
3...

output:

182609 182610
40650 40650
-1 -1
29741 29741
-1 -1
49996 49996
114837 114838
-1 -1
-1 -1
110195 110195
-1 -1
-1 -1
-1 -1
81680 81680
154197 154197
56096 56096
21980 21981
-1 -1
29235 29236
-1 -1
-1 -1
-1 -1
-1 -1
5735 5736
-1 -1
12018 12018
199796 199796
102665 102665
124231 124231
27493 27494
-1 -1
...

result:

ok 99672 lines

Test #114:

score: 0
Accepted
time: 479ms
memory: 116304kb

input:

200000 200000 200000
1 44576
2 114279
92214 1
1 11915
1 18033
73476 1
162729 1
1 122605
79293 1
5031 1
1 58829
24958 1
1 101031
1 129797
2 60737
174057 3
1 19927
9664 1
1 110522
35489 1
92851 1
199141 1
2 184435
25202 1
1 42895
1 100030
1 10799
1 19466
100552 2
1 76105
156152 1
61597 1
86986 1
14318...

output:

129706 129707
63768 63769
-1 -1
-1 -1
83313 83314
-1 -1
58454 58454
-1 -1
121791 121792
58454 58454
-1 -1
-1 -1
58454 58454
150779 150780
-1 -1
58454 58454
-1 -1
86177 86178
-1 -1
58454 58454
58454 58454
85980 85981
30832 30832
-1 -1
-1 -1
-1 -1
-1 -1
58454 58454
-1 -1
179120 179120
166424 166425
-1...

result:

ok 100495 lines

Test #115:

score: 0
Accepted
time: 495ms
memory: 117072kb

input:

200000 200000 200000
1196 1195
167746 167758
77670 77686
145883 145904
104070 104046
95395 95397
54427 54446
12629 12626
16279 16284
42369 42380
118550 118541
23459 23458
136283 136280
184691 184700
162885 162910
75372 75384
114806 114813
100046 100058
177278 177311
190992 190993
13992 13991
149984 ...

output:

136840 136841
1734 1735
116008 116009
28480 28480
59315 59315
-1 -1
-1 -1
126854 126854
46168 46169
120673 120673
33247 33248
100409 100409
1030 1031
92243 92244
167727 167727
80623 80624
49810 49811
-1 -1
90476 90476
148451 148451
64761 64762
102081 102081
-1 -1
183919 183920
48071 48072
71308 7130...

result:

ok 99884 lines

Test #116:

score: 0
Accepted
time: 454ms
memory: 116244kb

input:

200000 200000 200000
1 167554
140795 1
4 137957
1 67195
14117 1
59787 1
1 172525
143895 1
1 34518
1 14216
162625 1
3 175869
50640 1
170074 2
2 129198
131474 2
57079 2
56958 1
65631 1
1 33446
1 80018
2 162256
64590 1
180045 2
1 26999
64736 2
154599 1
153024 2
2 174391
118516 1
1 65334
1 27260
1 27737...

output:

-1 -1
-1 -1
114445 114445
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
146366 146366
55128 55128
-1 -1
-1 -1
92724 92724
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
127563 127563
-1 -1
64339 64339
152834 152834
74412 74412
-1 -1
85323 85323
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
128889 128889
-1 -1
-1 -1
14872 14872
-1 -1
14...

result:

ok 100048 lines

Test #117:

score: 0
Accepted
time: 341ms
memory: 121764kb

input:

200000 200000 200000
95283 95284
129061 129062
116577 116576
143734 143733
98273 98274
193310 193309
13295 13296
157786 157787
184274 184275
71808 71807
107666 107665
179240 179241
62912 62911
48340 48341
107538 107537
86619 86618
67201 67200
104435 104436
145763 145762
14223 14222
52669 52668
7929 ...

output:

-1 -1
-1 -1
-1 -1
62795 62795
165974 165974
192526 192526
113310 113310
-1 -1
-1 -1
-1 -1
104116 104116
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
104855 104855
-1 -1
-1 -1
89940 89940
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
156190 156190
-1 -1
-1 -1
-1 -1
-1 -1
142710 142710
87601 87601
124686 124686
-1...

result:

ok 100524 lines

Test #118:

score: 0
Accepted
time: 408ms
memory: 117828kb

input:

200000 200000 200000
38229 38236
178417 178406
189077 189085
122438 122431
178364 178367
96661 96656
143127 143123
79689 79690
30001 30002
191545 191528
143903 143890
37522 37521
186517 186516
196216 196223
8645 8644
4175 4176
65463 65461
35636 35634
74281 74285
185215 185247
113498 113521
22708 227...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
23665 23665
-1 -1
121917 121917
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
124064 124064
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
159357 159357
-1 -1
-1 -1
84201 84201
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 99973 lines

Test #119:

score: 0
Accepted
time: 460ms
memory: 116192kb

input:

200000 200000 200000
120224 1
91192 1
15261 1
44301 1
41989 1
194708 1
164119 1
147846 2
55268 1
180945 1
1 79092
1 107916
197949 1
39366 1
1 122895
1 78955
1 59379
1 54612
1 44436
1 68277
148008 1
78686 2
1 144931
1 45141
129063 2
1 190629
1 86852
1 62150
1 188686
135901 1
85697 1
1 118137
1 52256
...

output:

-1 -1
169647 169647
-1 -1
63718 63718
134404 134404
89102 89102
-1 -1
174975 174975
94541 94541
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
56070 56070
-1 -1
-1 -1
2909 2909
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
155910 155910
43800 43800
111688 111688
-1 -1
-1 -1
157145 157145
-1 -1
-1 -1
81494 81494
-1 -1
156227 1...

result:

ok 100010 lines

Test #120:

score: 0
Accepted
time: 397ms
memory: 122156kb

input:

200000 200000 200000
17654 17655
113448 113449
165147 165148
140547 140548
118569 118568
143175 143176
38235 38234
94519 94518
18555 18556
3255 3256
190977 190978
167091 167092
123063 123062
79498 79497
90480 90479
154928 154927
35054 35053
87740 87741
172921 172920
148042 148043
17879 17880
103259 ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 99624 lines

Test #121:

score: 0
Accepted
time: 312ms
memory: 122220kb

input:

200000 200000 200000
57749 57750
29554 29555
117303 117304
53524 53523
66171 66172
6318 6317
51759 51760
97092 97091
145357 145356
130429 130428
171914 171915
90999 90998
79636 79637
173827 173828
103770 103769
109037 109036
101983 101982
62842 62841
11585 11584
79000 79001
185788 185787
149312 1493...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 99771 lines

Test #122:

score: 0
Accepted
time: 307ms
memory: 122240kb

input:

200000 200000 200000
17655 17654
113449 113448
165148 165147
140548 140547
118569 118568
143176 143175
38235 38234
94519 94518
18556 18555
3256 3255
190978 190977
167092 167091
123063 123062
79498 79497
90480 90479
154928 154927
35054 35053
87741 87740
172921 172920
148043 148042
17880 17879
103260 ...

output:

99999 100000
99999 100000
99999 100000
99999 100000
-1 -1
-1 -1
99999 100000
99999 100000
99999 100000
-1 -1
99999 100000
99999 100000
-1 -1
99999 100000
99999 100000
-1 -1
99999 100000
99999 100000
99999 100000
-1 -1
99999 100000
99999 100000
99999 100000
-1 -1
-1 -1
-1 -1
99999 100000
99999 100000...

result:

ok 99973 lines

Test #123:

score: 0
Accepted
time: 235ms
memory: 116208kb

input:

200000 200000 200000
20055 43142
173858 113633
98585 135545
38059 9142
22217 82014
78144 182683
147688 98099
28866 35663
29190 17660
29784 30975
47128 16943
13504 9830
161379 126042
14468 91315
5771 12673
87127 2819
22204 146920
119088 153648
2210 24502
131449 111984
21813 96505
176144 134501
51927 ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok 200000 lines

Test #124:

score: 0
Accepted
time: 82ms
memory: 44156kb

input:

25264 90057 65974
20427 20426
4303 4304
11291 11290
2535 2536
3789 3790
18723 18724
16591 16592
3817 3816
12020 12018
5743 5742
10003 10004
22820 22818
12008 12007
10436 10435
13773 13774
18057 18059
7854 7853
3325 3326
9571 9570
20307 20310
11635 11634
18880 18881
1361 1362
1029 1028
6566 6567
5340...

output:

15408 15408
80570 80570
71302 71302
48795 48795
18820 18820
40430 40430
68701 68701
42356 42356
41579 41579
30115 30115
58528 58528
49523 49523
8965 8965
4132 4132
55697 55697
3823 3823
11333 11333
-1 -1
-1 -1
13721 13721
51290 51290
15911 15911
2970 2970
51921 51921
41258 41258
49895 49895
45925 45...

result:

ok 32957 lines