QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#327233#3307. Query on a Tree 17james1BadCreeperAC ✓336ms31064kbC++143.0kb2024-02-14 20:46:332024-02-14 20:46:33

Judging History

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

  • [2024-02-14 20:46:33]
  • 评测
  • 测评结果:AC
  • 用时:336ms
  • 内存:31064kb
  • [2024-02-14 20:46:33]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std; 
typedef long long i64; 
const int N = 1e5 + 5; 

int n, q, f[17][N], sz[N], son[N];
int top[N], dfn[N], dep[N], num, idx[N];  
vector<int> G[N]; 

void dfs1(int x, int fa) {
    dep[x] = dep[f[0][x] = fa] + 1; sz[x] = 1; 
    for (int i = 1; i <= 16; ++i) f[i][x] = f[i - 1][f[i - 1][x]]; 
    for (int y : G[x]) if (y != fa) {
        dfs1(y, x); sz[x] += sz[y]; 
        if (sz[y] > sz[son[x]]) son[x] = y; 
    }
}
void dfs2(int x, int tp) {
    top[x] = tp; idx[dfn[x] = ++num] = x; 
    if (!son[x]) return; dfs2(son[x], tp); 
    for (int y : G[x]) if (y != son[x] && y != f[0][x]) dfs2(y, y); 
}

i64 T[N * 4], tag[N * 4]; 
inline void pushup(int o) { T[o] = T[o << 1] + T[o << 1 | 1]; }
inline void maketag(int o, int l, int r, int k) { T[o] += 1ll * (r - l + 1) * k; tag[o] += k; }
inline void pushdown(int o, int l, int r) {
    if (!tag[o]) return; int mid = l + r >> 1; 
    maketag(o << 1, l, mid, tag[o]); maketag(o << 1 | 1, mid + 1, r, tag[o]); 
    tag[o] = 0; 
}
void update(int o, int l, int r, int x, int y) {
    if (x <= l && r <= y) return maketag(o, l, r, 1), void(); 
    pushdown(o, l, r); int mid = l + r >> 1; 
    if (x <= mid) update(o << 1, l, mid, x, y); 
    if (mid < y) update(o << 1 | 1, mid + 1, r, x, y); 
    pushup(o); 
}
i64 query(int o, int l, int r, int x, int y) {
    if (x <= l && r <= y) return T[o]; 
    pushdown(o, l, r); int mid = l + r >> 1; i64 res = 0; 
    if (x <= mid) res += query(o << 1, l, mid, x, y); 
    if (mid < y) res += query(o << 1 | 1, mid + 1, r, x, y); 
    return res; 
}
int search(int o, int l, int r, i64 s) {
    if (l == r) return idx[l]; 
    pushdown(o, l, r); int mid = l + r >> 1; 
    if (s <= T[o << 1]) return search(o << 1, l, mid, s); 
    return search(o << 1 | 1, mid + 1, r, s - T[o << 1]); 
}

int main(void) {
    ios::sync_with_stdio(0); cin.tie(0); 
    cin >> n; 
    for (int i = 1; i < n; ++i) {
        int x, y; cin >> x >> y; 
        G[x].emplace_back(y); G[y].emplace_back(x); 
    }
    dfs1(1, 0); dfs2(1, 1); 
    cin >> q; 
    while (q--) {
        int op, x, y; cin >> op >> x; 
        if (op == 1) update(1, 1, n, dfn[x], dfn[x] + sz[x] - 1); 
        else {
            cin >> y; 
            while (top[x] != top[y]) {
                if (dep[top[x]] < dep[top[y]]) swap(x, y); 
                update(1, 1, n, dfn[top[x]], dfn[x]); 
                x = f[0][top[x]]; 
            }
            if (dep[x] < dep[y]) swap(x, y); 
            update(1, 1, n, dfn[y], dfn[x]); 
        }
        i64 sum = T[1] / 2 + 1; 
        x = search(1, 1, n, sum); 
        if (query(1, 1, n, dfn[x], dfn[x] + sz[x] - 1) >= sum) cout << x << '\n'; 
        else {
            for (int i = 16; i >= 0; --i) if (f[i][x]) {
                y = f[i][x]; 
                if (query(1, 1, n, dfn[y], dfn[y] + sz[y] - 1) < sum) x = y; 
            }
            cout << f[0][x] << '\n'; 
        }
    }
    return 0; 
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 6044kb

input:

7
1 6
1 7
7 3
3 2
7 5
5 4
4
1 2
1 4
1 6
2 6 7

output:

2
7
7
1

result:

ok 4 lines

Test #2:

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

input:

15
1 2
1 3
2 4
3 7
6 2
3 8
4 9
2 5
5 11
7 13
10 4
11 15
12 5
14 7
11
2 6 11
1 6
2 10 9
1 9
2 2 6
1 4
2 7 6
1 2
2 8 13
1 10
2 8 15

output:

2
2
2
2
2
2
2
2
2
2
2

result:

ok 11 lines

Test #3:

score: 0
Accepted
time: 1ms
memory: 6144kb

input:

2
1 2
1
1 1

output:

1

result:

ok single line: '1'

Test #4:

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

input:

2
1 2
1
2 1 2

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 2ms
memory: 6116kb

input:

100
1 2
58 2
2 87
63 87
65 63
65 19
6 87
58 21
87 8
87 74
91 6
95 65
2 61
87 59
3 61
37 87
67 87
23 2
63 9
87 46
40 67
70 2
12 58
46 75
75 36
28 3
12 33
72 87
39 6
75 52
85 70
1 76
26 40
47 28
2 49
41 65
66 28
51 37
15 47
86 51
8 60
97 19
48 58
72 90
33 83
97 54
36 5
23 14
78 52
90 7
99 2
48 82
48 6...

output:

72
3
3
87
87
2
2
2
2
87
87
87
87
87
2
87
87
87
87
87
87
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87...

result:

ok 10000 lines

Test #6:

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

input:

100
27 1
27 35
96 1
54 35
25 54
81 35
69 25
27 18
69 83
27 99
70 83
81 61
1 77
73 54
35 68
61 89
20 89
99 95
37 20
63 95
95 38
7 83
63 78
86 35
89 13
71 77
70 14
95 34
13 62
24 95
77 98
99 33
25 100
36 63
35 8
65 54
66 83
40 8
15 81
78 59
15 4
62 28
97 14
15 58
69 3
89 44
47 100
52 73
12 95
53 38
39...

output:

46
35
46
83
83
83
83
35
35
35
25
25
25
35
25
25
25
25
25
54
54
35
35
35
54
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
35
...

result:

ok 10000 lines

Test #7:

score: 0
Accepted
time: 2ms
memory: 6100kb

input:

100
1 19
19 45
58 45
58 72
36 45
45 94
94 13
90 58
64 90
90 23
45 12
90 52
27 36
19 42
72 35
23 32
67 36
1 18
54 36
33 67
10 1
55 90
54 65
92 72
53 42
65 24
9 45
81 42
85 35
8 81
10 44
85 68
23 30
69 12
43 69
23 25
12 88
85 99
91 9
24 100
48 81
60 94
33 41
52 51
17 19
51 82
30 49
32 28
52 7
82 79
82...

output:

33
45
45
45
45
45
58
58
58
58
58
45
58
45
58
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
...

result:

ok 10000 lines

Test #8:

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

input:

100
67 1
34 67
34 72
26 72
63 26
26 14
63 24
63 49
42 14
45 34
14 71
71 87
71 7
14 22
64 72
90 7
14 58
87 99
33 87
24 70
65 64
42 30
33 74
99 62
3 71
60 90
84 90
40 70
47 45
84 69
89 7
57 3
99 59
66 65
58 76
37 14
6 37
72 54
38 24
15 99
51 84
93 76
59 8
89 53
75 51
97 99
20 8
28 53
95 15
11 53
95 13...

output:

21
37
14
14
14
14
71
14
14
14
14
14
14
14
14
14
14
14
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
14
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
...

result:

ok 10000 lines

Test #9:

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

input:

100
1 56
1 65
50 1
50 4
4 8
4 27
31 8
10 50
25 10
31 28
31 64
97 25
44 64
16 4
44 89
43 64
89 23
33 43
37 33
10 13
90 43
26 37
97 39
16 52
10 12
20 39
33 78
36 37
37 34
79 1
34 3
20 32
25 77
81 78
35 20
82 25
35 19
35 74
5 20
63 39
38 43
37 66
89 42
57 19
3 18
19 69
100 90
59 69
45 78
34 88
69 60
35...

output:

77
50
77
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
10
10
10
10
10
10
10
10
50
50
50
10
50
50
50
10
50
50
50
10
50
50
50
10
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
4
4
4
4
4
50
50
50
50
50
50
50
50
50
50
50
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4...

result:

ok 10000 lines

Test #10:

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

input:

100
1 13
4 1
57 4
13 30
4 73
30 78
30 25
28 30
64 57
4 52
25 83
66 64
99 64
21 28
25 98
28 14
28 7
99 39
13 71
74 99
7 31
14 72
72 45
74 68
79 83
79 93
83 20
11 30
4 95
7 18
86 83
88 68
72 6
32 30
97 95
90 7
89 97
99 29
26 90
90 5
66 67
90 91
49 30
90 51
87 39
28 24
5 22
72 38
50 24
80 74
88 9
81 95...

output:

50
30
28
30
28
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
...

result:

ok 10000 lines

Test #11:

score: 0
Accepted
time: 2ms
memory: 6112kb

input:

100
11 1
1 46
1 55
46 65
43 46
84 1
11 73
77 46
1 78
46 92
81 55
28 55
11 6
1 16
14 78
95 46
1 18
22 77
10 73
65 88
37 11
34 6
14 32
74 16
16 27
43 58
89 1
50 1
55 30
11 38
45 55
92 33
67 78
92 75
80 22
73 23
79 43
69 28
25 78
85 11
65 82
77 99
32 97
2 16
65 62
42 73
46 72
83 58
67 53
100 28
14 51
3...

output:

40
77
46
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 10000 lines

Test #12:

score: 0
Accepted
time: 2ms
memory: 6052kb

input:

100
1 17
78 17
1 24
17 34
24 70
67 24
78 36
17 13
94 1
1 32
36 80
17 50
15 1
78 92
53 78
32 79
28 1
34 30
21 50
67 49
62 67
25 15
61 80
94 73
36 72
71 13
67 85
46 15
13 54
70 4
28 3
33 24
32 18
79 19
5 32
26 73
99 94
75 33
39 25
63 71
61 84
29 73
100 17
5 88
2 34
3 6
68 92
4 11
5 82
39 23
49 69
87 5...

output:

31
1
31
32
32
32
32
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 10000 lines

Test #13:

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

input:

100
95 1
87 1
95 72
99 95
76 1
67 95
54 1
50 72
94 95
1 29
99 78
52 54
25 1
27 76
27 48
18 50
48 32
54 9
44 29
31 72
63 50
36 95
57 99
81 99
52 39
29 47
28 94
47 42
87 93
98 78
16 32
44 12
18 100
34 57
20 95
31 70
63 13
69 31
9 17
68 47
76 49
48 30
95 71
44 56
14 94
2 50
98 43
79 49
53 87
8 81
75 52...

output:

14
95
95
95
95
95
95
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
95
1
95
95
95
95
95
1
95
95
95
95
95
1
95
1
1
1
1
1
95
95
95
95
95
1
1
1
1
1
...

result:

ok 10000 lines

Test #14:

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

input:

100
43 1
4 43
90 4
90 9
56 9
56 53
57 53
57 74
47 74
47 27
25 27
25 62
44 62
44 12
81 44
81 87
88 12
21 87
42 87
42 18
31 42
18 67
41 31
21 71
71 30
60 41
17 60
26 41
96 17
96 100
100 94
86 94
50 94
39 94
35 86
82 39
100 55
3 100
92 30
20 86
3 93
22 20
14 20
99 82
93 79
50 33
15 22
58 15
79 36
15 32...

output:

20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
20
20
20
86
20
20
20
86
86
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
86
86
86
86
20
20
...

result:

ok 10000 lines

Test #15:

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

input:

100
1 5
98 5
82 98
2 82
98 47
47 77
40 77
40 38
38 99
38 32
59 32
59 50
94 50
94 88
45 94
51 45
15 88
55 45
73 45
8 55
83 8
57 83
81 83
55 11
90 8
62 11
11 12
36 90
62 30
48 30
36 20
36 25
27 25
17 25
24 30
42 25
25 52
84 42
42 95
65 42
42 33
33 16
74 95
63 65
63 22
22 13
65 70
13 64
85 70
22 43
79 ...

output:

77
77
35
55
55
55
42
42
42
42
65
65
65
65
85
85
85
85
31
85
85
85
85
65
65
65
85
65
65
65
65
65
65
65
65
65
65
65
85
85
85
85
85
85
85
85
93
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
65
65
65
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
...

result:

ok 10000 lines

Test #16:

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

input:

100
61 1
61 14
14 21
21 15
21 5
65 5
5 64
64 77
80 77
58 80
80 85
18 85
58 13
29 13
79 29
12 79
12 66
66 48
95 66
95 33
95 76
76 49
93 49
88 93
83 49
88 17
57 48
88 3
3 25
25 9
9 71
71 75
75 6
97 6
97 26
26 28
87 71
6 78
86 28
86 81
24 17
81 94
37 24
94 54
37 4
35 81
67 4
94 10
67 46
10 47
73 10
19 ...

output:

85
80
88
88
9
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
9
9
9
88
9
25
25
88
88
88
25
88
25
25
25
25
9
9
71
71
75
71
71
71
71
71
75
71
71
71
71
71
71
71
71
71
71
71
75
75
6
75
75
71
75
71
75
71
75
71
71
71
71
71
71
71
71
71
71
9
9
25
25
25
25
88
25
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
8...

result:

ok 10000 lines

Test #17:

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

input:

100
8 1
93 1
66 1
82 1
88 1
1 96
77 1
8 38
8 70
19 1
1 20
1 43
1 95
1 80
1 29
92 1
56 1
71 1
8 73
62 82
1 78
1 87
8 76
1 45
22 77
8 6
54 1
1 46
1 58
50 66
34 1
28 93
66 30
66 15
38 85
1 9
93 61
8 16
66 48
93 14
93 90
27 1
21 1
93 44
1 60
8 51
66 65
95 84
4 8
83 88
32 93
11 8
40 88
1 74
1 7
96 35
93 ...

output:

6
8
8
8
8
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 10000 lines

Test #18:

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

input:

100
1 66
76 1
41 1
1 6
1 38
67 66
31 1
91 1
1 96
42 1
1 5
41 16
1 30
59 66
28 76
1 58
66 43
41 68
1 48
78 1
1 60
72 76
61 1
15 1
94 1
66 27
1 4
38 29
38 20
23 66
10 76
36 6
75 41
37 1
6 13
19 76
76 35
1 18
1 86
1 49
44 1
1 64
6 85
1 39
80 5
1 71
1 7
66 34
56 41
76 92
65 91
8 76
41 33
99 6
1 51
93 58...

output:

87
1
87
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 10000 lines

Test #19:

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

input:

100
1 25
72 1
1 16
1 96
55 1
11 1
26 1
2 1
1 37
8 25
72 6
1 4
1 13
46 25
31 1
99 1
21 1
1 10
52 1
83 72
86 1
16 22
49 16
72 80
76 1
1 15
35 1
44 25
33 1
66 11
91 11
43 72
85 1
7 1
54 72
94 1
50 16
32 16
28 72
1 20
16 59
1 48
14 72
84 25
16 17
58 1
63 26
97 25
57 55
65 26
61 16
19 1
16 92
95 1
2 74
1...

output:

78
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 10000 lines

Test #20:

score: 0
Accepted
time: 163ms
memory: 22260kb

input:

100000
1 33107
1 49683
49683 23838
33107 33841
25927 23838
1 74779
99345 74779
36731 99345
23838 70246
38975 49683
36605 74779
49283 1
72218 49283
36605 89277
16724 49283
15597 89277
74779 70693
25927 10882
18787 49683
49283 89923
74779 18891
18891 72904
70246 64950
74779 39040
51544 39040
48338 722...

output:

89754
28789
33107
33107
49683
49683
49683
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #21:

score: 0
Accepted
time: 144ms
memory: 23360kb

input:

100000
1 98526
98526 71881
71881 32316
71881 91701
97004 71881
1 50154
50154 25648
90382 32316
98526 51008
81074 71881
88290 91701
20835 81074
1 88584
81163 1
5066 98526
63220 71881
5066 43945
88290 89171
97004 78551
49986 91701
53367 88584
50154 89663
50154 90725
98456 89663
90382 74858
90725 53584...

output:

94781
47260
71881
66830
1649
81074
20703
66830
66830
66830
35108
20703
66830
66830
20703
20703
20703
20703
20703
20703
20703
20703
20703
66830
66830
20703
20703
1649
1649
1649
1649
1649
1649
81074
81074
81074
81074
81074
81074
81074
81074
81074
81074
81074
81074
81074
81074
81074
81074
81074
81074
8...

result:

ok 100000 lines

Test #22:

score: 0
Accepted
time: 93ms
memory: 22940kb

input:

100000
98458 1
18530 1
95442 1
98458 2967
97766 95442
18530 5382
5382 45839
97766 70789
97766 46371
51056 70789
2100 5382
97766 40344
193 98458
18530 45452
2967 91534
5382 71051
68600 5382
65092 2967
43663 70789
66738 1
20267 95442
2100 61712
39565 66738
95442 56590
29031 61712
8607 91534
91681 5105...

output:

98813
97766
97766
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #23:

score: 0
Accepted
time: 105ms
memory: 22944kb

input:

100000
1 93030
48178 93030
1655 1
93030 95380
15742 95380
15742 38782
49563 93030
93030 94593
38782 10482
94593 62811
62811 38444
62630 93030
23379 1
66269 95380
15320 66269
69627 1
93030 637
10482 46696
62570 66269
43085 69627
40421 15320
40421 29280
38444 29544
13323 29280
15320 51097
13323 33995
...

output:

57889
1
1
1
93030
93030
93030
1
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
93030
9303...

result:

ok 100000 lines

Test #24:

score: 0
Accepted
time: 106ms
memory: 22188kb

input:

100000
1 46788
46788 74831
38318 46788
46788 28121
28121 85162
46788 24705
62068 1
46788 86508
24705 85078
80001 24705
91029 80001
62068 55738
62068 11972
62068 80422
11972 36665
36665 81942
28121 85074
85078 35507
85074 93487
46788 65180
2803 46788
67158 85074
11972 30193
6547 36665
67785 55738
543...

output:

10039
1
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
46788
4678...

result:

ok 100000 lines

Test #25:

score: 0
Accepted
time: 89ms
memory: 22848kb

input:

100000
1 86599
1715 1
86599 79823
65172 1715
93401 79823
18478 1
95324 18478
1534 79823
86599 40049
18478 84772
88749 40049
33592 84772
20450 93401
72786 33592
54506 79823
49207 20450
20450 52827
40049 32100
51159 1
51159 69551
52827 83745
1974 51159
7678 32100
2139 93401
53523 69551
26607 40049
847...

output:

90253
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
86599
1
1
1
1
1
86599
1
1
1
86599
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
86599
86599
86599
1
86599
1
86599
1
86599
86599
86599
1
86599
86599
86599
86599
86599
86599
86599
86599
86599
86599
86599
86599
8659...

result:

ok 100000 lines

Test #26:

score: 0
Accepted
time: 277ms
memory: 30996kb

input:

100000
66827 1
66827 3020
37001 3020
86421 37001
48188 86421
48188 66366
64459 66366
64459 70776
70776 88217
88217 53546
53546 60759
94219 60759
52771 94219
52771 1872
1872 33491
33491 15705
78366 15705
68591 78366
68591 70054
70054 94898
94898 37055
83477 37055
83477 61881
61881 39144
39144 70057
7...

output:

75000
33373
7590
64240
43814
89834
70488
29117
71794
43268
14768
42809
43375
25401
40632
33598
46593
645
20236
3674
36430
65000
92273
25595
56960
55003
45432
70243
77446
16509
4099
20265
66645
34989
58809
98353
9329
62421
97020
6494
64065
50143
23005
99419
84985
21578
77627
75730
39291
63567
59463
1...

result:

ok 100000 lines

Test #27:

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

input:

100000
17714 1
9191 17714
99673 9191
65651 99673
65651 11385
11385 2682
28082 2682
34681 28082
34681 38648
65899 38648
9099 65899
5024 9099
83703 5024
9649 83703
9649 33178
98045 33178
98045 41340
41340 94118
27384 94118
27384 68738
45636 68738
14788 45636
14788 74533
76190 74533
27493 76190
27493 6...

output:

19816
16751
92098
59112
95318
51697
31218
7148
61778
28385
74434
85323
65962
51202
63974
35110
43035
58792
36169
46581
25438
24399
48959
74508
43446
74498
81711
65260
96892
35539
53879
80120
75837
84884
56306
10374
38768
48702
42349
16439
12177
66088
75848
34280
81648
43035
33126
38354
25635
33771
1...

result:

ok 100000 lines

Test #28:

score: 0
Accepted
time: 269ms
memory: 31064kb

input:

100000
22928 1
22928 80138
80138 561
12243 561
64650 12243
68732 64650
23722 68732
63491 23722
57000 63491
57000 44184
30887 44184
26871 30887
26871 56867
22988 56867
22988 67437
21428 67437
21428 9383
9383 41140
33629 41140
33629 84078
89444 84078
16241 89444
16241 57736
57736 57002
57002 98436
984...

output:

61510
34581
37507
71837
35782
90366
40788
60437
44372
40065
64539
30913
8418
50045
43019
11105
81636
18541
43468
61287
17528
17323
6869
79125
1628
50522
90601
74270
32092
41168
90398
70850
15388
50392
87916
66529
47928
80580
63001
93220
46118
59712
95602
88299
91706
75258
79564
22101
38398
74933
539...

result:

ok 100000 lines

Test #29:

score: 0
Accepted
time: 221ms
memory: 30776kb

input:

100000
36566 1
35565 36566
35565 41765
41765 78635
92475 78635
43861 92475
43861 54432
44236 54432
44236 30867
11626 30867
15133 11626
71235 15133
71235 60829
7111 60829
7111 76908
92659 76908
17220 92659
17220 53109
55382 53109
49506 55382
98726 49506
98726 93200
14583 93200
74476 14583
26983 74476...

output:

34469
95360
5067
34259
44697
22563
88596
41596
23791
81565
77364
12208
56234
61174
19597
19619
10340
42797
8122
13921
36822
72154
6797
58136
17121
30086
7982
75074
92953
13322
36030
60229
95226
29797
22532
61169
75770
44787
48249
48104
79100
74035
56468
40690
52239
80023
22624
84667
23551
61468
6208...

result:

ok 100000 lines

Test #30:

score: 0
Accepted
time: 212ms
memory: 30560kb

input:

100000
52155 1
52155 28555
28555 53036
82183 53036
12992 82183
12992 36886
31409 36886
31409 53742
53742 2950
40312 2950
40312 73127
81907 73127
81907 50179
57734 50179
57734 35176
79708 35176
2155 79708
2155 56804
56804 42542
73941 42542
53647 73941
53647 29939
91177 29939
91177 84502
96741 84502
6...

output:

34377
34377
46854
43072
46854
46854
61917
61917
27332
27332
27332
95646
27332
95646
95646
94522
94522
15317
94522
94522
97146
97146
97146
94522
97146
94522
94522
94522
94522
94522
97146
97146
97146
97146
95646
95646
59143
59143
59143
95646
59143
98785
98785
98785
98785
95646
98785
98785
82244
82244
...

result:

ok 100000 lines

Test #31:

score: 0
Accepted
time: 225ms
memory: 30476kb

input:

100000
1 82275
82275 69037
48648 69037
62642 48648
62642 49100
49100 94778
94778 92658
81639 92658
85975 81639
15507 85975
89132 15507
89132 49101
49101 87656
19548 87656
8626 19548
69442 8626
59978 69442
59978 36541
36541 86262
86262 17979
17979 41886
58912 41886
96688 58912
55459 96688
55459 75400...

output:

8315
21157
8315
171
8315
171
171
14519
171
171
171
97500
171
171
171
171
171
171
8315
8315
38017
8315
26481
26481
26481
26481
26481
8315
26481
8315
8315
171
8315
171
171
171
8315
171
171
72688
72688
48039
48039
48039
48039
30747
30747
30747
48039
48039
72688
48039
48039
48039
48039
54407
54407
30747...

result:

ok 100000 lines

Test #32:

score: 0
Accepted
time: 212ms
memory: 30420kb

input:

100000
1 37577
37577 42639
42639 12954
12954 42205
42205 57972
57972 13499
13499 40969
31653 40969
59881 31653
61124 59881
41765 61124
41765 14722
10971 14722
97743 10971
36503 97743
36503 17243
76071 17243
91422 76071
3212 91422
3212 45238
89092 45238
56468 89092
58166 56468
33675 58166
33675 94593...

output:

2182
26217
2182
67215
67215
67154
67215
67154
67154
57427
67154
67154
67215
67154
67215
67215
67215
67154
67154
67154
67215
67215
53038
67215
53038
53038
2182
2182
66936
2182
66936
66936
709
66936
709
66936
66936
66936
709
709
709
709
709
709
34564
709
34564
34564
34564
709
34564
34564
34564
34564
3...

result:

ok 100000 lines

Test #33:

score: 0
Accepted
time: 208ms
memory: 30464kb

input:

100000
47346 1
47346 82146
82146 58638
58638 2548
28951 2548
28951 1434
1434 75645
69999 75645
69999 27426
27426 6569
8468 6569
8468 67771
67771 69127
18807 69127
18807 15058
91695 15058
91695 40137
29719 40137
30509 29719
30509 44545
24317 44545
24317 87598
87598 57571
57571 49551
88786 49551
88786...

output:

23684
23684
23684
23684
23684
29268
29268
69899
69899
69899
69899
69899
69899
69899
29268
29268
29268
29986
29986
69899
69899
88585
88585
39276
39276
39276
39276
31745
31745
18197
18197
41540
18197
18197
18197
41540
18197
18197
39232
39232
31745
39232
39232
18197
39232
39232
39232
39232
39232
37176
...

result:

ok 100000 lines

Test #34:

score: 0
Accepted
time: 74ms
memory: 22740kb

input:

100000
77850 1
91927 1
1 83060
49789 1
60003 1
87409 1
39790 1
1 98290
9915 1
1 19865
67636 1
36254 1
73373 1
34671 1
1 8230
1 315
1 3225
17488 1
1 42911
1 94883
68034 1
1 52091
72112 1
57416 1
1 76917
92604 1
1 49862
92848 1
1 58423
1 43970
32996 1
1 25526
46954 1
38862 87409
7544 1
1 93016
8376 1
...

output:

12913
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #35:

score: 0
Accepted
time: 84ms
memory: 22620kb

input:

100000
1 69690
97044 1
1 41212
1 34113
95343 1
80995 1
1 14618
1 47814
96469 1
51077 1
33996 1
1 91404
1 43748
55546 1
24284 1
1 44564
1 3277
91165 1
1000 1
10440 1
97923 1
1 6173
38601 1
1 36286
1 17653
40363 1
71551 1
78734 1
1 75159
1 19579
1 76242
88277 1
51199 1
1 55489
1 67411
21524 1
44112 1
...

output:

89769
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #36:

score: 0
Accepted
time: 59ms
memory: 22836kb

input:

100000
73951 1
62709 1
1 46654
58985 1
1 94319
1 91975
1 55242
1 55010
1 51452
1 16079
40700 1
1 73091
1 57167
52199 1
1 28783
1 14463
66478 1
63197 1
1 4237
1 32128
1 92144
1 4420
1 81525
99857 1
62705 1
93853 1
1 94982
1 63503
1 49093
1 92375
45305 1
99956 1
80579 1
51653 1
54451 1
1 90586
70561 1...

output:

88803
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #37:

score: 0
Accepted
time: 104ms
memory: 22596kb

input:

100000
1 12063
1 27662
1 85953
56453 1
90373 1
58386 1
1 69482
1 62496
1 87304
69482 35539
1 76821
6567 1
1 79641
1 63118
74762 1
2405 1
58634 1
1 48225
45066 1
94452 1
1 72553
47068 1
1 14188
1 66054
1 43865
1 65354
43157 1
51077 1
1 98064
64807 1
41057 1
48908 1
67452 1
1 4346
20457 1
11680 1
3553...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #38:

score: 0
Accepted
time: 74ms
memory: 22764kb

input:

100000
1 53345
1 73234
1 60508
92591 1
56674 1
1988 1
14419 1
79313 1
58869 1
1 48855
38268 1
1 71054
7465 1
68352 1
2155 1
90039 1
39361 1
1 91261
7335 1
1 31860
78092 1
1 28146
90737 1
77560 1
1 19305
1 25510
39152 1
32905 1
1 79748
1 36212
1 30692
1 93507
1 48593
1 56170
9320 1
1 29449
1 18469
84...

output:

79422
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #39:

score: 0
Accepted
time: 69ms
memory: 21976kb

input:

100000
1 16643
50574 1
1 62435
12061 1
7938 1
89565 1
1 99958
23037 1
1 36218
34421 1
1 68626
16629 1
57534 1
63927 1
95107 1
40937 1
1 21472
3066 1
1 78388
1 26346
12983 1
48437 1
1 48049
91353 1
29972 1
26447 1
1 87367
1 11653
1 84000
77307 1
55456 1
1 59973
2819 89565
1 5954
1 45168
1 33104
1 536...

output:

2320
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #40:

score: 0
Accepted
time: 65ms
memory: 22692kb

input:

100000
23596 1
1 5559
1 40256
1 17740
1 15513
55851 1
1 55566
18568 1
9035 1
1 6386
39699 1
27952 1
1 54280
36091 1
33890 1
38799 1
59357 1
47568 1
1 36142
1 93475
1 47642
1 42063
1 66339
1 57420
14275 1
1 67023
71213 1
1 53096
26196 1
64062 1
1 5569
20788 1
1 51686
65441 1
25136 1
1 69727
64265 1
1...

output:

69080
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #41:

score: 0
Accepted
time: 66ms
memory: 22828kb

input:

100000
27651 1
1 31797
33485 1
1 63287
90989 1
96560 1
1 92011
1 71998
1 14710
1 75896
1 97729
95362 1
1 86746
1 64800
44897 1
12661 1
48211 1
17576 1
8623 1
6029 1
1 49513
1 91557
80977 1
72835 1
1 95104
1 76206
24357 1
61005 1
3678 1
1 73018
75709 1
1 42028
1 10036
31031 1
1 32525
68393 1
12008 1
...

output:

8227
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #42:

score: 0
Accepted
time: 216ms
memory: 24040kb

input:

100000
1 14845
14845 5586
5586 65735
44786 65735
54682 44786
56842 54682
56842 707
36542 707
58315 36542
21759 58315
21759 98499
25073 98499
13590 25073
56561 58315
29226 13590
29226 9500
9500 67441
67441 85068
85068 37813
51298 37813
69165 51298
29951 69165
16151 29951
41893 16151
56858 41893
44474...

output:

1870
15656
15656
85743
85743
6093
6093
16683
16683
60355
60355
95530
95530
95530
95466
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
39823
398...

result:

ok 100000 lines

Test #43:

score: 0
Accepted
time: 223ms
memory: 24016kb

input:

100000
8459 1
8459 48571
48571 29717
26828 29717
53324 26828
53324 68871
68871 59915
28448 59915
28448 40870
40870 64134
64134 63198
63198 69677
69677 82446
82446 40804
62820 40804
31571 62820
31571 66085
52385 66085
27166 52385
58283 27166
63497 58283
63497 63387
60484 63387
60484 41537
35011 41537...

output:

84583
78951
71335
71335
87584
87584
13449
52168
44362
44362
44362
44362
52168
52168
52168
52168
52168
52168
13449
13449
13449
52168
52168
52168
52168
52168
52168
52168
52168
52168
44362
52168
44362
44362
52168
44362
44362
44362
44362
44362
44362
44362
44362
44362
44362
44362
44362
44362
44362
44362
...

result:

ok 100000 lines

Test #44:

score: 0
Accepted
time: 183ms
memory: 23532kb

input:

100000
1 60489
90096 60489
90096 71610
4194 71610
4194 86752
35303 86752
73288 35303
73288 97076
13281 97076
4363 13281
4363 74305
74305 14622
14622 17800
17800 59406
59406 50168
50168 11322
73360 11322
25949 73360
22848 25949
22848 57818
10604 57818
10604 90015
90015 7240
7240 98146
28065 98146
235...

output:

13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
13373
...

result:

ok 100000 lines

Test #45:

score: 0
Accepted
time: 207ms
memory: 23984kb

input:

100000
1 43455
1 49641
49641 89175
88335 89175
51974 88335
51974 34678
95388 34678
21048 95388
82287 21048
16158 82287
99116 16158
51694 99116
40147 51694
40147 29972
39961 29972
39961 6569
29555 6569
29555 70758
40559 70758
25154 40559
50762 25154
50762 77567
38163 77567
38163 20392
62917 20392
964...

output:

85397
86704
95871
22860
78792
26714
75400
54713
85975
85975
41610
41610
41610
58788
58788
99709
99301
88644
89929
89929
89929
95725
42349
65702
65702
65702
85110
55577
59594
59594
62321
93071
72878
61454
24180
85281
85281
85281
30533
30533
30533
43355
85110
20206
65331
54355
88091
57808
67051
67051
...

result:

ok 100000 lines

Test #46:

score: 0
Accepted
time: 179ms
memory: 23484kb

input:

100000
92448 1
85346 92448
67099 85346
82826 67099
60296 82826
60296 47686
1208 47686
1208 15125
15125 50580
55962 50580
55962 10875
24430 10875
12413 24430
12413 42532
28620 42532
28620 42169
25245 42169
25245 57556
57556 27163
71514 27163
64984 71514
79766 64984
20313 79766
20313 72621
98806 72621...

output:

30587
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
11540
...

result:

ok 100000 lines

Test #47:

score: 0
Accepted
time: 191ms
memory: 23492kb

input:

100000
1 70699
70699 1514
1514 2156
2156 53955
53955 71456
40147 71456
40147 16553
16553 93180
83466 93180
83466 30940
41349 30940
38240 41349
1198 38240
60786 1198
37366 60786
37366 94546
94546 51689
21537 51689
21537 85591
85591 22439
65306 22439
65306 38211
2385 38211
2385 77415
84244 77415
84244...

output:

85842
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
81406
...

result:

ok 100000 lines

Test #48:

score: 0
Accepted
time: 188ms
memory: 23596kb

input:

100000
32105 1
32105 75391
75391 32112
28275 32112
28275 11977
95384 11977
95384 66537
43335 66537
55792 43335
8840 55792
8840 39887
76421 39887
76421 47100
87838 47100
23986 87838
74879 23986
13902 74879
13902 15308
2934 87838
66101 15308
66101 37188
58035 37188
58035 35725
72864 35725
43491 72864
...

output:

58223
54781
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
23138
...

result:

ok 100000 lines

Test #49:

score: 0
Accepted
time: 197ms
memory: 23508kb

input:

100000
1 30132
30132 54719
54719 91219
89845 91219
68373 89845
68373 48745
21390 48745
21390 80531
41953 80531
41953 51668
51668 5264
41868 5264
76815 41868
76815 81304
68981 81304
50369 68981
9240 50369
9240 30970
30970 13552
13552 27646
27646 66856
80407 66856
80407 20336
43144 20336
5241 43144
52...

output:

90587
23766
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
25214
...

result:

ok 100000 lines

Test #50:

score: 0
Accepted
time: 228ms
memory: 24456kb

input:

100000
96196 1
96196 82672
82672 14650
37030 14650
37030 73593
73593 88080
88080 80316
80316 70683
67341 70683
24074 67341
2074 24074
2074 92154
92154 4074
4074 54803
14818 54803
14818 39818
29546 39818
2100 29546
2100 92121
26166 92121
26166 81055
81055 37449
37449 94600
3791 94600
98187 3791
98187...

output:

23941
61076
76471
76471
19428
19428
80811
80811
77478
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
46369
...

result:

ok 100000 lines

Test #51:

score: 0
Accepted
time: 236ms
memory: 25156kb

input:

100000
90143 1
5961 90143
5961 84300
84300 6275
1214 6275
1214 85112
85112 62693
14350 62693
31646 14350
1214 84384
13148 31646
41399 13148
36922 41399
10882 36922
29075 10882
20403 29075
20403 4735
4735 7116
92491 7116
92491 42381
42381 69301
69301 16846
16846 84562
84562 75064
75064 98282
98282 59...

output:

41501
2720
72380
17501
45007
84491
33384
33384
6970
6970
42668
18738
28070
50732
10845
89837
89837
89837
89837
89837
69523
69523
1692
33038
27318
27318
27318
27318
96935
15723
15723
86640
34280
12414
72538
70723
11868
79943
79943
76948
43900
43900
43900
43900
62492
62492
9665
9665
9665
9665
97656
97...

result:

ok 100000 lines

Test #52:

score: 0
Accepted
time: 191ms
memory: 24672kb

input:

100000
34758 1
34758 4832
4832 99692
99692 82869
51637 82869
24781 51637
24781 23507
23507 95754
54625 95754
2234 54625
2234 76494
75802 76494
75802 24580
5797 24580
3179 5797
3179 95196
95196 10369
10369 5996
86385 5996
86385 90740
31314 90740
31314 83326
83326 47612
47612 12056
67726 12056
67726 9...

output:

3117
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
90227
9...

result:

ok 100000 lines

Test #53:

score: 0
Accepted
time: 189ms
memory: 24420kb

input:

100000
1 24736
24736 23980
48535 23980
44524 48535
49409 44524
49409 37756
46327 37756
98372 46327
98372 43233
43233 10685
81611 10685
41695 81611
38465 41695
38465 69515
69515 93002
93002 76271
45632 76271
42532 45632
94849 42532
3568 94849
50813 3568
58638 50813
58638 20379
20379 71338
71338 24906...

output:

8653
20706
20706
20706
20706
20706
20706
67687
20706
20706
20706
73360
20706
73360
20706
73360
20706
20706
20706
20706
20706
20706
20706
73360
73360
32376
73360
73360
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
20706
2...

result:

ok 100000 lines

Test #54:

score: 0
Accepted
time: 193ms
memory: 24520kb

input:

100000
32344 1
32344 48697
69193 48697
49768 69193
49768 8341
8341 77974
77974 24478
26913 24478
26913 63888
66275 63888
66275 91722
33159 91722
33159 25991
25991 96675
96675 21446
39559 21446
80536 39559
80536 77603
77603 80111
80111 47080
35117 47080
35117 2699
2699 13635
13635 50259
43811 50259
5...

output:

27411
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
71384
...

result:

ok 100000 lines

Test #55:

score: 0
Accepted
time: 208ms
memory: 24608kb

input:

100000
1 79813
79813 51504
51504 90961
8540 90961
8540 59903
47265 59903
59210 47265
59210 85079
71998 85079
49141 71998
44383 49141
44383 30885
30885 9256
9256 55077
55077 24213
64535 24213
65358 64535
7815 65358
85525 7815
85525 46110
25314 46110
22620 25314
53620 22620
64535 33376
53620 64516
829...

output:

87921
71301
71301
71301
80410
71301
78117
78117
78117
78117
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
80410
...

result:

ok 100000 lines

Test #56:

score: 0
Accepted
time: 282ms
memory: 27200kb

input:

100000
91680 1
78110 91680
78110 20321
20321 14594
14594 74671
74671 20769
20769 6570
6570 23309
50262 23309
52240 50262
27870 52240
19577 27870
21657 19577
21657 92750
92750 81458
81458 7624
7624 67140
67140 51156
51156 21426
21426 19628
19628 55298
53417 55298
37256 53417
37256 8810
76323 8810
763...

output:

24031
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
21482
67549
52213
52213
52213
43489
17907
17907
98884
68745
68745
20370
63786
63786
2289
2289
75920
87645
87645
87645
87645
52462
35247
57...

result:

ok 100000 lines

Test #57:

score: 0
Accepted
time: 262ms
memory: 26036kb

input:

100000
1 4865
1 37402
55336 4865
924 55336
924 37050
34616 37050
74789 34616
74789 54862
71899 54862
46755 71899
56405 46755
56405 57158
39752 57158
39752 88110
7791 88110
7791 94266
94266 17326
31545 17326
31545 24966
24966 7988
36642 7988
36642 7607
50381 7607
95484 50381
98335 95484
98335 5251
45...

output:

75672
75672
75672
56836
75672
18862
43020
6980
6980
8575
8575
60091
6116
6116
96415
44130
68995
75914
75914
9370
46367
57555
75530
84244
19060
4063
46687
46687
74694
74694
45346
67688
67688
67688
13020
39102
39102
69360
69360
69360
95482
58997
74710
98234
98234
98234
40758
77091
7115
75914
12795
127...

result:

ok 100000 lines

Test #58:

score: 0
Accepted
time: 198ms
memory: 25548kb

input:

100000
83649 1
83649 58187
45005 58187
13575 45005
18837 13575
40397 18837
61532 40397
61532 87940
27828 87940
60646 27828
44746 60646
73662 44746
73662 47750
48095 47750
48095 7141
97839 7141
97839 48696
48696 20181
20181 52932
73 52932
64331 73
58696 64331
16624 58696
16624 20737
19937 20737
59195...

output:

22680
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
89060
96595
89060
89060
89060
89060
89060
89060
89060
89060
...

result:

ok 100000 lines

Test #59:

score: 0
Accepted
time: 220ms
memory: 25552kb

input:

100000
1 28257
29440 28257
29440 90157
90157 38246
3069 38246
3069 32676
32676 32169
32169 64672
28601 64672
90751 28601
90751 17324
17324 98863
98863 47075
36120 47075
36120 69063
82748 69063
82748 52361
52361 4350
4350 29011
52289 29011
52289 78126
78126 55124
55124 71690
71690 84551
84551 94001
6...

output:

51076
57302
51076
51076
18916
18916
18916
11055
18916
18916
18916
18916
18916
11055
11055
11055
11055
11055
18916
18916
18916
18916
18916
18916
18916
18916
18916
18916
18916
11055
11055
11055
11055
35108
11055
35108
35108
81048
35108
35108
11055
11055
18916
18916
18916
11055
11055
11055
11055
11055
...

result:

ok 100000 lines

Test #60:

score: 0
Accepted
time: 211ms
memory: 25564kb

input:

100000
1 45823
45823 29370
90323 29370
90323 89924
89924 6693
6693 74187
74187 64821
64821 61516
30658 61516
30658 47920
47920 30837
30837 58732
58732 91950
91950 94807
16668 94807
16668 33328
68938 33328
68938 17058
17058 98032
98032 39992
26912 39992
26912 15958
3845 15958
60156 3845
60156 21065
2...

output:

18459
89560
92836
89560
89560
89560
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
92836
...

result:

ok 100000 lines

Test #61:

score: 0
Accepted
time: 217ms
memory: 25556kb

input:

100000
40044 1
41557 40044
79291 41557
25186 79291
27263 25186
23188 27263
23188 81704
79291 24822
81704 96807
18611 96807
18418 18611
19722 18418
19722 42165
42165 29473
29473 83245
83245 99989
99989 10995
10995 86179
86179 24983
83872 24983
83872 83327
83327 88531
45864 88531
9920 45864
9920 60773...

output:

52176
69461
61504
61504
52176
52176
34610
34610
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
76657
...

result:

ok 100000 lines

Test #62:

score: 0
Accepted
time: 271ms
memory: 28048kb

input:

100000
45348 1
25231 45348
32871 25231
32871 81276
81276 42777
8902 42777
8902 76849
76849 16425
22425 16425
36774 22425
82859 36774
30279 82859
99721 30279
99721 83138
19791 83138
75232 19791
75232 84154
84154 12945
12945 5514
5514 50779
50779 72141
2864 72141
10884 2864
54899 10884
94647 54899
946...

output:

73111
73111
73111
73111
47107
11626
64546
21149
19525
79740
96895
19860
98689
98689
98689
19785
29364
17627
67394
81018
80680
82586
92169
54415
54415
12546
36615
62622
46832
14969
59422
48426
62855
10276
69748
11313
18117
59695
59695
59695
96005
15189
73852
42027
75362
54526
56136
6347
62682
71533
7...

result:

ok 100000 lines

Test #63:

score: 0
Accepted
time: 336ms
memory: 27992kb

input:

100000
1 87148
8078 87148
30206 87148
30206 81701
35413 81701
35413 56239
56239 75991
8004 75991
8004 50161
50161 29974
29974 14049
14049 34119
35000 34119
35000 41636
41636 86237
86237 38592
32614 38592
38797 32614
38797 64804
98767 64804
65941 98767
91736 65941
91736 95180
95180 53878
37839 53878
...

output:

18048
4800
70372
86572
85694
55539
59390
42201
5055
15928
63538
63538
18781
45840
49656
66473
97302
5074
85155
85155
85155
11896
54862
30882
9389
9389
4704
37907
14631
36974
29458
78434
68648
89584
50729
50729
44636
8053
68706
98537
94037
51257
89419
30019
77794
43980
94538
9263
12789
91858
75462
42...

result:

ok 100000 lines

Test #64:

score: 0
Accepted
time: 222ms
memory: 27468kb

input:

100000
74509 1
74509 35217
60272 35217
60272 67784
91373 67784
40802 91373
11789 40802
40462 11789
62419 40462
62419 72761
25995 72761
25995 21150
47098 21150
60114 47098
60114 50779
82482 50779
82482 43617
70289 43617
70289 15518
88034 15518
99658 88034
99658 25537
76724 25537
50473 76724
50473 830...

output:

19110
74198
74198
70725
83216
83216
74198
74198
19110
19110
76212
76212
10907
10907
10907
76212
98315
98315
10907
10907
24654
10907
24654
10907
24654
10907
10907
98315
10907
26704
26704
98315
26704
26704
26704
26704
10907
10907
24654
10907
24654
10907
10907
10907
24654
10907
24654
24654
24654
10907
...

result:

ok 100000 lines

Test #65:

score: 0
Accepted
time: 215ms
memory: 27492kb

input:

100000
1 29886
69519 29886
69519 43227
16665 43227
61082 16665
61082 27901
27901 45821
60012 45821
60012 57866
57866 60905
60905 83583
91150 83583
91150 32251
32251 41301
93443 41301
93443 8191
20056 8191
26817 20056
52093 26817
52093 3977
3977 86066
630 86066
630 82041
30255 82041
8717 30255
8717 7...

output:

93578
93578
93578
30320
93578
93578
40124
93578
93578
93578
93578
30320
30320
39658
30320
39658
39658
39658
30320
30320
30320
30320
93578
30320
93578
30320
30320
30320
93578
30320
30320
30320
93578
93578
9453
93578
93578
93578
9453
93578
9453
93578
93578
93578
93578
30320
30320
30320
30320
95291
303...

result:

ok 100000 lines

Test #66:

score: 0
Accepted
time: 229ms
memory: 27484kb

input:

100000
1 10667
91377 10667
67573 91377
67573 88109
88109 17164
17164 77433
77433 29297
5770 29297
20347 5770
20347 38221
64567 38221
97867 64567
72082 97867
30742 72082
36223 30742
36223 32068
95998 32068
95998 76364
76364 22533
22533 68752
68956 68752
68956 61686
61686 93078
93078 4392
34746 5770
4...

output:

26819
26819
34270
34270
21338
21338
53861
21338
53861
53861
95446
53861
95446
95446
95446
53861
95446
53861
71675
53861
71675
53861
71675
53861
71675
71675
71675
53861
41823
53861
41823
53861
53861
87128
53861
87128
53861
87128
53861
87128
87128
87128
87128
87128
53861
53861
41823
53861
53861
87128
...

result:

ok 100000 lines

Test #67:

score: 0
Accepted
time: 219ms
memory: 27444kb

input:

100000
1 1045
58745 1045
9914 58745
9914 25404
25404 87703
80751 87703
80751 89568
89568 82539
82539 82893
82893 53002
53002 86176
86176 59439
59439 58772
3801 58772
3801 38728
70607 38728
70607 43976
43976 47712
7710 47712
99159 7710
72 99159
47612 72
12072 47612
63103 12072
63103 59668
44981 59668...

output:

90944
6568
90944
90944
19206
90944
19206
90944
19206
90944
19206
30848
30848
30848
30848
90944
90944
2764
2764
33353
33353
33353
2764
33353
33353
33353
33353
5070
33353
33353
33353
5070
5070
5070
5070
6568
6568
6568
6568
6568
5070
5070
5070
5070
5070
6568
5070
6568
6568
40363
6568
6568
6568
40363
40...

result:

ok 100000 lines

Test #68:

score: 0
Accepted
time: 268ms
memory: 29248kb

input:

100000
51277 1
51277 79509
79509 71200
41225 71200
41225 94945
52441 94945
52441 66390
4693 66390
79730 4693
79730 9407
28397 9407
28397 10154
43212 10154
43212 8238
8238 19187
19187 71811
21077 71811
35267 19187
21077 8896
81457 8896
81457 10652
10652 42169
98174 42169
58857 98174
58857 5318
2276 5...

output:

95956
27306
49017
94540
98819
32605
32605
69389
71626
65991
12786
38594
97194
16799
58223
52692
47006
77589
36886
36404
46652
28738
71780
29678
39360
20031
71019
92176
65889
94344
95931
98809
30433
52252
52252
67698
30611
65010
65010
14575
80240
15165
52886
31615
17051
60313
64627
97050
71598
45382
...

result:

ok 100000 lines

Test #69:

score: 0
Accepted
time: 261ms
memory: 29264kb

input:

100000
502 1
364 502
4919 364
4919 17571
17571 75642
75642 92688
92688 36138
59042 36138
83769 59042
83769 30158
30158 84426
41665 84426
35964 41665
35964 24393
47691 24393
12143 47691
61310 12143
17719 61310
91056 17719
91056 73490
73490 24013
24013 418
418 92815
92815 39943
39943 69530
69530 55382...

output:

77834
77834
45696
94802
44145
44145
56427
64262
54220
98555
71133
79114
50493
29357
29357
4774
4774
53378
34282
55328
39206
59759
38946
63883
28463
62084
2710
48070
31586
71433
35574
1071
78566
71822
66501
53129
68826
66069
63951
58080
74790
74790
59303
29011
53204
99617
5665
2192
76383
17365
27651
...

result:

ok 100000 lines

Test #70:

score: 0
Accepted
time: 281ms
memory: 29176kb

input:

100000
82866 1
82866 9353
9353 25574
57325 25574
11663 57325
89129 11663
89129 14515
99494 14515
37942 99494
37942 43224
43224 64877
64877 47336
47336 21800
21800 3570
3570 16309
16309 15218
15218 47378
47378 14635
62507 14635
62507 14876
14876 40967
40967 5545
29456 5545
29456 17890
97256 17890
650...

output:

5011
38392
18075
18075
87409
39982
87592
44625
50885
67713
27451
35198
81696
90302
43637
43637
17579
74738
61731
62466
5156
55302
76114
25149
32579
65772
65573
78924
17362
67713
27903
9051
41630
81759
81193
49398
86604
46347
28850
5281
95725
95725
29832
14672
76827
99174
52020
97358
96783
86802
9729...

result:

ok 100000 lines

Test #71:

score: 0
Accepted
time: 247ms
memory: 29200kb

input:

100000
1 46302
46302 32919
32919 20068
73577 20068
73577 99351
60625 99351
60625 25610
25610 57726
94072 57726
94072 84960
51682 94072
84960 68515
4399 68515
4399 79917
96339 79917
92272 96339
36571 92272
9514 36571
9514 2116
2116 7204
37037 7204
37037 31348
31348 37085
37085 61823
61823 29556
89349...

output:

32257
8242
23814
84720
7847
12568
89672
35283
33138
53378
32620
67835
14958
55919
79344
56200
38988
67239
25676
38556
83932
1903
24948
23877
57826
18721
19591
47359
17988
7413
18265
21522
2289
35790
63797
10214
10214
31811
36133
3077
74070
29006
25127
44225
51660
27892
75742
1512
10509
40905
69552
3...

result:

ok 100000 lines

Test #72:

score: 0
Accepted
time: 216ms
memory: 28736kb

input:

100000
14476 1
76368 14476
78831 76368
78831 77761
25896 77761
73752 25896
72603 73752
53790 72603
53790 46243
46243 98334
18746 98334
18746 65583
10194 65583
10194 24947
24947 25792
76658 25792
76658 85175
81848 85175
81848 79197
79197 2757
29174 2757
44226 29174
44226 34159
34159 99457
28942 99457...

output:

10555
56058
82467
21307
21307
21307
82467
82467
82467
82467
60615
82467
60615
82467
60615
60615
46358
60615
83755
83755
83755
60615
60615
60615
60615
60615
83755
67541
83755
67541
14906
67541
67541
60615
67541
67541
14906
14906
4010
14906
4010
4010
4010
4010
4010
4010
83755
83755
83755
4010
4010
149...

result:

ok 100000 lines

Test #73:

score: 0
Accepted
time: 229ms
memory: 28616kb

input:

100000
1 12920
73131 12920
73131 99847
4593 99847
76487 4593
46954 76487
46954 60243
60243 95105
95105 49129
49129 53386
78031 53386
78031 92570
68539 92570
40271 68539
40271 93254
93254 38074
2788 38074
2788 34173
34173 74634
16540 74634
16540 95480
95480 88588
88588 86691
86691 10238
94714 10238
1...

output:

57128
15224
15224
50383
15224
50383
50383
50383
50383
38963
38963
759
38963
38963
50383
38963
38963
38963
38963
38963
38963
38963
38963
38963
48498
48498
63003
48498
63003
48498
48498
38963
48498
48498
48498
38963
38963
38963
38963
38963
38963
88857
88857
13554
13554
759
13554
759
13554
13554
13554
...

result:

ok 100000 lines

Test #74:

score: 0
Accepted
time: 222ms
memory: 28752kb

input:

100000
35148 1
35148 52752
80403 52752
133 80403
133 93557
93557 30133
52971 30133
52971 43112
43112 17257
17257 24930
24930 68570
68570 69423
69423 92768
63896 92768
27067 63896
34049 27067
32396 34049
32396 60898
60898 4966
30033 4966
93557 11313
30033 97302
97302 57734
72257 57734
72257 82766
827...

output:

29474
70651
29474
29474
29474
29474
34885
29474
29474
29474
29474
81350
29474
29474
29474
57221
29474
29474
34885
34885
3794
3794
3794
34885
34885
29474
29474
29474
34885
29474
29474
57221
57221
56904
57221
56904
56904
56904
57221
56904
57221
57221
57221
56904
56904
56904
56904
81350
56904
56904
569...

result:

ok 100000 lines

Test #75:

score: 0
Accepted
time: 216ms
memory: 28636kb

input:

100000
1 1853
1853 78506
78506 85469
37490 85469
81108 37490
660 81108
660 61564
1105 61564
50251 1105
71997 50251
53552 71997
51683 53552
91301 51683
91301 89067
89067 90800
17919 90800
17919 93129
93129 88921
40505 88921
40505 15029
8759 15029
64817 8759
23942 64817
52873 23942
73957 52873
73957 2...

output:

18191
24643
24643
24643
24643
89659
89659
89659
51145
51145
75847
51145
63468
51145
51145
51145
51145
51145
63468
51145
63468
82561
63468
63468
18423
63468
63468
63468
18423
63468
18423
63468
63468
63468
63468
63468
18423
63468
63468
626
63468
626
626
82561
626
626
63468
626
63468
63468
18423
18423
...

result:

ok 100000 lines

Test #76:

score: 0
Accepted
time: 332ms
memory: 26024kb

input:

100000
51870 1
51870 75058
73916 51870
74567 73916
73916 47233
69274 47233
49210 47233
85439 49210
49210 54488
54488 57299
54488 48851
48851 51122
94668 48851
64821 94668
94668 53842
54910 53842
80036 53842
80036 7071
80036 19734
19734 86001
95347 19734
67425 95347
73097 95347
26470 73097
270 73097
...

output:

85716
19544
18702
65123
66289
99334
99334
22901
42249
42249
9286
95411
22314
22314
22314
82726
79767
94140
87384
87384
16151
65095
73459
68748
5835
5835
5835
89335
33031
85026
85026
85026
48977
6587
32880
82781
82781
63903
63903
26339
32045
32045
45013
45013
31043
4553
62229
59840
54643
52296
52296
...

result:

ok 100000 lines

Test #77:

score: 0
Accepted
time: 294ms
memory: 27132kb

input:

100000
1 62764
62764 49287
62764 12508
78984 12508
89606 12508
1022 89606
89606 20805
20805 22380
18152 20805
18152 3196
18152 12112
39960 12112
12112 58715
58715 70928
63418 58715
303 63418
10462 63418
43005 10462
29609 10462
29609 90326
60378 29609
60378 4382
60378 17443
17443 71810
65172 17443
65...

output:

61803
61803
79164
79164
34185
54824
76685
86112
15261
15261
78192
64744
52665
84130
13699
58626
8809
79345
84528
6708
12721
46278
50659
50659
7928
7928
86128
94509
94509
43509
43509
56002
2268
16141
95463
83655
51374
91656
33964
20
47744
40371
86261
6208
84337
84337
84337
84337
84337
26636
6573
6240...

result:

ok 100000 lines

Test #78:

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

input:

100000
15046 1
98316 15046
15046 53557
53557 94322
14481 53557
14481 908
79426 14481
79426 65922
61579 79426
61579 4524
36065 61579
92112 36065
36065 47661
47661 5905
7377 47661
7377 50233
7377 81469
47781 81469
81469 38354
38354 21398
84365 38354
84365 11206
84365 49602
49602 13787
49602 38698
3869...

output:

30022
1622
1622
27136
34474
5740
5740
97722
97722
28678
437
34564
34564
58624
19497
19497
37068
3265
3265
3265
3265
3265
3265
60410
60410
60410
60410
33843
79391
79391
79391
61798
61798
61798
61798
97417
74077
5667
5667
5667
5667
5667
5667
24575
3691
61095
17196
12465
11977
61101
92744
24831
57924
5...

result:

ok 100000 lines

Test #79:

score: 0
Accepted
time: 264ms
memory: 26300kb

input:

100000
21292 1
53413 21292
21292 93967
93967 77227
64526 93967
13457 64526
21737 64526
49278 21737
27453 21737
21944 27453
77769 27453
68007 77769
72399 77769
94667 72399
20620 72399
20620 70370
19127 20620
15130 19127
19127 37652
37652 65452
58117 37652
63952 58117
20434 58117
20434 25814
37014 204...

output:

65723
65993
7506
59587
99424
17562
81569
47397
92640
59434
91855
82171
71364
12477
30627
99426
92637
34227
46263
91780
65694
75655
68659
54927
43548
26534
67600
99430
86362
24724
16224
72701
89172
90968
56921
99328
69152
91444
79421
6675
32865
16927
60225
8010
5753
31412
31758
17757
72114
21014
6325...

result:

ok 100000 lines

Test #80:

score: 0
Accepted
time: 252ms
memory: 26728kb

input:

100000
1 1525
1525 72695
1525 8538
8538 99233
87690 8538
74091 87690
82928 87690
53790 82928
43698 82928
16598 43698
37979 43698
55605 37979
6618 37979
26612 6618
6618 81678
81678 96369
23399 81678
23399 98981
65064 23399
65064 16978
65064 77726
77726 45206
24567 77726
24567 36104
24567 14053
62792 ...

output:

49895
52179
20412
44365
20412
20412
35521
35521
85220
85220
85220
35521
35521
35521
35521
35521
85220
85220
85220
35521
35521
35521
35521
35521
35521
35521
85220
35521
35521
35521
35521
67802
35521
35521
35521
67802
35521
67802
35521
35521
35521
35521
35521
35521
85220
85220
55339
85220
85220
35521
...

result:

ok 100000 lines

Test #81:

score: 0
Accepted
time: 224ms
memory: 25692kb

input:

100000
90764 1
90764 52053
21857 90764
21857 79799
21857 53911
59495 53911
93606 53911
45818 93606
33931 93606
29040 33931
54195 33931
54195 79304
54195 23918
16475 23918
76237 23918
76237 3462
3864 76237
53952 3864
3864 44002
44002 2417
67061 44002
67061 60946
67061 19334
19334 33772
91528 19334
32...

output:

82563
6377
79826
79826
2969
2969
12559
12559
12559
12559
48092
12559
12559
25386
12559
12559
12559
25386
25386
25386
12559
12559
12559
25386
12559
12559
12559
12559
4092
12559
4092
4092
52782
4092
52782
4092
52782
52782
52782
52782
57412
57412
92846
92846
97907
92846
97907
97907
97907
97907
18254
18...

result:

ok 100000 lines

Test #82:

score: 0
Accepted
time: 241ms
memory: 26340kb

input:

100000
1 77536
77536 33894
52880 77536
52880 92056
52880 58277
58277 95534
23824 58277
23824 98348
23824 57478
13575 57478
74562 57478
98919 74562
64398 74562
22422 64398
64398 63536
63536 80965
6429 63536
44363 6429
17197 6429
17197 22915
17197 11578
11578 41404
22343 11578
22343 3724
55756 22343
1...

output:

83626
45434
30991
8313
30991
8313
30991
30991
30991
30991
30991
30991
30991
8313
8313
45434
8313
8313
30991
30991
50575
50575
50575
30991
50575
30991
50575
30991
30991
30991
50575
50575
50575
50575
50575
30991
30991
30991
30991
30991
30991
30991
30991
6312
6312
6312
30991
6312
6312
6312
6312
6312
30...

result:

ok 100000 lines

Test #83:

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

input:

100000
21541 1
63524 21541
48747 21541
47994 48747
48747 84191
44249 84191
16163 84191
16163 52624
16163 97961
9415 97961
54961 97961
59065 54961
54961 31508
14810 31508
16384 31508
16384 93530
54116 16384
32408 54116
54116 67475
67475 15540
17033 67475
17033 56190
89404 17033
61471 89404
89404 3534...

output:

40448
90656
61492
61492
61492
61492
61492
40382
40382
17654
40382
17654
40382
40382
40382
17654
40382
40382
61492
61492
55362
55362
55362
61492
61492
40382
61492
40382
40382
23774
40382
23774
23774
17654
17654
17654
17654
3995
3995
49723
49723
49723
49723
85298
55900
85298
85298
85298
85298
85298
85...

result:

ok 100000 lines

Test #84:

score: 0
Accepted
time: 221ms
memory: 23336kb

input:

100000
1 25115
3199 25115
78795 25115
14347 78795
66698 14347
78795 46246
57950 46246
57950 67585
93465 67585
46246 65752
65752 82955
82955 31059
87592 31059
87592 23894
65752 4528
4528 9907
78653 9907
78653 36944
39068 36944
39068 57017
7154 4528
7154 40040
40040 66073
66073 88800
88800 88109
95142...

output:

15330
43464
43464
43464
73379
73379
73379
72278
72278
72278
72278
34632
34632
82312
82312
82312
34632
34632
34632
34632
34632
72278
72278
72278
72278
21903
3802
3802
34632
64352
34632
82312
82312
82312
82312
82312
82312
82312
82312
66
66
66
34632
34632
66
66
34632
34632
34632
34632
34632
34632
34632...

result:

ok 100000 lines

Test #85:

score: 0
Accepted
time: 180ms
memory: 22704kb

input:

100000
99800 1
99800 91289
95667 99800
26556 95667
51479 26556
95667 53329
53329 9860
9860 49268
49268 7810
53329 28811
28811 65691
98488 65691
98488 45560
36835 45560
71173 28811
71173 47996
47996 32399
66899 32399
38872 66899
38872 86898
71173 71847
71847 97087
27199 97087
27199 69066
79948 69066
...

output:

18142
91717
4840
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
10722
1...

result:

ok 100000 lines

Test #86:

score: 0
Accepted
time: 192ms
memory: 23320kb

input:

100000
1 67173
67173 98811
38087 67173
83062 38087
83062 44126
38087 36581
36581 76203
1286 76203
1286 54378
18226 36581
61732 18226
98840 61732
98840 39043
43346 39043
18226 58301
58301 49832
49832 2609
2609 4349
4349 69178
32522 69178
58301 84825
66780 84825
31551 66780
31551 8586
8586 22931
22931...

output:

73930
32973
90632
79597
53629
56412
79597
56412
79597
79597
79597
56412
56412
56412
56412
56412
53629
53629
53629
5626
56434
56434
56434
77303
5626
5626
5626
80177
5626
5626
5626
80177
80177
80177
80177
5626
53629
53629
53629
53629
53629
5626
5626
5626
5626
46138
46138
46138
46138
16721
46138
46138
...

result:

ok 100000 lines

Test #87:

score: 0
Accepted
time: 199ms
memory: 22752kb

input:

100000
79864 1
2080 79864
65756 79864
65756 35351
35351 99196
13029 65756
13029 17205
68642 17205
74787 68642
13029 39108
39108 36917
36917 21134
21134 96569
76903 96569
98915 39108
98915 49485
49485 30906
46835 30906
46835 17390
10737 17390
98915 75098
84217 75098
81511 84217
37391 81511
44329 3739...

output:

83280
83280
83280
25169
71842
74965
94631
39367
94063
94063
39519
84466
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
76288
...

result:

ok 100000 lines

Test #88:

score: 0
Accepted
time: 182ms
memory: 22784kb

input:

100000
1 54870
54870 64920
2690 54870
54268 2690
69047 54268
58173 2690
88110 58173
88110 55982
55982 47767
6195 58173
8428 6195
8428 92327
92327 32505
26226 32505
6195 8646
8646 19058
19058 56520
18304 56520
18304 60252
60252 89889
3673 8646
3673 44663
57908 44663
60027 57908
60027 18421
18421 9562...

output:

4899
39191
83245
83245
3630
83245
3630
3630
3630
3630
3630
3630
43566
3630
3630
3630
98638
98638
98638
98638
43566
98638
98638
98638
98638
98638
98638
48437
48437
3630
3630
713
3630
3630
3630
3630
3630
713
713
713
713
83245
83245
33631
83245
33631
83245
33631
33631
95237
95237
95237
95237
95237
3363...

result:

ok 100000 lines

Test #89:

score: 0
Accepted
time: 172ms
memory: 22452kb

input:

100000
35363 1
64497 35363
35363 90718
90718 49164
49164 88493
43855 90718
87401 43855
97540 87401
82367 97540
43855 17981
17981 92277
13245 92277
13245 9582
73976 9582
49893 17981
49893 65931
65931 54324
54324 8718
8718 7739
7739 12708
49893 99970
99970 62379
13094 62379
13094 68722
25659 68722
256...

output:

2542
20970
34772
34772
6847
34772
83924
83924
6847
66048
66048
66048
66048
83924
66048
83924
89747
89747
66048
66048
67454
66048
67454
66048
67454
67454
67454
66048
67454
67454
67454
66048
66048
66048
67454
78266
78266
91345
78266
78266
67454
67454
67454
67454
67454
78266
78266
78266
67454
78266
782...

result:

ok 100000 lines

Test #90:

score: 0
Accepted
time: 165ms
memory: 22828kb

input:

100000
1 26824
80212 26824
42552 26824
40167 42552
40167 25762
42552 55232
55232 19023
19023 29531
80188 29531
55232 96935
96935 51536
70767 51536
42157 70767
42157 63860
60791 96935
42748 60791
38417 42748
38417 19987
19987 48266
27095 48266
18860 60791
88173 18860
88173 11183
11183 84896
77637 848...

output:

86115
56735
56735
86297
86297
86297
56735
86297
56735
86297
86297
86297
86297
86129
86129
9384
86129
9384
9384
94631
65922
65922
65922
65922
65922
94631
65922
94631
94631
73274
94631
73274
73274
4186
4186
4186
4186
61255
61255
61255
4186
61255
4186
61255
4186
61255
61255
35265
35265
35265
61255
6125...

result:

ok 100000 lines

Test #91:

score: 0
Accepted
time: 170ms
memory: 22824kb

input:

100000
19955 1
84526 19955
19955 82253
82253 69766
69766 39564
78061 82253
20536 78061
16463 20536
16463 32329
78061 37638
61710 37638
61710 72680
72680 40410
40410 71573
47355 37638
33604 47355
33604 2056
40750 2056
40750 6811
95885 6811
47355 90575
39304 90575
39304 74434
74434 25214
55905 25214
5...

output:

34019
61870
46848
46848
46848
46848
46848
37932
37932
37932
37932
37932
46848
37932
37932
61870
61870
61870
37932
71803
71803
71803
71803
71803
37932
37932
46848
46848
46848
46848
21920
21920
81959
81959
1640
81959
1640
81959
81959
21920
81959
81959
1640
81959
1640
1640
91767
91767
91767
91767
91767...

result:

ok 100000 lines

Test #92:

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

input:

100000
1 30281
1 48811
30281 90765
48811 35648
56751 90765
35648 18806
1184 90765
48811 61881
1184 15614
1 10907
15614 42647
87619 15614
30281 42038
90765 45270
42647 67275
90765 58413
58413 66581
66033 1
72854 67275
61881 26248
35648 60448
86572 61881
15555 18806
45821 45270
45270 17282
58466 1
584...

output:

70424
1
90765
90765
90765
1
93298
93298
93298
1
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
93298
...

result:

ok 100000 lines

Test #93:

score: 0
Accepted
time: 160ms
memory: 26976kb

input:

100000
1 17930
17930 62509
89212 62509
62509 19648
62509 79459
1 91935
55894 79459
17930 2867
89284 19648
77299 89212
55894 60990
439 19648
77299 37482
17929 60990
77014 439
439 77689
37390 17930
60990 15529
89284 24388
89284 44072
83184 15529
37390 47097
97632 439
37482 58980
17449 19648
70033 3739...

output:

73435
19648
19648
1
27606
27606
27606
27606
27606
27606
27606
27606
27606
27606
27606
27606
27606
1
1
1
1
1
1
1
17930
17930
17930
1
17930
17930
62509
62509
62509
62509
62509
62509
62509
62509
62509
62509
62509
17930
17930
1
17930
17930
62509
62509
62509
17930
62509
62509
62509
17930
17930
1
17930
17...

result:

ok 100000 lines

Test #94:

score: 0
Accepted
time: 143ms
memory: 27664kb

input:

100000
2642 1
1 39107
54351 1
1 20163
18871 1
53512 1
43936 2642
89331 43936
53117 18871
89331 90452
74149 89331
9964 18871
39107 8204
40654 2642
20163 58662
34469 54351
20163 62271
26684 90452
14341 8204
62271 71132
90452 17894
74351 58662
56085 18871
9964 31325
45110 90452
26684 85744
45046 9964
1...

output:

43562
2642
2642
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
45600
1
45600
1
1
1
1
1
1
1
1
1
45600
45600
45600
45600
45600
1
1
1
1
1
45600
1
45600
1
45600
45600
45600
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100000 lines

Test #95:

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

input:

100000
26275 1
26275 10868
8919 1
26275 2143
10868 56409
56409 3464
92086 10868
34758 2143
10868 10557
2143 57597
76875 3464
57597 96627
79335 2143
19553 34758
96627 66263
10557 31993
29283 92086
20144 96627
8919 25847
55324 31993
3464 49265
31993 35886
10279 1
94678 57597
86286 92086
36406 26275
57...

output:

67940
26275
26275
26275
26275
26275
26275
26275
26275
26275
26275
1
26275
1
26275
1
1
1
26275
26275
26275
26275
26275
26275
26275
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
26275
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
26275
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #96:

score: 0
Accepted
time: 120ms
memory: 27048kb

input:

100000
1 83842
99342 1
99342 2477
63557 99342
2477 36775
1 30993
87277 1
99342 85673
2477 68993
55358 99342
55358 61848
41895 61848
87277 21300
85673 99186
87277 94523
85673 80897
55011 61848
67242 63557
30226 55011
96910 30993
41895 78720
63549 85673
43572 36775
80897 63356
30100 80897
63549 78455
...

output:

33754
71163
71163
1
99342
1
71163
1
99342
1
71163
1
71163
1
99342
1
99342
99342
99342
1
99342
99342
99342
99342
99342
1
99342
1
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
99342
1
99342
1
...

result:

ok 100000 lines

Test #97:

score: 0
Accepted
time: 155ms
memory: 26484kb

input:

100000
1 25916
8165 1
26197 8165
63260 1
8165 12903
25916 28406
26197 33743
98529 26197
10939 25916
25916 7684
39885 10939
2678 33743
39885 11137
12903 16718
10868 1
813 11137
33743 79666
2678 44542
11137 68210
63260 38274
79912 26197
12903 77252
73043 79666
10868 16212
40776 28406
1 364
78683 11137...

output:

60967
1
83242
83242
83242
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #98:

score: 0
Accepted
time: 166ms
memory: 26496kb

input:

100000
15308 1
67961 1
92913 67961
58030 1
15308 13760
67961 81841
81841 30337
67961 7528
2545 92913
67961 17104
13760 39075
98782 2545
1 43353
2545 74025
60324 30337
58030 82770
17716 43353
81841 1462
1 5373
42358 1462
24272 67961
94596 92913
88522 58030
17104 27915
1 84015
58030 97162
13951 88522
...

output:

55171
1
37958
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #99:

score: 0
Accepted
time: 196ms
memory: 25968kb

input:

100000
1 17148
17148 70273
70273 78151
68435 78151
61002 78151
63604 78151
68435 98238
98238 49115
36310 70273
1 48161
70273 30016
69262 61002
33946 36310
33230 98238
73675 48161
77928 61002
53765 68435
13828 1
99391 33230
1 88741
58344 78151
98238 32201
28425 58344
64107 1
70273 4187
49115 50196
33...

output:

90392
1
16629
1
16629
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
76574
1
1
1
76574
1
76574
76574
76574
1
1
1
1
1
1
1
76574
1
76574
76574
76574
76574
76574
76574
76574
76574
76574
1
1
1
76574
1
1
1
1
1
1
1
76574
76574
76574
76574
76574
76574
76574
1
1
1
1
1
1
1
1
1
76574
1
76574
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100000 lines

Test #100:

score: 0
Accepted
time: 160ms
memory: 26288kb

input:

100000
1 36134
68993 1
40578 68993
41773 68993
41773 581
1 85403
581 47541
581 30682
68993 37286
30682 72080
99669 47541
37286 57968
37649 85403
68993 24795
91207 24795
90816 85403
37649 11921
34682 581
67023 99669
67824 67023
30700 99669
85403 46638
40578 25049
88772 24795
19862 37649
41773 58755
4...

output:

34980
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
1
1
1
1
1
95218
1
1
1
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95218
95...

result:

ok 100000 lines

Test #101:

score: 0
Accepted
time: 145ms
memory: 26008kb

input:

100000
1 58743
55239 1
58743 74875
55239 86432
1 40509
80795 86432
74875 18609
55239 36921
63135 80795
63135 70006
80275 58743
80795 53012
74292 58743
86432 49693
46725 70006
80275 18177
74875 28814
58743 93035
26832 28814
373 53012
18177 72145
82121 55239
55239 67780
28814 65705
28814 6506
13730 26...

output:

9327
1
18177
58743
58743
1
1
1
1
1
58743
58743
58743
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 100000 lines

Test #102:

score: 0
Accepted
time: 194ms
memory: 24004kb

input:

100000
45672 1
1 10878
41126 10878
41126 22985
71033 41126
45672 10790
68682 1
1 92932
71033 58311
23951 45672
1 36433
68682 20601
58311 62403
1 61893
20601 68040
32795 41126
10790 71887
89330 45672
83282 32795
5348 89330
83813 1
36503 71033
81195 62403
19866 36503
74942 10878
26249 22985
79481 2624...

output:

78189
24625
24625
24625
3406
24625
24625
24625
249
249
249
249
249
249
249
249
249
249
249
249
249
249
249
249
249
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625
24625...

result:

ok 100000 lines

Test #103:

score: 0
Accepted
time: 197ms
memory: 23836kb

input:

100000
50519 1
60288 50519
55780 60288
79444 55780
55780 1955
24071 50519
22000 50519
50519 15667
52314 55780
53285 55780
55654 60288
1 2032
50519 24154
44929 55780
52314 52958
24071 95417
25114 1955
66778 55654
50519 62123
98975 22000
60288 3984
56132 52958
1 19012
42289 3984
50519 24127
42289 9944...

output:

72976
1
95415
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
96885
9688...

result:

ok 100000 lines

Test #104:

score: 0
Accepted
time: 198ms
memory: 23956kb

input:

100000
1 13065
77199 1
13065 59785
49062 13065
77199 661
70483 77199
34483 59785
11329 70483
69601 661
49062 8844
59785 10818
40787 13065
80008 77199
689 13065
59785 46767
40787 86952
4910 1
94407 69601
75923 10818
10818 47494
58914 46767
4967 11329
75923 73823
10216 49062
59785 95107
98911 34483
77...

output:

73195
1
1
1
1
1
4017
4017
4017
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537
45537...

result:

ok 100000 lines

Test #105:

score: 0
Accepted
time: 194ms
memory: 23584kb

input:

100000
1 82846
84668 82846
84668 98341
22888 98341
99333 82846
59944 22888
84668 59149
93994 22888
82846 58003
98341 41664
54700 22888
6798 59944
59149 36697
1 94877
98628 41664
87979 98341
81744 22888
93994 52252
87561 98341
25614 87561
93994 49053
29811 41664
29811 84418
71576 54700
58003 5102
228...

output:

54700
1
51374
51374
51374
51374
51374
1
82846
1
1
1
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51374
51...

result:

ok 100000 lines

Test #106:

score: 0
Accepted
time: 200ms
memory: 23720kb

input:

100000
1 85022
1 840
1 84171
85022 63247
57514 1
51622 85022
30762 1
20003 63247
26730 51622
18964 84171
85022 79665
57514 70832
51347 84171
85022 13592
1 83835
57514 12662
37229 30762
37229 94887
481 20003
70832 94842
84171 87001
84171 16435
79856 51622
94842 16355
70832 15029
20003 71735
63247 800...

output:

30148
8515
8515
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
76076
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10509
10...

result:

ok 100000 lines

Test #107:

score: 0
Accepted
time: 224ms
memory: 23192kb

input:

100000
99588 1
8943 99588
99588 83221
34882 83221
31399 34882
8943 72971
8943 31114
72971 98012
34882 32542
51651 31399
24510 31114
23811 1
24510 13930
72971 42578
85812 98012
51651 39558
66195 24510
51651 35630
31399 94607
51651 25393
55088 99588
76001 99588
35630 33407
83221 61792
42578 95236
4632...

output:

13436
1
14995
14995
38897
14995
14995
14995
38897
14995
14995
14995
38897
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
14995
1499...

result:

ok 100000 lines

Test #108:

score: 0
Accepted
time: 207ms
memory: 24064kb

input:

100000
11631 1
6567 11631
83192 1
60047 6567
98970 1
83826 1
55538 83192
89359 60047
89855 11631
18570 55538
89855 4703
1 4839
42451 60047
34715 4839
57163 34715
59112 18570
25388 42451
89359 77554
77123 55538
98385 59112
23416 59112
56416 60047
6278 42451
79484 98970
78361 77123
87904 83192
6278 12...

output:

15811
1
1608
1
1
1
1608
1
1608
1608
1608
1
1608
1
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
1608
...

result:

ok 100000 lines

Test #109:

score: 0
Accepted
time: 209ms
memory: 23108kb

input:

100000
1 80130
1 76936
80130 83327
80130 21005
80130 25609
80130 62297
94794 25609
40634 80130
40634 33222
2586 25609
58037 62297
40634 59563
2458 80130
42544 94794
5903 21005
19658 58037
83327 93910
94794 19646
2940 83327
42544 25298
40634 60060
60060 32181
30197 62297
40226 58037
52313 25609
1 470...

output:

20200
31881
31881
31881
31881
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
87851
...

result:

ok 100000 lines

Test #110:

score: 0
Accepted
time: 223ms
memory: 23400kb

input:

100000
1 78884
23525 78884
42200 23525
1 50282
78884 59993
43721 23525
1 33261
33261 91381
74563 33261
42200 46930
33261 93191
81628 59993
68274 78884
29066 43721
8328 33261
76325 81628
81628 79702
93191 36636
98124 43721
50282 79917
24794 91381
33261 18882
1 17595
71576 79702
84448 42200
1 21585
91...

output:

79322
21277
21277
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
32382
...

result:

ok 100000 lines

Test #111:

score: 0
Accepted
time: 207ms
memory: 23516kb

input:

100000
1 80513
44878 80513
80513 72579
99353 80513
72579 72699
81974 1
72699 74349
70008 74349
73731 72699
60064 1
1 7216
7216 2735
73731 45256
92542 73731
38486 73731
84775 72579
38486 45254
74349 56037
51797 92542
77256 51797
70008 63318
11928 45256
72699 22281
51797 68609
54268 45256
32077 73731
...

output:

66429
1
1
1
1
1
1
1
6427
6427
6427
6427
67473
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427
6427...

result:

ok 100000 lines

Test #112:

score: 0
Accepted
time: 203ms
memory: 22860kb

input:

100000
84754 1
84754 96349
1 64834
91422 84754
84754 26713
21940 84754
75968 1
95894 91422
84754 19214
3653 91422
55141 96349
64834 76370
23927 21940
32961 26713
90065 84754
14922 91422
39646 84754
8243 23927
39646 14255
64834 84878
3653 33289
1 45
19214 67694
90065 9486
55141 9647
99709 33289
3747 ...

output:

33846
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
81253
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
46443
...

result:

ok 100000 lines

Test #113:

score: 0
Accepted
time: 195ms
memory: 23168kb

input:

100000
1 96145
87837 1
16649 1
87837 85786
87837 80914
85786 9183
87837 54584
25064 1
25064 12168
12168 93876
54477 25064
32702 96145
96145 53793
85786 79507
86597 54477
63714 12168
80914 91693
63714 78118
78118 15328
63714 19260
86950 80914
19260 95203
2836 53793
64562 2836
19260 32517
84668 15328
...

output:

36942
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
36103
...

result:

ok 100000 lines

Test #114:

score: 0
Accepted
time: 194ms
memory: 21544kb

input:

100000
22658 1
64259 22658
13433 22658
80118 13433
88134 1
88134 56679
1 87620
56679 29652
1 27543
89924 80118
83491 64259
69862 56679
56679 68771
11068 13433
98864 80118
54643 1
29652 79069
67985 1
75898 27543
54643 97947
1040 22658
55004 1040
64885 27543
35093 56679
11068 84680
64259 81669
27543 3...

output:

9780
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
90796
9...

result:

ok 100000 lines

Test #115:

score: 0
Accepted
time: 217ms
memory: 22456kb

input:

100000
9037 1
1 44545
1 53681
9037 99042
1 43262
44545 72684
44545 77793
32255 53681
43262 79082
74178 79082
39653 1
394 39653
53681 98647
39653 77965
8626 99042
72684 38442
39653 857
857 35814
72684 87716
19418 32255
34061 8626
87716 49592
394 75370
43262 17110
17409 19418
17409 14605
14226 77965
3...

output:

41092
77625
77625
77625
57321
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
77625
...

result:

ok 100000 lines

Test #116:

score: 0
Accepted
time: 219ms
memory: 22656kb

input:

100000
35246 1
56433 35246
66599 1
96068 66599
66599 19649
56433 80667
66599 58447
85857 1
58447 35503
96068 90571
99411 85857
73709 99411
58447 87810
58447 79792
2734 90571
56832 2734
79017 58447
35503 9797
72597 19649
41014 73709
52930 66599
2734 16644
83389 79017
4746 79792
22651 52930
27358 8781...

output:

99213
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
44267
...

result:

ok 100000 lines

Test #117:

score: 0
Accepted
time: 219ms
memory: 21688kb

input:

100000
1 96851
96851 46436
1 54407
96851 23579
15388 46436
24002 54407
36520 96851
46436 55771
58970 23579
46436 45
87727 1
54407 79464
87727 96944
98053 23579
57065 46436
23579 23113
96437 87727
24899 96437
38406 98053
88720 45
57065 4166
96437 64242
75350 36520
15388 64184
91230 64242
4166 89574
6...

output:

70515
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
23240
...

result:

ok 100000 lines

Test #118:

score: 0
Accepted
time: 219ms
memory: 22704kb

input:

100000
1 17793
17793 64966
46305 17793
17793 36125
76650 1
46305 70143
64966 20131
58534 1
54119 20131
66990 17793
54003 58534
58534 94329
81551 36125
94329 87477
58534 396
84780 76650
12363 36125
16385 12363
48861 54119
54003 93623
17116 17793
20131 79070
22357 54003
66990 25164
20131 38034
68648 9...

output:

12245
73050
73050
98739
73050
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
98739
...

result:

ok 100000 lines

Test #119:

score: 0
Accepted
time: 213ms
memory: 21952kb

input:

100000
41827 1
85713 1
85713 32912
16815 1
54912 41827
67256 1
32912 90777
22189 54912
41827 43989
43989 82537
43989 52815
22044 16815
54912 97827
90777 29172
50286 22044
67256 34233
40107 22044
1382 34233
67256 65189
37156 97827
67256 74216
90777 72153
32713 34233
1 19437
45631 1382
88732 37156
887...

output:

55021
10588
10588
10588
32629
32629
32629
32629
32629
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
10588
...

result:

ok 100000 lines

Test #120:

score: 0
Accepted
time: 205ms
memory: 21996kb

input:

100000
1 31913
31913 33018
95859 1
95859 50634
33018 29949
31913 83150
18153 29949
95859 27091
29949 44381
66242 29949
1 87110
48142 27091
61381 66242
29949 7942
1 79874
31814 18153
95859 34012
92307 33018
79864 27091
79874 96037
7942 72135
79874 62987
27091 82488
62987 3288
97354 31814
4411 96037
3...

output:

7194
99434
21575
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
99434
9...

result:

ok 100000 lines

Test #121:

score: 0
Accepted
time: 219ms
memory: 21760kb

input:

100000
73436 1
73436 96603
48714 73436
96603 35086
1 2545
1 47583
96603 13738
86472 1
48324 96603
87926 2545
85059 47583
48324 36348
13738 65870
48324 96912
32160 35086
4137 35086
60006 13738
60006 99521
85059 82086
48231 73436
99521 20832
96912 36833
78256 32160
78256 51880
50352 48324
47583 70007
...

output:

64336
1
99398
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
73219
7321...

result:

ok 100000 lines

Test #122:

score: 0
Accepted
time: 203ms
memory: 22888kb

input:

100000
9620 73404
31693 29145
67656 54301
38268 27447
57501 62029
58522 17966
60198 39921
61975 84471
90331 62593
13684 58767
32924 4663
39653 51528
26428 1174
64656 77137
65981 68302
67409 1476
80670 15906
24210 86306
51304 69794
90825 866
5747 82161
36915 93706
48699 71852
79238 48763
44944 12793
...

output:

16253
16253
16253
16253
16253
16253
16253
16253
16253
16253
16253
16253
16253
16253
16253
16253
16253
1
16253
16253
16253
16253
16253
16253
16253
16253
16253
1
16253
16253
16253
16253
16253
16253
16253
16253
16253
1
89335
89335
89335
1
89335
89335
89335
89335
89335
89335
89335
89335
89335
89335
8933...

result:

ok 100000 lines

Test #123:

score: 0
Accepted
time: 130ms
memory: 23136kb

input:

99999
97729 32461
45270 20643
18415 14759
65898 98927
55252 72188
87124 32974
34108 59497
87283 40292
56297 65953
98640 71068
52565 63418
67468 13460
76069 34048
43819 45200
18817 9913
21036 72053
47631 60459
50771 88335
29114 48766
79555 68569
63033 99616
10652 2793
436 29947
43683 19350
62308 7801...

output:

38731
38731
38731
38731
38731
38731
38731
38731
38731
38731
38731
38731
38731
1
38731
1
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
1
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
45807
1
38731
38731
3873...

result:

ok 100000 lines

Test #124:

score: 0
Accepted
time: 161ms
memory: 17672kb

input:

69696
44626 33025
35202 58316
6707 44845
35846 1190
16193 62162
10333 2283
4896 38531
33329 24344
47422 14175
4466 13446
354 27229
24994 27620
38017 51201
69491 11080
16369 65233
21101 41583
37590 17797
19243 44061
66553 50060
35359 59631
61030 38435
28343 64658
10291 21775
59064 56683
52152 39440
6...

output:

26353
1
67426
1
67426
1
26353
1
26353
1
26353
1
26353
26353
26353
26353
26353
26353
26353
26353
26353
1
26353
26353
26353
26353
26353
26353
26353
26353
26353
26353
26353
1
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67426
67...

result:

ok 96969 lines

Test #125:

score: 0
Accepted
time: 108ms
memory: 23428kb

input:

100000
9620 73404
31693 29145
67656 54301
38268 27447
57501 62029
58522 17966
60198 39921
61975 84471
90331 62593
13684 58767
32924 4663
39653 51528
26428 1174
64656 77137
65981 68302
67409 1476
80670 15906
24210 86306
51304 69794
90825 866
5747 82161
36915 93706
48699 71852
79238 48763
44944 12793
...

output:

89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
89335
1
8933...

result:

ok 100000 lines

Test #126:

score: 0
Accepted
time: 92ms
memory: 22984kb

input:

99999
97729 32461
45270 20643
18415 14759
65898 98927
55252 72188
87124 32974
34108 59497
87283 40292
56297 65953
98640 71068
52565 63418
67468 13460
76069 34048
43819 45200
18817 9913
21036 72053
47631 60459
50771 88335
29114 48766
79555 68569
63033 99616
10652 2793
436 29947
43683 19350
62308 7801...

output:

45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
45807
1
4580...

result:

ok 100000 lines

Test #127:

score: 0
Accepted
time: 85ms
memory: 18164kb

input:

69696
44626 33025
35202 58316
6707 44845
35846 1190
16193 62162
10333 2283
4896 38531
33329 24344
47422 14175
4466 13446
354 27229
24994 27620
38017 51201
69491 11080
16369 65233
21101 41583
37590 17797
19243 44061
66553 50060
35359 59631
61030 38435
28343 64658
10291 21775
59064 56683
52152 39440
6...

output:

26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
26353
1
2635...

result:

ok 96969 lines

Test #128:

score: 0
Accepted
time: 78ms
memory: 24924kb

input:

100000
29194 73404
49618 29145
74388 54301
6929 27447
47312 29419
42825 17966
49450 54081
28446 18357
81056 62593
16227 55873
95277 4663
92013 51528
59091 16107
39917 77137
14765 48387
2359 1476
16501 93339
75610 86306
76487 69794
69240 866
72047 46538
33612 20186
93585 37074
50690 48763
58242 98081...

output:

24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
94438
24394
24394
...

result:

ok 100000 lines

Test #129:

score: 0
Accepted
time: 85ms
memory: 24952kb

input:

99999
96547 16966
65617 56088
47563 14759
29144 98927
62338 47234
17950 56391
77700 97654
47825 42983
84351 69117
94412 22443
4694 63418
24000 13460
68068 34048
61215 45200
90176 4121
58522 66124
48569 73151
56771 88335
43444 48766
11347 68569
39971 99616
70044 37623
83968 29947
70066 19350
71673 66...

output:

98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
32615
98302
98302
...

result:

ok 100000 lines

Test #130:

score: 0
Accepted
time: 51ms
memory: 19124kb

input:

69696
15385 18050
18566 58316
27737 44845
65451 22955
27213 62162
40731 18295
1441 33727
46466 24344
23473 7104
34094 13446
68386 929
48661 38545
56431 51201
13351 11080
34255 7260
58313 41583
19933 27771
69695 44061
10988 50060
60278 59631
29965 38435
34403 27732
50900 21775
20553 56683
54433 39440...

output:

24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932
9685
24932
24932...

result:

ok 96969 lines