QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#894687#10000. Add, Remove, TransformNemesis (Zonghan Yang, Mingchi Zhang, Jianjun Zhang) AC ✓4ms3840kbC++203.1kb2025-02-11 19:32:452025-02-11 19:32:47

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3456kb

input:

6
1 2
2 3
3 4
4 5
5 6

output:

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

result:

ok ok nice tree :D

Test #2:

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

input:

100
4 44
45 44
33 44
60 44
71 44
25 44
69 44
57 44
16 44
78 44
17 44
10 44
21 44
80 44
2 44
98 44
20 44
83 44
3 44
79 44
22 44
65 44
5 44
39 44
23 44
100 44
66 44
7 44
14 44
81 44
6 44
41 44
59 44
87 44
32 44
63 44
74 44
84 44
86 44
18 44
24 44
96 4
35 44
8 44
62 44
58 44
85 44
53 44
82 44
42 44
12 ...

output:

2883
1 4 44 2
1 2 4 26
1 44 45 48
1 48 44 3
3 1 26 2
3 2 1 4
3 1 44 5
3 5 1 45
96 4 3 48
26 3 96 48
96 26 48 4
1 3 48 96
48 1 96 4
4 48 96 3
4 3 45 5
4 5 3 48
4 3 44 6
3 6 4 96
95 4 3 96
3 95 96 6
90 4 96 3
96 90 3 6
76 4 3 96
3 76 96 6
73 4 96 3
96 73 3 6
72 4 3 96
3 72 96 6
61 4 96 3
96 61 3 6
38 ...

result:

ok ok nice tree :D

Test #3:

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

input:

99
60 59
19 59
47 59
83 59
41 59
33 59
99 59
7 59
15 59
36 59
50 59
9 59
10 59
76 59
14 59
30 59
90 59
43 59
88 59
8 59
27 59
25 59
81 59
3 59
38 59
68 59
24 59
1 59
58 59
21 59
44 59
87 59
4 59
74 59
72 59
79 59
16 59
64 60
82 59
12 59
37 59
22 59
61 59
65 59
20 59
35 59
54 59
56 60
23 59
26 59
28 ...

output:

953
1 59 60 29
1 29 59 2
1 59 19 71
1 71 59 3
2 1 59 4
2 4 1 3
2 1 60 49
2 49 1 19
71 3 2 29
1 2 71 29
71 1 29 3
3 71 29 2
3 2 59 5
3 5 2 71
3 2 19 49
3 49 2 60
77 19 3 29
4 3 77 29
77 4 29 19
2 3 29 77
29 2 77 19
1 3 77 29
77 1 29 19
19 77 29 3
19 3 71 5
19 5 3 77
19 3 59 6
19 6 3 60
99 59 19 71
29...

result:

ok ok nice tree :D

Test #4:

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

input:

99
59 57
45 57
93 57
5 57
80 57
77 57
70 57
14 57
64 57
39 57
81 57
18 57
7 57
11 57
73 57
67 57
8 57
29 59
66 57
63 57
4 57
74 57
83 57
21 57
52 59
28 57
27 57
26 57
36 57
38 57
32 59
53 59
24 57
49 57
58 45
94 57
89 57
65 59
12 57
46 59
54 57
60 57
51 57
50 57
15 59
19 59
40 93
35 45
6 57
99 59
96...

output:

1684
1 57 45 2
1 2 57 4
1 57 59 9
1 9 57 6
1 57 93 13
1 13 57 7
1 57 77 20
1 20 57 8
1 57 5 37
1 37 57 10
1 57 80 72
1 72 57 11
2 4 1 80
77 1 2 80
2 77 80 4
4 2 80 1
4 1 45 3
4 3 1 2
4 1 6 9
4 9 1 5
4 1 57 12
4 12 1 7
4 1 59 15
4 15 1 8
4 1 10 37
4 37 1 11
4 1 93 40
3 2 4 93
80 4 3 93
3 80 93 2
77 4...

result:

ok ok nice tree :D

Test #5:

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

input:

98
77 49
52 49
78 49
72 49
91 49
85 49
21 49
32 49
96 49
42 49
79 49
41 49
89 49
24 49
46 49
36 49
48 49
86 49
12 49
88 49
60 49
6 49
39 49
53 49
59 49
90 49
50 49
25 49
10 49
81 49
83 49
54 49
82 49
16 52
94 49
87 49
40 49
14 52
65 77
19 49
51 49
7 49
98 49
84 78
4 49
9 77
70 52
75 49
20 77
80 77
6...

output:

2023
1 49 77 2
1 2 49 4
1 49 78 3
1 3 49 6
1 49 52 14
1 14 49 7
1 49 72 28
1 28 49 10
4 1 6 3
4 3 1 7
4 1 77 5
4 5 1 10
4 1 49 11
4 11 1 52
4 1 78 17
4 17 1 72
14 7 4 6
2 4 14 6
14 2 6 7
1 4 6 14
6 1 14 7
7 6 14 4
7 4 10 5
7 5 4 6
7 4 77 8
7 8 4 49
7 4 52 11
7 11 4 72
7 4 78 66
5 6 7 14
3 7 5 14
5 3...

result:

ok ok nice tree :D

Test #6:

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

input:

100
26 54
89 54
35 54
99 54
24 54
18 54
66 54
59 54
49 54
52 54
70 54
73 54
1 26
4 54
69 54
20 26
2 54
50 26
79 54
94 54
78 89
5 54
74 54
44 54
75 54
98 54
96 54
90 54
17 54
38 26
58 26
80 89
30 26
15 26
48 26
16 26
82 35
63 54
33 26
39 89
22 89
65 54
67 54
60 89
3 54
97 89
7 70
40 26
19 26
56 54
88...

output:

2346
1 26 54 2
1 54 70 7
1 7 54 3
1 54 35 8
1 8 54 4
1 54 49 9
1 9 54 5
1 54 89 11
1 11 54 6
1 54 24 13
1 13 54 10
1 2 26 15
1 26 50 27
1 27 26 16
1 54 99 55
1 55 54 12
7 3 1 70
50 1 7 70
7 50 70 3
3 7 70 1
3 1 15 2
3 2 1 7
3 1 4 8
3 8 1 5
3 1 6 11
3 11 1 10
3 1 35 14
3 14 1 12
3 1 54 17
3 17 1 16
3...

result:

ok ok nice tree :D

Test #7:

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

input:

98
84 21
68 21
67 21
78 21
93 21
98 21
19 21
51 21
43 21
96 21
95 21
50 84
7 21
27 21
6 21
89 21
46 21
38 84
71 84
53 68
4 21
69 84
77 21
14 21
32 84
29 21
42 84
40 21
91 21
15 21
5 21
82 21
57 84
44 21
28 21
13 84
9 68
41 21
1 68
62 21
52 21
65 84
86 93
31 21
87 93
39 67
37 93
75 68
56 21
36 21
83 ...

output:

1124
1 68 21 3
1 21 67 2
1 2 21 4
1 21 51 8
1 8 21 5
1 3 68 9
1 21 84 10
1 10 21 6
1 21 19 11
1 11 21 7
1 21 93 37
1 37 21 12
1 21 98 49
1 49 21 14
1 21 78 58
1 58 21 15
1 21 95 92
1 92 21 18
2 4 1 98
95 1 2 98
2 95 98 4
51 1 98 2
98 51 2 4
4 98 2 1
4 1 9 3
4 3 1 98
4 1 5 8
4 8 1 6
4 1 7 11
4 11 1 1...

result:

ok ok nice tree :D

Test #8:

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

input:

99
94 74
1 74
89 74
80 74
87 74
79 74
61 74
23 74
96 94
24 74
25 74
97 74
86 94
82 74
5 74
76 74
41 89
9 94
43 74
50 89
17 89
12 74
72 74
3 74
8 74
58 74
18 23
62 74
60 74
39 89
15 87
55 74
10 89
27 80
44 74
42 94
11 94
48 1
98 23
63 89
37 89
54 80
4 1
91 74
93 74
29 94
59 74
78 94
32 79
38 80
52 94...

output:

3708
1 74 80 2
1 2 74 3
1 74 89 7
1 7 74 5
1 74 94 9
1 9 74 8
1 74 87 15
1 15 74 12
1 74 23 18
1 18 74 14
1 74 43 20
1 20 74 25
1 74 79 32
1 32 74 33
1 94 96 35
1 35 94 11
1 74 82 40
1 40 74 44
1 74 24 46
1 46 74 51
1 89 41 77
1 77 89 10
1 74 61 83
1 83 74 55
1 74 76 84
1 84 74 56
2 3 1 96
95 1 2 96...

result:

ok ok nice tree :D

Test #9:

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

input:

100
40 41
50 41
29 41
30 41
43 41
73 41
89 41
87 41
60 50
36 41
61 40
1 41
63 41
51 41
27 41
88 41
62 41
90 41
49 41
23 41
93 41
24 41
80 29
72 30
66 43
48 50
85 29
56 30
98 41
32 41
68 41
91 41
100 29
16 29
92 30
38 40
9 41
25 60
59 41
65 41
82 40
83 29
99 40
86 41
19 29
64 41
5 30
26 60
13 30
37 7...

output:

3332
1 41 40 2
1 2 41 9
1 41 43 3
1 3 41 14
1 41 30 5
1 5 41 23
1 41 73 7
1 7 41 24
1 41 89 8
1 8 41 32
1 41 29 16
1 16 41 49
1 41 93 18
1 18 41 59
1 41 51 22
1 22 41 62
1 41 36 34
1 34 41 63
1 41 87 39
1 39 41 64
1 41 27 42
1 42 41 65
1 41 50 46
1 50 60 17
1 17 50 48
1 46 41 68
2 9 1 93
57 1 2 93
2...

result:

ok ok nice tree :D

Test #10:

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

input:

99
29 35
14 35
80 35
61 35
19 35
48 14
65 35
67 35
18 29
39 29
56 35
49 14
93 29
64 29
95 35
16 61
77 35
53 35
24 35
31 35
75 35
60 61
79 39
46 29
74 35
86 80
13 61
42 65
22 35
8 80
85 35
94 19
91 14
96 39
37 35
63 65
69 56
73 35
72 61
17 80
21 48
52 19
10 14
20 29
92 67
27 31
4 14
41 29
89 14
25 14...

output:

3667
1 39 29 2
1 29 35 6
1 35 14 4
1 14 48 3
1 3 14 10
1 6 29 12
1 4 35 22
1 35 80 5
1 2 39 23
1 5 35 24
1 35 56 9
1 14 49 36
1 36 14 25
1 9 35 37
1 35 61 13
1 13 35 38
1 35 53 15
1 80 86 40
1 40 80 17
1 80 8 44
1 44 80 45
1 15 35 73
1 35 31 27
1 27 35 75
1 35 65 34
1 65 42 11
1 11 65 50
1 65 63 62
...

result:

ok ok nice tree :D

Test #11:

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

input:

100
42 55
63 55
69 42
54 55
74 55
82 69
83 55
18 69
99 55
33 55
95 42
90 63
85 42
66 69
14 55
75 55
81 42
3 69
40 63
89 42
77 63
53 74
88 83
60 83
84 55
35 63
47 42
52 54
15 54
97 55
50 55
70 42
98 54
67 55
44 82
24 63
71 54
1 42
4 74
16 33
27 42
80 18
61 85
48 42
13 85
38 55
51 63
87 18
96 89
65 63...

output:

3902
1 42 85 2
1 2 42 7
1 42 69 3
1 69 82 10
1 3 42 27
1 42 70 20
1 10 69 30
1 69 18 17
1 20 42 45
1 42 55 22
1 55 74 4
1 74 53 8
1 4 55 25
1 55 33 5
1 5 55 28
1 55 99 6
1 6 55 38
1 55 83 9
1 83 60 32
1 32 83 37
1 83 88 43
1 22 42 47
1 9 55 50
1 55 63 21
1 63 90 11
1 11 63 24
1 63 40 19
1 19 63 29
1...

result:

ok ok nice tree :D

Test #12:

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

input:

99
98 49
63 49
83 63
93 49
8 63
77 98
16 49
42 49
40 63
37 49
4 98
19 63
5 98
1 93
31 49
45 98
64 49
24 49
96 63
12 16
86 93
91 98
15 77
85 8
72 5
67 98
36 98
89 37
7 83
78 49
9 98
53 98
18 15
35 63
76 31
97 77
17 19
25 64
34 15
74 63
66 16
48 8
30 40
21 19
59 19
82 49
29 40
10 1
13 64
22 31
55 16
4...

output:

3335
1 93 49 23
1 49 64 3
1 3 49 24
1 49 98 4
1 98 91 14
1 14 98 9
1 98 45 39
1 39 98 53
1 4 49 54
1 49 37 11
1 98 36 68
1 68 98 67
1 37 89 69
1 11 49 78
1 49 31 22
1 22 49 82
1 49 63 26
1 63 83 2
1 2 63 35
1 63 8 6
1 6 63 52
1 63 19 17
1 17 63 56
1 63 40 29
1 40 30 50
1 50 40 60
1 40 88 58
1 29 63 ...

result:

ok ok nice tree :D

Test #13:

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

input:

99
22 89
66 89
23 89
79 89
72 89
51 89
39 66
44 89
43 79
53 22
50 66
14 51
92 66
58 79
80 79
18 23
42 66
76 22
11 50
36 22
71 39
48 79
84 89
98 89
85 50
68 44
77 44
60 80
9 22
69 42
31 14
75 39
94 89
30 23
96 22
15 89
3 76
95 42
74 66
19 42
78 22
8 23
28 79
38 58
21 51
65 79
34 44
97 79
6 36
2 71
29...

output:

4297
1 72 89 15
1 89 44 4
1 15 72 33
1 4 89 86
1 89 66 5
1 66 42 7
1 7 66 16
1 66 92 27
1 27 66 24
1 66 39 37
1 39 71 2
1 37 66 25
1 2 39 61
1 66 50 85
1 50 11 46
1 85 66 67
1 44 68 87
1 87 44 26
1 5 89 22
1 22 76 3
1 3 22 5
1 22 36 6
1 89 23 8
1 6 22 9
1 23 18 10
1 10 23 47
1 23 30 29
1 22 53 49
1 ...

result:

ok ok nice tree :D

Test #14:

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

input:

99
93 45
64 93
73 45
46 45
5 93
55 45
65 45
18 45
47 5
11 45
76 18
49 55
50 46
26 64
14 65
43 64
85 55
83 45
15 5
66 43
19 93
78 45
20 93
10 26
2 49
89 93
68 76
84 45
25 15
29 11
9 43
16 73
24 18
72 64
32 93
61 14
30 49
38 89
51 68
56 65
13 29
92 43
86 11
42 76
6 72
40 65
54 84
48 5
36 19
8 32
77 5
...

output:

3153
1 5 93 20
1 20 5 35
1 5 15 25
1 25 5 47
1 93 45 69
1 45 18 12
1 18 76 42
1 42 18 37
1 76 68 51
1 51 76 58
1 5 48 71
1 18 24 91
1 12 45 11
1 45 65 22
1 65 14 17
1 17 65 40
1 11 29 13
1 13 11 12
1 12 13 62
1 69 93 19
1 19 36 57
1 36 98 21
1 57 19 69
1 93 64 94
1 64 72 6
1 6 64 26
1 64 43 9
1 43 6...

result:

ok ok nice tree :D

Test #15:

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

input:

99
60 88
91 88
36 60
80 91
41 80
33 91
97 36
90 41
32 91
1 33
42 90
27 60
84 91
4 97
52 97
55 91
65 91
9 97
38 32
2 60
12 27
78 90
82 33
8 91
64 32
59 90
87 27
66 27
3 32
48 65
85 41
47 4
22 80
26 91
24 82
17 4
7 36
63 55
23 88
92 38
46 80
69 4
39 12
35 33
96 90
76 66
73 65
29 4
6 87
74 9
77 97
43 4...

output:

2397
1 33 91 8
1 91 32 3
1 8 33 10
1 32 38 92
1 92 32 64
1 33 82 24
1 24 33 35
1 35 24 79
1 3 91 26
1 91 80 13
1 80 41 16
1 16 80 75
1 80 22 21
1 21 80 83
1 80 46 61
1 41 85 93
1 93 41 43
1 41 90 96
1 96 41 45
1 90 42 53
1 13 91 55
1 91 84 18
1 55 50 62
1 62 55 13
1 53 90 59
1 90 78 58
1 18 91 65
1 ...

result:

ok ok nice tree :D

Test #16:

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

input:

100
33 25
26 25
10 26
78 25
30 26
66 25
79 10
22 33
63 78
76 33
44 63
14 66
47 22
9 25
88 79
12 63
82 12
54 10
61 78
99 47
95 76
29 10
64 9
71 25
8 66
77 78
90 78
58 14
65 76
35 8
28 9
97 9
100 14
41 97
37 82
59 71
1 47
42 9
3 78
52 78
94 22
67 65
36 37
16 22
24 12
38 61
17 22
4 22
27 76
56 35
68 76...

output:

2811
1 47 22 4
1 4 47 99
1 22 33 25
1 25 22 16
1 16 25 13
1 33 76 27
1 76 95 15
1 25 9 28
1 28 25 26
1 26 10 29
1 29 26 28
1 25 78 77
1 78 63 20
1 63 12 21
1 10 79 88
1 88 10 54
1 20 78 89
1 78 61 38
1 61 34 46
1 38 78 90
1 78 52 43
1 43 78 3
1 12 82 37
1 37 12 24
1 82 87 96
1 24 37 36
1 9 97 41
1 4...

result:

ok ok nice tree :D

Test #17:

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

input:

99
16 31
89 31
52 89
47 16
69 16
24 69
92 69
82 89
55 52
6 24
22 47
37 89
58 31
65 37
48 89
34 22
97 58
56 31
81 89
74 55
49 16
5 52
18 58
79 49
41 6
21 18
96 82
23 55
36 41
3 21
4 92
10 49
2 79
42 18
54 52
7 58
61 97
59 54
26 96
20 59
98 42
19 82
72 92
95 3
84 69
50 4
99 23
13 20
83 7
71 79
62 36
1...

output:

2056
1 21 18 91
1 18 42 29
1 91 21 3
1 3 32 9
1 32 67 87
1 87 32 25
1 9 3 91
1 29 18 17
1 18 58 7
1 58 31 16
1 16 49 10
1 49 79 2
1 31 56 33
1 2 49 93
1 10 16 47
1 47 22 27
1 27 47 10
1 22 34 45
1 45 22 51
1 16 69 68
1 69 84 8
1 8 69 24
1 69 92 66
1 92 4 50
1 50 92 72
1 4 15 85
1 24 6 41
1 41 24 8
1...

result:

ok ok nice tree :D

Test #18:

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

input:

100
17 92
15 92
68 17
72 15
70 17
3 70
40 68
23 72
7 3
82 3
95 3
20 95
9 68
25 82
59 40
90 25
54 23
75 90
91 54
12 59
38 82
32 7
63 90
10 20
41 38
19 59
2 63
39 75
1 41
73 63
100 54
79 91
65 32
28 41
89 100
69 1
64 91
80 25
6 10
52 100
96 65
58 28
61 69
14 25
37 7
27 41
13 54
30 15
55 27
48 75
66 13...

output:

1963
1 41 27 55
1 55 33 56
1 56 55 11
1 55 41 28
1 28 58 31
1 31 28 55
1 28 88 76
1 41 38 82
1 82 84 53
1 53 82 41
1 82 3 7
1 3 70 17
1 17 68 9
1 9 94 18
1 94 74 51
1 18 9 17
1 17 92 15
1 15 17 18
1 18 15 30
1 15 72 23
1 23 54 44
1 44 23 15
1 54 13 47
1 13 85 5
1 7 82 25
1 25 14 26
1 26 25 7
1 25 80...

result:

ok ok nice tree :D

Test #19:

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

input:

99
16 57
76 16
28 76
96 76
40 28
81 40
30 96
56 40
12 96
54 12
65 12
78 65
52 12
38 78
97 81
19 38
21 30
4 21
85 30
49 19
74 30
33 12
20 74
67 38
66 97
26 33
72 65
87 4
82 67
9 78
73 56
35 21
41 82
47 66
61 33
77 47
23 82
3 73
34 87
64 74
15 26
95 54
10 52
62 77
83 72
17 66
37 77
31 73
45 3
86 97
89...

output:

2888
1 9 53 48
1 48 9 78
1 78 65 32
1 65 12 14
1 32 78 48
1 12 33 61
1 33 26 15
1 78 38 19
1 19 49 94
1 94 19 78
1 61 12 52
1 52 10 18
1 18 80 5
1 5 18 36
1 18 52 61
1 12 96 30
1 30 21 2
1 2 30 85
1 30 74 20
1 20 30 12
1 96 76 16
1 76 28 40
1 15 33 63
1 63 44 58
1 58 63 15
1 14 65 72
1 72 83 42
1 42...

result:

ok ok nice tree :D

Test #20:

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

input:

98
81 63
9 81
80 9
68 9
92 68
76 68
98 68
74 98
2 74
3 92
29 3
54 29
66 54
10 3
51 3
60 66
33 54
97 60
48 3
7 33
23 97
16 66
69 23
6 23
25 23
11 97
39 11
95 25
27 16
30 27
12 27
75 33
87 25
89 12
90 48
83 23
34 7
8 89
28 90
94 6
17 28
40 11
91 87
77 28
72 69
73 25
62 94
32 87
43 72
70 43
52 62
18 12...

output:

3028
1 16 27 30
1 27 12 18
1 12 89 8
1 8 86 26
1 26 8 12
1 30 16 66
1 66 54 29
1 29 66 30
1 54 33 75
1 33 7 34
1 30 29 3
1 3 10 20
1 20 3 30
1 3 92 68
1 68 3 51
1 51 68 76
1 68 9 80
1 9 81 63
1 3 48 90
1 90 28 77
1 77 90 3
1 28 17 79
1 66 60 97
1 97 11 39
1 39 97 66
1 97 23 50
1 23 19 41
1 19 47 42
...

result:

ok ok nice tree :D

Test #21:

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

input:

99
86 19
98 86
71 98
61 71
25 71
13 25
27 61
64 25
17 61
90 17
5 64
67 5
99 5
29 17
48 67
85 64
10 67
58 10
54 90
53 17
36 54
38 53
30 38
57 53
78 53
92 58
95 92
81 85
73 92
56 78
66 56
41 58
52 92
72 41
84 95
60 95
28 60
6 52
20 6
4 60
74 38
51 78
96 28
97 4
82 52
83 60
63 51
69 96
3 28
1 97
79 3
3...

output:

3303
1 97 4 60
1 60 95 84
1 95 92 73
1 84 60 83
1 60 28 3
1 3 60 97
1 97 3 42
1 92 52 6
1 52 82 39
1 6 20 16
1 16 49 46
1 46 16 6
1 20 35 8
1 8 94 7
1 7 8 20
1 94 89 44
1 44 94 87
1 6 92 58
1 58 6 46
1 46 58 10
1 10 67 48
1 48 10 46
1 67 5 99
1 5 64 25
1 64 85 81
1 25 71 61
1 61 25 5
1 5 61 27
1 61 ...

result:

ok ok nice tree :D

Test #22:

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

input:

98
96 66
38 96
28 38
35 38
75 35
74 75
71 74
93 74
57 93
67 57
3 67
44 3
98 67
77 98
49 77
48 98
14 44
73 48
69 49
81 14
12 69
63 73
78 81
55 73
8 69
76 69
92 63
36 8
31 92
30 76
26 78
4 30
91 26
23 36
27 91
43 36
15 31
18 12
50 14
10 18
19 91
40 18
13 19
88 27
70 40
1 88
52 43
56 70
79 1
11 10
7 52...

output:

2453
1 82 37 5
1 5 82 94
1 79 33 61
1 88 27 91
1 91 19 13
1 13 87 51
1 19 45 85
1 51 13 91
1 91 26 78
1 78 91 51
1 51 78 81
1 81 14 50
1 50 81 51
1 14 44 3
1 3 67 57
1 57 3 14
1 67 98 48
1 48 73 55
1 55 48 67
1 98 77 49
1 49 69 8
1 8 36 23
1 69 12 18
1 18 10 11
1 11 18 40
1 40 70 56
1 56 40 11
1 23 ...

result:

ok ok nice tree :D

Test #23:

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

input:

100
57 54
69 57
23 69
86 23
99 86
6 99
73 6
82 6
35 73
76 35
44 35
13 44
33 13
2 76
34 2
40 33
43 2
59 13
26 43
67 26
47 43
15 47
60 47
74 67
58 67
16 58
53 58
72 2
96 58
90 74
41 16
46 15
38 58
29 38
17 38
5 38
7 46
63 47
88 46
78 88
51 63
61 78
42 78
84 88
28 63
91 61
21 17
81 91
10 78
65 91
32 65...

output:

2508
1 51 63 28
1 63 47 60
1 47 43 2
1 2 47 15
1 15 2 34
1 2 76 35
1 35 2 72
1 72 35 44
1 44 13 59
1 13 33 40
1 59 44 72
1 35 73 6
1 34 15 46
1 46 88 84
1 88 78 10
1 84 46 34
1 78 4 45
1 45 78 42
1 46 83 8
1 8 46 7
1 7 8 3
1 3 7 31
1 31 93 14
1 14 31 3
1 93 11 12
1 31 79 50
1 79 71 62
1 62 94 49
1 4...

result:

ok ok nice tree :D

Test #24:

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

input:

100
71 76
23 71
82 23
30 82
65 30
92 65
21 92
42 21
62 42
56 42
96 56
48 62
79 48
9 79
97 9
85 48
35 97
53 85
89 9
36 89
32 36
70 89
37 70
95 70
51 32
78 95
88 36
80 88
67 95
7 80
49 7
33 67
45 33
28 45
99 28
40 99
34 33
10 34
25 10
50 34
59 10
47 59
20 59
77 20
12 59
75 40
84 75
60 75
93 75
66 75
7...

output:

2583
1 83 41 91
1 91 83 2
1 2 91 57
1 91 86 3
1 57 90 8
1 8 57 2
1 57 55 19
1 55 94 52
1 19 57 61
1 61 19 24
1 94 69 11
1 69 14 29
1 11 73 31
1 31 11 94
1 11 38 72
1 38 64 46
1 19 27 87
1 87 60 75
1 75 87 19
1 19 75 66
1 86 6 98
1 98 26 22
1 22 98 86
1 75 40 99
1 99 75 84
1 84 99 28
1 28 45 33
1 33 ...

result:

ok ok nice tree :D

Test #25:

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

input:

98
84 60
49 84
57 49
35 57
23 35
64 23
29 35
75 64
25 75
86 25
55 25
14 29
88 14
58 14
3 58
56 3
98 56
59 98
62 98
5 59
19 62
34 19
39 19
70 34
79 5
27 79
41 27
66 27
63 66
77 34
24 77
52 24
12 24
78 52
68 78
40 78
38 40
44 38
61 40
20 61
43 61
82 43
22 20
6 20
53 20
4 40
8 22
37 4
91 43
65 8
97 65
...

output:

2086
1 73 11 15
1 15 47 26
1 26 15 85
1 15 73 16
1 16 87 89
1 89 16 15
1 15 89 36
1 87 94 93
1 89 50 91
1 91 43 82
1 82 91 89
1 43 61 20
1 61 40 4
1 40 38 44
1 20 22 8
1 8 20 6
1 22 67 96
1 6 8 2
1 8 65 48
1 65 97 32
1 32 65 51
1 51 32 7
1 7 10 72
1 72 7 51
1 32 18 21
1 4 37 42
1 42 46 31
1 31 42 4
...

result:

ok ok nice tree :D

Test #26:

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

input:

98
22 27
53 22
67 53
34 67
5 34
6 5
62 6
46 62
92 46
94 92
43 94
54 43
82 54
13 82
76 82
98 76
31 98
74 31
10 74
32 10
26 74
24 10
85 32
25 85
87 85
42 25
66 42
48 25
41 66
30 42
70 30
86 41
56 86
93 56
39 56
4 39
45 4
78 4
49 45
38 56
37 49
47 38
95 38
12 95
20 95
17 12
51 20
21 17
75 17
65 75
60 6...

output:

1835
1 11 91 15
1 15 11 9
1 3 16 8
1 8 33 68
1 68 8 3
1 91 75 17
1 33 61 55
1 55 72 14
1 72 28 44
1 14 55 73
1 55 33 81
1 28 57 52
1 52 28 90
1 90 52 88
1 75 65 60
1 81 55 79
1 79 63 58
1 58 79 81
1 63 18 96
1 18 71 69
1 69 18 50
1 16 23 80
1 80 29 97
1 97 80 16
1 50 19 84
1 84 36 2
1 2 84 50
1 84 5...

result:

ok ok nice tree :D

Test #27:

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

input:

5
4 5
5 1
1 2
2 3

output:

1
2 1 5 4

result:

ok ok nice tree :D

Test #28:

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

input:

5
1 2
1 3
1 4
4 5

output:

0

result:

ok ok nice tree :D

Test #29:

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

input:

6
1 2
1 3
1 4
1 5
5 6

output:

0

result:

ok ok nice tree :D

Test #30:

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

input:

6
1 2
1 3
1 4
4 5
5 6

output:

1
1 4 5 6

result:

ok ok nice tree :D

Test #31:

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

input:

6
1 2
1 3
1 4
4 5
4 6

output:

0

result:

ok ok nice tree :D

Test #32:

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

input:

6
1 2
1 3
3 4
1 5
5 6

output:

2
3 1 5 6
3 6 1 2

result:

ok ok nice tree :D

Test #33:

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

input:

5
1 2
2 3
3 4
4 5

output:

1
1 2 3 4

result:

ok ok nice tree :D

Test #34:

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

input:

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

output:

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

result:

ok ok nice tree :D

Test #35:

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

input:

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

output:

1
1 4 5 6

result:

ok ok nice tree :D

Test #36:

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

input:

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

output:

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

result:

ok ok nice tree :D

Test #37:

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

input:

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

output:

2
2 1 4 5
2 5 1 6

result:

ok ok nice tree :D

Test #38:

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

input:

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

output:

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

result:

ok ok nice tree :D

Test #39:

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

input:

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

output:

2
1 4 6 7
1 7 4 5

result:

ok ok nice tree :D

Test #40:

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

input:

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

output:

1
1 5 6 7

result:

ok ok nice tree :D

Test #41:

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

input:

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

output:

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

result:

ok ok nice tree :D

Test #42:

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

input:

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

output:

0

result:

ok ok nice tree :D

Test #43:

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

input:

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

output:

0

result:

ok ok nice tree :D

Test #44:

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

input:

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

output:

0

result:

ok ok nice tree :D

Test #45:

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

input:

99
10 8
79 10
92 79
28 92
9 28
64 9
49 64
21 49
33 21
6 33
48 6
78 6
47 78
19 47
35 19
40 35
85 40
74 85
90 74
2 90
1 2
81 1
73 1
65 73
61 65
13 65
97 65
70 97
53 97
57 70
5 53
76 5
38 76
34 53
95 34
15 76
44 15
43 15
22 43
41 22
68 15
82 43
63 68
80 68
26 80
58 80
69 26
31 26
17 31
99 31
24 99
84 9...

output:

2035
1 73 65 13
1 65 97 53
1 97 70 57
1 53 65 61
1 61 53 5
1 5 76 38
1 76 15 44
1 38 5 61
1 15 68 63
1 68 80 58
1 80 26 69
1 26 31 17
1 31 99 24
1 53 34 95
1 99 84 25
1 25 89 52
1 89 37 51
1 52 25 99
1 63 15 43
1 43 22 41
1 41 43 63
1 2 90 74
1 74 85 40
1 40 74 2
1 2 40 35
1 35 19 47
1 47 35 2
1 2 4...

result:

ok ok nice tree :D

Test #46:

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

input:

98
44 54
41 44
83 41
56 83
17 56
64 17
86 64
10 86
98 10
21 98
57 21
25 57
9 25
39 9
82 39
87 82
1 87
36 1
62 36
60 62
47 60
23 60
30 23
81 30
18 81
53 81
52 53
91 52
70 91
19 91
37 19
84 37
66 37
48 84
63 48
24 63
78 24
79 78
94 79
14 94
80 14
8 80
11 8
38 11
61 38
69 61
90 69
15 90
75 15
43 15
5 4...

output:

2720
1 87 82 39
1 39 9 25
1 25 39 87
1 87 25 57
1 36 62 60
1 60 23 30
1 30 81 18
1 81 53 52
1 52 91 70
1 70 52 81
1 91 19 37
1 37 84 48
1 48 37 66
1 18 30 60
1 66 48 63
1 63 24 78
1 78 63 66
1 66 78 79
1 79 94 14
1 14 79 66
1 66 14 80
1 80 8 11
1 11 80 66
1 66 11 38
1 38 61 69
1 69 38 66
1 66 69 90
...

result:

ok ok nice tree :D

Test #47:

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

input:

98
89 25
68 89
86 68
11 86
93 11
13 93
50 13
73 50
22 73
91 22
27 91
17 27
48 17
90 48
51 90
72 51
6 72
74 6
7 74
59 7
69 59
10 69
30 10
24 30
46 24
64 24
8 64
36 8
81 36
41 81
49 41
37 49
60 49
15 60
55 15
87 55
38 87
26 38
80 26
61 80
40 80
58 61
77 61
63 77
9 63
53 9
34 53
62 34
92 53
78 34
5 92
...

output:

2003
1 18 33 12
1 12 18 4
1 33 29 94
1 18 66 84
1 84 32 20
1 20 84 18
1 18 20 67
1 20 98 85
1 84 76 42
1 42 23 75
1 75 42 84
1 84 75 3
1 94 33 88
1 88 70 52
1 52 54 28
1 54 44 19
1 19 56 79
1 79 16 35
1 35 79 19
1 28 52 88
1 16 5 92
1 92 53 9
1 9 92 16
1 53 34 62
1 16 9 63
1 63 77 61
1 61 63 16
1 16...

result:

ok ok nice tree :D

Test #48:

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

input:

98
84 35
69 84
12 69
11 12
6 11
45 6
56 45
75 56
50 75
2 50
30 2
33 30
78 33
16 78
85 16
15 85
63 15
73 63
92 73
64 92
38 64
68 38
31 68
53 31
82 53
58 82
37 58
72 37
66 72
70 66
97 70
13 97
22 13
55 22
65 55
90 65
79 90
21 79
4 21
54 4
48 54
59 48
36 59
20 36
14 20
9 14
95 14
25 95
10 25
39 10
62 3...

output:

1154
1 51 44 49
1 49 29 18
1 18 77 91
1 91 18 49
1 49 51 52
1 52 49 91
1 91 52 83
1 83 42 23
1 23 19 8
1 8 23 57
1 57 98 60
1 60 57 8
1 23 83 91
1 57 3 81
1 81 27 43
1 43 81 57
1 57 43 28
1 28 41 86
1 86 28 57
1 57 86 40
1 40 17 24
1 24 40 57
1 57 24 80
1 80 93 47
1 47 80 57
1 57 47 87
1 87 46 94
1 ...

result:

ok ok nice tree :D

Test #49:

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

input:

99
4 8
9 4
30 9
44 30
32 44
41 32
58 41
7 58
46 7
87 46
93 87
14 93
21 14
51 21
13 51
98 13
77 98
37 77
22 37
96 22
38 96
66 38
36 66
86 36
12 86
69 12
94 69
10 94
17 94
40 17
42 40
16 42
90 16
73 90
65 73
92 65
50 92
45 50
67 45
24 67
56 24
72 24
27 72
61 27
48 61
64 48
91 48
25 48
70 25
54 70
19 7...

output:

1598
1 39 26 88
1 26 89 57
1 89 43 3
1 23 80 18
1 3 79 78
1 78 3 89
1 89 78 62
1 78 47 60
1 60 2 52
1 52 76 31
1 31 52 60
1 52 85 19
1 19 70 54
1 54 19 52
1 70 25 48
1 48 61 27
1 27 48 64
1 64 27 72
1 72 24 56
1 56 72 64
1 24 67 45
1 18 59 82
1 82 18 23
1 23 82 20
1 20 34 53
1 34 97 15
1 53 20 23
1 ...

result:

ok ok nice tree :D

Test #50:

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

input:

48
19 11
23 11
8 11
47 11
20 11
44 11
41 11
12 11
4 11
18 11
48 11
32 11
22 11
1 11
13 11
38 11
33 11
40 11
35 11
28 11
10 11
5 11
30 11
24 11
27 11
34 19
3 11
42 11
29 11
45 11
39 11
17 11
26 11
9 11
31 11
25 11
15 11
36 11
37 11
46 11
43 19
14 11
7 19
2 19
6 19
21 47
16 23

output:

145
1 11 19 2
1 2 11 3
1 11 23 16
1 16 11 4
1 11 47 21
1 21 11 5
2 3 1 47
23 1 2 47
2 23 47 3
3 2 47 1
3 1 19 6
3 6 1 2
3 1 11 8
3 8 1 4
3 1 5 21
6 2 3 47
23 3 6 47
6 23 47 2
5 3 47 6
47 5 6 2
2 47 6 3
2 3 21 1
2 1 3 47
2 3 19 7
2 7 3 4
2 3 11 9
16 4 2 23
21 2 16 23
16 21 23 4
6 2 23 16
23 6 16 4
5 ...

result:

ok ok nice tree :D

Test #51:

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

input:

50
16 42
15 42
37 42
17 42
38 42
49 42
21 42
48 42
11 42
31 42
10 42
13 42
36 42
9 42
44 42
40 42
35 42
20 42
6 42
7 42
30 42
41 42
25 42
14 42
18 16
33 42
24 42
1 42
4 16
43 42
3 42
29 42
32 42
12 42
45 16
22 42
28 16
39 42
8 42
19 42
47 42
34 42
2 42
50 42
26 16
27 42
23 15
46 42
5 42

output:

1621
1 42 16 4
1 4 42 2
1 42 15 23
1 23 42 3
2 1 42 5
2 5 1 15
2 1 16 18
2 18 1 3
23 3 2 4
1 2 23 4
23 1 4 3
3 23 4 2
3 2 15 5
3 5 2 23
3 2 42 6
3 6 2 16
45 16 3 18
15 3 45 18
45 15 18 16
4 3 18 45
18 4 45 16
2 3 45 18
45 2 18 16
1 3 18 45
18 1 45 16
16 18 45 3
16 3 23 5
16 5 3 18
16 3 42 7
3 7 16 4...

result:

ok ok nice tree :D

Test #52:

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

input:

49
8 47
30 47
16 47
17 47
33 47
31 47
49 47
43 47
32 47
6 47
14 47
22 47
26 47
15 8
34 47
35 47
25 47
1 47
11 8
20 47
44 47
38 47
39 47
36 47
46 47
45 8
28 30
40 47
13 47
12 8
27 47
7 47
2 47
4 47
19 49
18 8
42 30
24 47
9 47
5 47
21 16
48 47
3 47
23 47
41 47
10 47
29 31
37 8

output:

1715
1 47 8 11
1 11 47 2
1 47 49 19
1 19 47 3
1 47 16 21
1 21 47 4
1 47 30 28
1 28 47 5
1 47 31 29
1 29 47 6
11 2 1 49
31 1 11 49
11 31 49 2
16 1 49 11
49 16 11 2
2 49 11 1
2 1 47 7
2 7 1 49
2 1 8 12
2 12 1 3
2 1 4 21
2 21 1 5
2 1 6 29
2 29 1 30
19 3 2 31
16 2 19 31
19 16 31 3
11 2 31 19
31 11 19 3
...

result:

ok ok nice tree :D

Test #53:

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

input:

50
23 50
12 50
47 50
43 50
41 50
34 50
30 50
46 50
29 50
44 50
26 50
33 50
16 50
9 50
45 50
22 23
42 23
7 12
38 50
27 50
17 50
25 23
36 50
48 50
35 50
28 23
11 50
39 23
2 50
20 50
3 23
21 50
1 50
49 12
40 23
19 23
4 23
14 50
10 23
8 23
15 50
6 23
32 50
13 50
31 50
24 50
37 43
18 47
5 23

output:

1658
1 50 23 3
1 3 50 2
1 50 12 7
1 7 50 9
1 50 47 18
1 18 50 11
1 50 43 37
1 37 50 13
3 2 1 47
43 1 3 47
3 43 47 2
2 3 47 1
2 1 23 4
2 4 1 3
2 1 9 7
2 7 1 11
2 1 50 14
2 14 1 12
2 1 13 37
4 3 2 47
43 2 4 47
4 43 47 3
13 2 47 4
47 13 4 3
9 2 4 47
4 9 47 3
3 4 47 2
3 2 37 1
3 1 2 4
3 2 23 5
3 5 2 11
...

result:

ok ok nice tree :D

Test #54:

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

input:

48
14 12
4 12
46 12
9 12
39 12
20 12
25 12
48 12
23 12
36 12
10 12
17 14
43 12
21 12
42 12
31 12
5 12
26 14
32 14
19 4
6 12
22 4
1 46
29 46
44 12
27 12
47 46
45 36
33 4
41 14
34 23
35 4
28 12
8 4
15 12
30 14
13 9
7 4
24 9
37 12
11 12
2 4
3 39
18 9
40 4
38 39
16 12

output:

406
1 46 12 5
1 12 4 2
1 2 12 6
1 12 39 3
1 3 12 10
1 12 9 13
1 13 12 11
1 12 14 17
1 17 12 15
1 5 46 29
1 12 23 34
1 34 12 16
1 12 36 45
1 45 12 20
40 4 1 36
23 1 40 36
40 23 36 4
4 40 36 1
4 1 6 2
4 2 1 40
4 1 10 3
4 3 1 9
4 1 29 5
4 5 1 11
4 1 15 17
4 17 1 12
4 1 14 26
4 26 1 16
4 1 39 38
4 38 1 ...

result:

ok ok nice tree :D

Test #55:

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

input:

50
33 41
47 41
30 41
46 41
12 33
31 41
13 41
15 33
16 47
4 41
5 41
20 41
32 41
24 41
2 41
14 41
28 41
49 41
26 33
48 41
50 41
45 41
19 47
39 33
42 30
1 30
7 41
37 41
9 41
43 46
36 16
18 47
44 33
3 41
22 41
35 12
6 33
21 46
10 47
34 33
17 33
27 30
25 20
8 33
11 47
23 41
29 41
40 41
38 33

output:

1506
1 30 41 2
1 41 33 6
1 6 41 3
1 41 47 10
1 10 41 4
1 41 46 21
1 21 41 5
1 41 20 25
1 25 41 7
1 2 30 27
1 33 12 35
1 35 33 8
1 47 16 36
1 36 47 11
6 3 1 20
16 1 6 20
6 16 20 3
12 1 20 6
20 12 6 3
3 20 6 1
3 1 27 2
3 2 1 20
3 1 41 9
3 9 1 4
3 1 33 15
3 15 1 5
3 1 47 18
3 18 1 7
3 1 8 35
3 35 1 11
...

result:

ok ok nice tree :D

Test #56:

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

input:

49
20 48
10 48
28 48
25 48
35 48
18 48
19 48
49 20
33 20
26 48
36 10
31 10
2 48
23 48
3 48
4 48
7 48
47 20
9 20
16 35
32 48
41 19
42 10
22 49
29 2
27 35
17 48
5 2
21 18
8 48
44 35
45 48
11 48
14 31
12 10
37 19
13 48
39 35
30 35
15 41
38 26
34 10
43 20
24 49
1 16
40 29
46 48
6 4

output:

759
1 16 35 27
1 35 48 3
1 48 2 5
1 5 48 7
1 48 4 6
1 6 48 8
1 48 20 9
1 9 48 11
1 48 10 12
1 12 48 13
1 10 31 14
1 48 18 21
1 21 48 17
1 20 49 22
1 3 35 30
1 22 20 33
1 14 10 34
1 48 19 37
1 19 41 15
1 37 48 23
1 48 26 38
1 38 48 25
1 2 29 40
5 7 1 41
31 1 5 41
5 31 41 7
29 1 41 5
41 29 5 7
26 1 5 ...

result:

ok ok nice tree :D

Test #57:

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

input:

50
11 23
37 23
48 23
6 23
39 23
12 11
3 23
1 23
16 23
28 23
35 11
18 11
34 37
8 23
5 11
15 11
17 11
22 23
32 37
4 48
42 6
19 39
31 37
10 39
21 37
25 1
45 11
33 37
26 48
47 23
43 23
30 37
24 1
44 39
7 12
2 37
46 37
41 5
20 11
13 48
50 3
27 11
14 10
36 11
9 6
40 23
38 1
49 39
29 16

output:

591
1 23 37 2
1 2 23 8
1 23 48 4
1 4 23 22
1 23 6 9
1 9 23 28
1 23 11 15
1 11 12 7
1 7 11 17
1 15 23 40
1 23 39 19
1 39 10 14
1 11 5 41
1 41 11 18
1 19 23 43
1 23 16 29
1 14 39 44
1 29 23 47
1 23 3 50
42 6 1 38
25 1 42 38
42 25 38 6
24 1 38 42
38 24 42 6
16 1 42 38
42 16 38 6
12 1 38 42
38 12 42 6
1...

result:

ok ok nice tree :D

Test #58:

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

input:

48
11 21
13 21
43 11
9 11
30 21
26 21
46 21
37 11
40 11
6 43
7 13
27 13
10 11
38 21
17 9
2 21
3 11
25 21
18 6
16 7
42 7
1 9
45 46
20 21
19 21
33 26
12 11
47 30
31 30
4 13
14 21
35 21
32 43
23 13
41 9
8 37
36 21
48 11
29 43
22 37
5 30
15 13
28 30
44 11
39 46
24 10
34 9

output:

592
1 9 11 3
1 11 21 2
1 21 13 4
1 2 11 12
1 11 37 8
1 4 21 14
1 21 30 5
1 13 7 16
1 16 13 15
1 3 9 17
1 5 21 19
1 21 26 33
1 33 21 20
1 21 46 39
1 39 21 25
1 8 11 40
1 11 10 24
1 24 11 44
1 11 43 29
1 43 6 18
1 18 43 32
1 29 11 48
42 7 1 43
26 1 42 43
42 26 43 7
11 1 43 42
43 11 42 7
10 1 42 43
42 ...

result:

ok ok nice tree :D

Test #59:

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

input:

50
43 10
44 10
39 10
1 43
29 10
4 10
23 43
46 44
36 10
2 10
19 44
50 44
18 44
42 44
15 43
49 43
11 43
7 1
5 10
30 4
6 23
20 1
17 1
33 43
28 1
24 5
8 10
12 43
14 23
45 29
34 23
35 19
37 1
21 50
40 50
13 29
9 50
32 50
41 4
25 39
3 46
26 12
27 29
22 50
16 29
48 46
38 10
47 39
31 42

output:

1105
1 43 10 2
1 2 43 11
1 43 23 6
1 10 29 13
1 13 10 8
1 6 43 15
1 10 44 18
1 44 46 3
1 43 12 26
1 26 43 33
1 18 10 36
1 10 5 24
1 24 10 38
1 10 39 25
1 25 10 4
1 3 44 19
1 44 50 9
1 9 44 42
41 4 1 44
37 1 41 44
41 37 44 4
28 1 44 41
44 28 41 4
20 1 41 44
41 20 44 4
17 1 44 41
44 17 41 4
12 1 41 44...

result:

ok ok nice tree :D

Test #60:

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

input:

50
12 1
20 1
14 1
5 1
2 20
41 12
47 41
43 12
22 20
27 20
40 14
6 2
13 41
45 27
18 43
24 22
48 40
32 47
50 13
15 1
9 12
33 45
30 2
34 45
8 30
10 13
35 32
31 20
25 41
37 20
36 12
44 45
49 40
46 47
21 20
16 15
38 45
3 32
19 50
42 49
23 33
11 33
7 13
39 5
28 48
4 27
26 6
29 13
17 47

output:

756
1 20 27 4
1 12 43 18
1 18 12 9
1 4 20 21
1 20 22 24
1 12 41 25
1 41 13 7
1 13 50 19
1 19 13 10
1 24 20 31
1 27 45 34
1 45 33 11
1 25 12 36
1 11 45 38
1 20 2 6
1 2 30 8
1 6 20 37
1 37 6 26
1 7 41 47
1 47 32 3
1 3 47 7
1 14 40 48
1 40 49 42
39 5 1 50
49 1 39 50
39 49 50 5
43 1 50 39
50 43 39 5
41 ...

result:

ok ok nice tree :D

Test #61:

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

input:

49
2 5
27 5
35 2
14 5
38 2
8 2
4 27
45 5
30 2
39 27
24 35
25 27
32 14
3 14
49 5
11 35
33 14
21 32
41 27
34 3
48 2
16 25
17 45
15 48
26 21
6 41
12 27
13 38
20 38
40 4
22 48
47 14
31 21
18 4
46 27
28 30
36 22
7 14
42 33
1 35
43 14
37 33
10 14
44 11
19 25
23 42
9 34
29 8

output:

677
1 35 11 44
1 44 35 24
1 35 2 5
1 5 14 7
1 2 38 13
1 7 5 35
1 5 27 12
1 27 41 6
1 14 33 37
1 37 14 10
1 33 42 23
1 6 27 39
1 27 25 16
1 16 27 46
1 27 4 18
1 12 5 49
1 5 45 17
1 13 2 8
1 2 48 15
1 48 22 36
1 14 32 21
1 21 14 43
1 43 21 26
1 15 2 30
1 14 3 34
1 34 14 47
1 47 34 9
40 4 1 45
42 1 40 ...

result:

ok ok nice tree :D

Test #62:

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

input:

48
46 14
33 46
11 46
47 14
13 47
48 47
21 14
43 47
10 46
8 47
42 14
9 10
1 42
36 48
20 10
2 42
32 20
3 21
7 2
23 48
29 46
34 11
12 2
45 10
37 14
31 7
17 20
30 3
27 7
28 21
35 47
44 20
19 1
5 14
40 11
16 21
25 27
4 12
6 17
15 33
39 28
26 10
38 37
24 14
41 11
22 41
18 42

output:

500
1 42 14 5
1 14 47 8
1 5 42 18
1 47 48 23
1 23 47 13
1 8 14 24
1 14 21 16
1 21 3 30
1 42 2 7
1 2 12 4
1 7 27 25
1 25 7 31
1 30 21 28
1 16 14 37
1 14 46 29
1 46 10 9
1 10 20 32
1 20 17 6
1 32 10 26
1 6 20 44
1 9 46 11
1 46 33 15
1 11 41 22
1 22 11 9
2 4 1 41
33 1 2 41
2 33 41 4
27 1 41 2
41 27 2 4...

result:

ok ok nice tree :D

Test #63:

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

input:

48
12 2
32 12
43 32
3 12
13 43
42 13
14 32
35 13
4 14
18 35
6 42
5 13
7 3
9 32
36 6
25 5
30 5
37 3
39 6
33 32
8 9
40 32
19 33
47 9
46 3
15 5
38 39
27 43
41 13
28 35
29 27
48 40
24 19
10 46
31 47
23 48
26 48
20 13
22 40
11 23
44 36
16 28
45 48
34 40
1 34
17 13
21 29

output:

553
1 34 40 22
1 40 48 26
1 48 23 11
1 11 48 45
1 26 40 32
1 32 12 2
1 12 3 7
1 3 46 10
1 2 32 26
1 32 14 4
1 10 3 37
1 4 32 9
1 9 47 31
1 31 9 4
1 32 43 13
1 13 5 15
1 15 13 17
1 13 35 18
1 35 28 16
1 18 13 20
1 13 42 6
1 6 39 38
1 38 6 13
1 6 36 44
1 43 27 29
1 13 32 33
1 33 19 24
1 24 33 13
31 4 ...

result:

ok ok nice tree :D

Test #64:

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

input:

49
21 39
30 21
34 39
4 34
38 34
11 34
35 4
23 38
15 23
17 39
29 4
37 17
46 29
47 37
9 37
19 9
32 37
28 23
43 17
26 28
2 37
22 9
42 32
31 11
6 38
1 37
27 38
7 27
44 47
14 30
16 22
49 7
33 43
25 26
13 15
18 16
10 35
8 16
48 1
41 22
24 22
36 24
3 27
20 3
45 42
12 43
5 45
40 7

output:

952
1 37 9 19
1 19 37 2
1 9 22 41
1 22 16 8
1 37 47 44
1 44 37 17
1 17 43 12
1 12 17 44
1 17 39 21
1 21 30 14
1 14 21 17
1 39 34 4
1 34 38 6
1 4 35 10
1 10 4 39
1 4 29 46
1 38 27 3
1 27 7 40
1 6 34 11
1 3 38 23
1 23 15 13
1 13 23 3
1 8 22 24
1 23 28 26
1 37 32 42
1 42 45 5
1 5 42 37
19 2 1 48
47 1 1...

result:

ok ok nice tree :D

Test #65:

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

input:

50
31 29
22 31
38 29
12 38
46 38
42 46
4 12
8 42
24 4
27 4
18 12
43 38
19 24
16 8
21 4
23 19
5 8
20 16
7 16
25 16
48 24
50 25
17 25
32 21
39 32
30 23
3 39
41 43
40 18
34 40
9 32
1 20
36 7
33 48
37 20
2 43
13 16
49 3
26 18
28 36
47 3
14 41
6 3
35 49
15 14
45 6
11 12
10 26
44 15

output:

490
1 20 16 13
1 16 8 5
1 13 20 37
1 5 16 7
1 16 25 17
1 7 36 28
1 28 7 5
1 8 42 46
1 46 38 12
1 38 43 2
1 12 46 8
1 8 12 11
1 12 4 27
1 43 41 14
1 14 15 44
1 44 14 43
1 27 12 18
1 18 26 10
1 10 18 27
1 18 40 34
1 4 24 19
1 19 23 30
1 24 48 33
1 30 19 4
1 2 38 29
1 29 31 22
1 22 29 2
1 4 21 32
1 32 ...

result:

ok ok nice tree :D

Test #66:

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

input:

49
46 33
19 46
29 19
42 29
4 42
15 4
41 29
11 41
10 41
16 11
14 10
47 14
1 47
5 16
38 47
32 1
35 47
18 5
25 38
30 5
43 35
7 43
39 1
24 5
36 35
44 43
23 44
48 38
8 36
26 47
45 32
49 7
2 44
21 8
9 21
22 21
6 21
3 2
28 6
17 30
12 32
27 22
40 28
20 39
31 17
13 8
34 3
37 13

output:

526
1 47 38 25
1 25 47 26
1 47 14 10
1 10 41 11
1 11 16 5
1 5 11 10
1 10 5 18
1 5 30 17
1 17 5 24
1 24 17 31
1 41 29 19
1 19 46 33
1 33 19 41
1 29 42 4
1 18 10 47
1 47 35 36
1 36 47 18
1 35 43 7
1 43 44 23
1 44 2 3
1 18 36 8
1 8 21 9
1 9 8 18
1 21 22 27
1 8 13 37
1 27 21 6
1 6 28 40
1 40 6 27
44 3 1...

result:

ok ok nice tree :D

Test #67:

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

input:

50
39 46
12 39
20 12
7 20
25 20
41 7
48 25
36 7
44 41
10 36
6 44
21 6
24 36
8 6
5 24
40 41
13 40
19 13
49 13
29 8
2 5
30 8
11 49
14 30
37 2
18 11
9 5
42 19
34 42
27 9
45 34
23 30
3 27
17 37
50 30
32 13
15 45
1 34
47 50
31 50
22 37
33 17
16 42
38 16
28 42
35 17
26 17
43 17
4 16

output:

836
1 34 45 15
1 15 34 42
1 42 16 4
1 4 42 15
1 42 19 13
1 13 42 28
1 28 13 32
1 13 49 11
1 11 13 40
1 40 11 18
1 18 40 41
1 41 44 6
1 6 41 18
1 18 6 21
1 6 8 29
1 8 30 14
1 30 50 31
1 31 30 23
1 41 7 20
1 7 36 10
1 20 25 48
1 48 20 41
1 36 24 5
1 5 9 27
1 27 5 36
1 36 27 3
1 5 2 37
1 37 17 26
1 26 ...

result:

ok ok nice tree :D

Test #68:

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

input:

50
43 14
18 43
7 18
42 7
20 42
21 20
45 21
6 45
35 6
26 6
5 26
41 35
50 41
1 50
27 45
48 50
2 27
13 27
22 48
36 22
28 48
30 22
25 30
49 27
31 22
11 31
34 31
17 34
39 22
16 39
37 31
10 34
8 10
24 17
19 28
29 19
33 29
46 36
9 33
4 29
38 37
32 34
47 8
44 38
40 47
3 47
15 2
23 32
12 33

output:

695
1 50 48 22
1 22 31 11
1 31 34 10
1 34 32 23
1 23 34 17
1 48 28 19
1 19 29 4
1 29 33 9
1 4 19 48
1 11 22 30
1 22 39 16
1 16 22 36
1 10 31 37
1 37 38 44
1 44 37 10
1 22 50 41
1 41 35 6
1 6 26 5
1 5 6 41
1 6 45 21
1 45 27 13
1 27 2 15
1 15 27 49
1 21 20 42
1 42 21 6
1 6 42 7
1 7 18 43
1 43 7 6
1 6 ...

result:

ok ok nice tree :D

Test #69:

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

input:

48
11 32
48 11
15 48
7 15
13 7
46 13
16 46
28 16
23 46
43 28
27 16
14 27
44 14
17 44
20 27
42 17
41 42
34 42
3 42
30 3
2 30
29 2
24 2
33 3
18 30
40 30
21 18
1 17
37 33
9 37
8 17
31 1
26 37
39 9
47 31
22 26
45 1
36 9
5 21
25 8
19 45
12 36
35 45
4 19
6 47
10 47
38 22

output:

465
1 45 19 4
1 31 47 6
1 17 8 25
1 4 45 35
1 25 17 42
1 17 44 14
1 14 27 20
1 20 14 17
1 27 16 28
1 16 46 23
1 46 13 7
1 42 3 30
1 30 2 24
1 24 30 40
1 30 42 25
1 25 30 18
1 18 21 5
1 5 18 25
1 3 33 37
1 37 9 39
1 39 37 3
1 9 36 12
1 37 26 22
1 7 15 48
1 48 11 32
1 32 48 7
29 2 1 48
45 1 29 48
29 4...

result:

ok ok nice tree :D

Test #70:

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

input:

49
42 16
31 42
17 31
15 17
44 15
20 44
35 20
11 35
43 35
34 11
39 34
32 39
30 34
25 30
13 25
8 13
3 13
14 8
49 14
47 14
6 47
21 3
18 21
10 18
7 21
9 21
5 10
41 7
46 21
33 7
24 41
2 46
28 24
27 2
29 28
36 28
1 24
37 27
12 1
22 27
48 1
26 1
38 26
40 26
45 26
4 40
23 12
19 38

output:

794
1 26 40 4
1 24 28 29
1 4 26 45
1 26 38 19
1 29 24 41
1 41 7 33
1 7 21 9
1 33 41 29
1 21 46 2
1 2 27 22
1 22 2 21
1 21 18 10
1 10 21 22
1 22 10 5
1 21 3 13
1 13 8 14
1 14 47 6
1 6 14 49
1 14 13 21
1 13 25 30
1 30 34 11
1 11 30 13
1 34 39 32
1 13 11 35
1 35 20 44
1 44 35 13
1 13 44 15
1 15 17 31
1...

result:

ok ok nice tree :D

Test #71:

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

input:

50
7 40
35 7
36 35
10 36
30 10
43 30
5 43
45 5
21 45
15 21
26 15
41 26
46 26
28 46
34 28
44 34
33 44
12 44
47 12
37 44
3 47
48 47
38 3
25 38
13 47
31 13
18 13
8 48
6 48
2 31
24 18
29 31
42 29
39 29
32 2
16 24
11 16
4 11
23 8
17 23
1 2
19 23
27 11
22 19
14 19
50 14
49 50
9 14
20 19

output:

480
1 2 31 13
1 13 2 32
1 31 29 39
1 32 13 18
1 13 47 3
1 47 48 6
1 3 38 25
1 25 3 13
1 6 47 12
1 12 44 33
1 33 12 6
1 18 24 16
1 16 11 4
1 4 16 18
1 48 8 23
1 23 19 20
1 19 14 9
1 20 23 17
1 9 19 22
1 14 50 49
1 44 34 28
1 28 44 37
1 37 28 46
1 46 26 41
1 41 46 37
1 26 15 21
1 21 45 5
1 5 21 26
1 2...

result:

ok ok nice tree :D

Test #72:

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

input:

50
21 20
26 21
15 26
47 15
38 47
31 38
19 31
22 19
43 22
5 43
14 5
49 14
23 49
34 23
33 34
32 33
16 32
2 16
36 2
41 36
1 41
8 1
3 8
12 3
45 3
46 12
29 46
24 29
7 29
28 29
44 28
11 44
35 28
39 35
50 39
13 28
9 50
18 9
37 9
48 37
10 37
25 37
6 48
27 6
40 50
4 37
17 4
30 17
42 30

output:

534
1 8 3 45
1 41 36 2
1 2 16 32
1 32 2 41
1 41 32 33
1 33 34 23
1 23 33 41
1 3 12 46
1 46 29 7
1 7 46 3
1 29 28 13
1 28 44 11
1 13 29 24
1 11 28 35
1 41 23 49
1 49 14 5
1 5 49 41
1 41 5 43
1 43 22 19
1 19 43 41
1 41 19 31
1 31 38 47
1 47 31 41
1 41 47 15
1 15 26 21
1 21 15 41
1 41 21 20
1 35 39 50
...

result:

ok ok nice tree :D

Test #73:

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

input:

48
36 9
41 36
22 41
7 22
5 7
18 5
27 18
12 27
32 12
17 32
46 17
38 46
26 38
40 26
48 38
25 48
1 25
6 1
13 48
15 13
10 15
37 15
3 37
24 3
14 24
4 24
43 4
29 43
8 4
21 8
39 8
30 39
16 21
19 16
20 30
45 16
31 20
2 31
28 2
34 28
47 31
33 47
42 47
44 33
11 33
23 11
35 23

output:

468
1 25 48 13
1 13 15 10
1 10 13 25
1 15 37 3
1 3 24 14
1 14 3 15
1 24 4 8
1 4 43 29
1 8 21 16
1 16 8 24
1 24 16 19
1 48 38 26
1 38 46 17
1 17 32 12
1 12 17 38
1 38 12 27
1 27 18 5
1 5 27 38
1 38 5 7
1 8 39 30
1 30 20 31
1 31 30 8
1 8 31 2
1 2 28 34
1 34 2 8
1 31 47 42
1 47 33 44
1 33 11 23
1 7 22 ...

result:

ok ok nice tree :D

Test #74:

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

input:

49
45 22
33 45
2 33
42 2
29 42
47 29
30 47
3 30
7 3
1 7
40 1
21 40
24 21
49 24
14 49
17 14
32 17
37 32
36 37
23 36
39 23
5 39
9 5
44 9
38 44
27 38
28 27
25 28
35 25
13 25
19 13
46 19
18 46
26 19
4 26
48 4
41 4
16 41
15 16
43 15
6 43
10 43
20 10
34 20
8 34
31 10
12 31
11 12

output:

435
1 40 21 24
1 24 49 14
1 14 24 40
1 40 14 17
1 7 3 30
1 30 47 29
1 29 30 7
1 17 32 37
1 37 17 40
1 40 37 36
1 36 23 39
1 39 36 40
1 40 39 5
1 7 29 42
1 42 2 33
1 33 42 7
1 5 9 44
1 44 5 40
1 40 44 38
1 38 27 28
1 28 25 35
1 25 13 19
1 19 46 18
1 18 19 25
1 19 26 4
1 4 41 16
1 16 4 19
1 19 16 15
1...

result:

ok ok nice tree :D

Test #75:

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

input:

48
33 20
34 33
8 34
13 8
24 13
31 24
5 31
28 5
10 28
16 10
9 16
42 9
35 42
19 35
11 19
40 11
30 40
38 30
46 38
26 46
2 26
14 26
29 14
4 29
32 4
15 4
48 15
18 48
27 18
22 27
21 22
1 21
23 1
3 23
17 3
39 17
37 39
44 37
25 44
45 25
43 25
12 44
47 44
36 47
6 36
7 6
41 7

output:

344
1 23 3 17
1 21 22 27
1 17 39 37
1 37 44 12
1 44 25 43
1 12 37 17
1 43 44 47
1 47 36 6
1 6 7 41
1 41 6 47
1 27 18 48
1 48 27 21
1 21 48 15
1 15 4 32
1 32 15 21
1 4 29 14
1 14 26 2
1 2 14 4
1 26 46 38
1 38 30 40
1 40 38 26
1 26 40 11
1 11 19 35
1 35 11 26
1 26 35 42
1 42 9 16
1 16 42 26
1 26 16 10...

result:

ok ok nice tree :D

Test #76:

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

input:

4
2 1
3 1
4 1

output:

0

result:

ok ok nice tree :D

Test #77:

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

input:

9
1 9
2 9
3 9
9 4
5 9
6 9
9 7
9 8

output:

0

result:

ok ok nice tree :D

Test #78:

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

input:

99
8 1
2 8
8 3
8 4
5 8
6 8
8 7
8 9
10 8
8 11
8 12
8 13
8 14
8 15
16 8
17 8
8 18
8 19
8 20
21 8
22 8
23 8
24 8
8 25
8 26
27 8
28 8
8 29
30 8
31 8
8 32
33 8
34 8
35 8
36 8
8 37
8 38
8 39
8 40
8 41
8 42
43 8
44 8
8 45
8 46
47 8
48 8
49 8
50 8
8 51
52 8
8 53
8 54
8 55
56 8
8 57
8 58
59 8
8 60
61 8
62 8
...

output:

0

result:

ok ok nice tree :D