QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#423099#7278. Brought Down the Grading Server?dXqwq#60 1909ms118304kbC++233.1kb2024-05-27 21:06:072024-05-27 21:06:07

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 26220kb

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
2 3 
3 2 

result:

ok 

Test #2:

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

input:

20 2 20
18 2
12 5
20 9
4 2
17 4
7 15
9 2
5 5
13 15
19 5
3 5
10 19
8 5
7 10
9 11
3 16
7 18
9 5
3 8
18 4

output:

2 18 
5 12 
20 9 
2 4 
17 4 
15 7 
9 2 
5 5 
13 15 
19 5 
5 3 
10 19 
5 8 
7 10 
11 9 
3 16 
18 7 
9 5 
8 3 
4 18 

result:

ok 

Test #3:

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

input:

20 2 12
12 11
1 9
12 12
3 4
3 9
8 3
8 11
10 9
4 3
6 7
11 6
11 3
7 10
12 10
11 10
11 11
11 2
1 12
6 12
2 7

output:

12 11 
9 1 
12 12 
4 3 
3 9 
8 3 
11 8 
9 10 
3 4 
6 7 
6 11 
11 3 
10 7 
10 12 
11 10 
11 11 
2 11 
1 12 
12 6 
7 2 

result:

ok 

Test #4:

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

input:

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

output:

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

result:

ok 

Test #5:

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

input:

12 2 20
13 1
4 14
14 13
17 1
8 15
14 5
3 7
20 6
1 9
19 11
6 20
11 13

output:

13 1 
14 4 
14 13 
17 1 
8 15 
5 14 
3 7 
6 20 
1 9 
11 19 
20 6 
13 11 

result:

ok 

Test #6:

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

input:

20 2 19
2 15
16 8
1 11
15 18
7 17
19 7
14 2
3 10
12 5
14 10
8 5
17 11
16 11
3 13
12 9
4 17
1 6
6 4
13 19
18 5

output:

2 15 
8 16 
1 11 
15 18 
17 7 
7 19 
14 2 
3 10 
12 5 
10 14 
5 8 
11 17 
16 11 
13 3 
9 12 
17 4 
6 1 
4 6 
19 13 
18 5 

result:

ok 

Test #7:

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

input:

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

output:

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

result:

ok 

Subtask #2:

score: 15
Accepted

Test #8:

score: 15
Accepted
time: 1826ms
memory: 108172kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
53683 63612 
70370 78264 
42647 76881 
31741 39251 
66491 61186 
57686 65819 
59145 53278 
26052 71962 
81040 55279 
50859 51310 
24546 46800 
85013 91165 
61530 21890 
29099 84003 
86182 33573 
49212 10639 
91851 97312 
57682 14067 
5243 69674 
62508 99007 
26...

result:

ok 

Test #9:

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

input:

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

output:

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

result:

ok 

Test #10:

score: 0
Accepted
time: 55ms
memory: 107984kb

input:

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

output:

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

result:

ok 

Test #11:

score: 0
Accepted
time: 1745ms
memory: 107564kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

27085 59126 
75021 23663 
67175 78883 
3919 90698 
20718 67504 
49374 44011 
3236 1660 
71971 79270 
24502 90540 
54202 9732 
14395 88659 
52635 56600 
17986 21912 
92420 56526 
3472 40254 
20431 64330 
56003 9381 
57750 45529 
45230 9388 
83797 53437 
47526 75562 
63126 45219 
71020 87437 
50298 20...

result:

ok 

Test #12:

score: 0
Accepted
time: 1558ms
memory: 99460kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

16598 13223 
18759 19981 
2642 8681 
4102 18080 
11473 16749 
690 15290 
16229 17900 
17481 10684 
6328 12171 
9417 1150 
7185 5689 
10346 17102 
17958 9727 
2117 13756 
10955 13157 
245 2840 
5257 5337 
16622 6429 
17516 10772 
19349 13007 
2821 11359 
8897 14341 
2482 3974 
16241 17966 
18146 1545...

result:

ok 

Test #13:

score: 0
Accepted
time: 354ms
memory: 100656kb

input:

99006 2 11
7 2
3 10
10 8
1 8
5 2
3 6
6 3
5 3
6 8
7 7
4 7
1 3
7 6
10 5
6 4
9 9
8 4
2 9
6 1
10 7
10 1
9 7
6 9
6 9
3 10
10 10
6 2
7 7
6 5
3 8
4 4
5 2
5 8
8 2
10 9
8 3
7 4
2 2
8 9
8 10
8 9
2 1
1 5
4 7
4 9
6 9
8 10
2 4
6 3
4 1
2 10
3 5
10 7
7 1
4 10
6 6
1 4
4 8
10 9
3 9
5 5
6 1
9 2
2 7
9 5
9 8
1 3
5 6
7 ...

output:

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

result:

ok 

Test #14:

score: 0
Accepted
time: 1699ms
memory: 116728kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

25002 53479 
53479 63606 
40735 53479 
53479 83340 
53479 40775 
11458 53479 
53479 8684 
60405 53479 
53479 45116 
67722 53479 
26014 53479 
53479 87860 
55147 53479 
53479 22726 
67769 53479 
53479 129 
14600 53479 
53479 21514 
53479 32164 
60088 53479 
25415 53479 
53479 70946 
53479 27091 
3338...

result:

ok 

Test #15:

score: 0
Accepted
time: 1909ms
memory: 108104kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
79073 63660 
20397 41795 
1296 84311 
21178 3690 
31611 21052 
14323 51423 
34208 82468 
2785 83835 
28274 50594 
10993 59957 
34259 64334 
89407 73934 
14947 61083 
53201 89472 
33351 61243 
76632 58718 
85318 67464 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
79840 ...

result:

ok 

Test #16:

score: 0
Accepted
time: 913ms
memory: 107892kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

83824 80944 
26621 25208 
28836 57146 
43915 18169 
47842 59242 
78881 34224 
38791 20722 
91046 89723 
40306 72800 
94906 92681 
7263 41151 
76035 13332 
38800 93928 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
44111 42596 
36037 77687 
836 64592 
43568 35187 
34861 88539 
22111 37477 
98028...

result:

ok 

Test #17:

score: 0
Accepted
time: 1394ms
memory: 112372kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

91980 92592 
10704 12359 
56718 35873 
20301 28601 
78422 55548 
59974 74736 
81664 29025 
55916 70432 
34185 47381 
31764 56168 
30947 33997 
9029 70076 
52532 67057 
79680 99273 
54410 56704 
71652 45238 
12615 6894 
78041 66478 
40520 5451 
58133 5950 
89237 70551 
36028 97551 
83553 90630 
15211...

result:

ok 

Test #18:

score: 0
Accepted
time: 1576ms
memory: 108712kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457 
40457 80634 
49074 21580 
92701 14354 
44540 70461 
47132 47637 
84954 27979 
87556 60683 
43063 22633 
63643 49914 
4494 3571 
53632 88758 
17055 50019 
49334 79039 
67659 50111 
17945 48061 
60323 84596 
72033 14629 
77184 30069 
64209 36217 
49947 35279 
44707 45866 
58484 58146 
139...

result:

ok 

Subtask #3:

score: 5
Accepted

Dependency #2:

100%
Accepted

Test #19:

score: 5
Accepted
time: 1724ms
memory: 108208kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
53683 63612 
70370 78264 
42647 76881 
31741 39251 
66491 61186 
57686 65819 
59145 53278 
26052 71962 
81040 55279 
50859 51310 
24546 46800 
85013 91165 
61530 21890 
29099 84003 
86182 33573 
49212 10639 
91851 97312 
57682 14067 
5243 69674 
62508 99007 
26...

result:

ok 

Test #20:

score: 0
Accepted
time: 70ms
memory: 108324kb

input:

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

output:

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

result:

ok 

Test #21:

score: 0
Accepted
time: 72ms
memory: 107424kb

input:

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

output:

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

result:

ok 

Test #22:

score: 0
Accepted
time: 1734ms
memory: 114312kb

input:

100000 2 100000
47641 2360
32311 27712
96580 5576
74432 69601
5497 90724
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
35990 98338
39222 14744
65183 72902
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
65669 53200
74170 53434
44590 79062
45816 66321
37251 32926
26433 58003
...

output:

2360 47641 
32311 27712 
96580 5576 
69601 74432 
5497 90724 
72215 61408 
86499 23207 
43465 29593 
49534 20236 
83680 95890 
35990 98338 
39222 14744 
65183 72902 
73553 76527 
40936 27695 
96356 68239 
66861 20211 
59817 9499 
53200 65669 
74170 53434 
44590 79062 
45816 66321 
37251 32926 
26433...

result:

ok 

Test #23:

score: 0
Accepted
time: 1215ms
memory: 104216kb

input:

99000 2 100
50 76
35 53
70 8
48 61
12 98
81 72
62 87
10 6
61 83
63 42
66 10
7 46
35 66
47 52
30 60
70 33
27 16
32 82
8 28
85 83
95 21
63 84
47 57
89 86
73 69
52 60
72 78
78 61
61 36
3 73
31 50
47 20
69 28
74 34
100 79
99 56
51 43
86 15
38 28
3 94
63 76
19 56
31 90
79 97
3 23
14 44
78 63
99 85
14 50
...

output:

50 76 
53 35 
8 70 
61 48 
98 12 
72 81 
87 62 
10 6 
61 83 
63 42 
66 10 
7 46 
35 66 
47 52 
60 30 
70 33 
16 27 
82 32 
28 8 
83 85 
21 95 
84 63 
57 47 
86 89 
69 73 
52 60 
72 78 
78 61 
36 61 
73 3 
31 50 
47 20 
69 28 
74 34 
79 100 
99 56 
51 43 
15 86 
28 38 
3 94 
76 63 
56 19 
90 31 
97 7...

result:

ok 

Test #24:

score: 0
Accepted
time: 1858ms
memory: 110564kb

input:

99000 2 40000
13317 12923
15159 469
15225 23585
11180 1824
7967 39735
13852 38886
33137 27292
21697 28740
9887 13116
25732 33405
9156 39496
24569 31286
12900 32138
2345 1862
18626 2824
19382 25016
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
39650 14279
8842 1957
15206 22521
1...

output:

13317 12923 
469 15159 
23585 15225 
1824 11180 
39735 7967 
38886 13852 
27292 33137 
21697 28740 
9887 13116 
25732 33405 
9156 39496 
24569 31286 
32138 12900 
2345 1862 
18626 2824 
25016 19382 
18721 11342 
10236 296 
8228 37626 
30418 10247 
29998 33581 
4543 21676 
14279 39650 
8842 1957 
225...

result:

ok 

Test #25:

score: 0
Accepted
time: 1692ms
memory: 106652kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

27085 59126 
75021 23663 
67175 78883 
3919 90698 
20718 67504 
49374 44011 
3236 1660 
71971 79270 
24502 90540 
54202 9732 
14395 88659 
52635 56600 
17986 21912 
92420 56526 
3472 40254 
20431 64330 
56003 9381 
57750 45529 
45230 9388 
83797 53437 
47526 75562 
63126 45219 
71020 87437 
50298 20...

result:

ok 

Test #26:

score: 0
Accepted
time: 1552ms
memory: 93104kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

16598 13223 
18759 19981 
2642 8681 
4102 18080 
11473 16749 
690 15290 
16229 17900 
17481 10684 
6328 12171 
9417 1150 
7185 5689 
10346 17102 
17958 9727 
2117 13756 
10955 13157 
245 2840 
5257 5337 
16622 6429 
17516 10772 
19349 13007 
2821 11359 
8897 14341 
2482 3974 
16241 17966 
18146 1545...

result:

ok 

Test #27:

score: 0
Accepted
time: 328ms
memory: 101092kb

input:

99006 2 11
7 2
3 10
10 8
1 8
5 2
3 6
6 3
5 3
6 8
7 7
4 7
1 3
7 6
10 5
6 4
9 9
8 4
2 9
6 1
10 7
10 1
9 7
6 9
6 9
3 10
10 10
6 2
7 7
6 5
3 8
4 4
5 2
5 8
8 2
10 9
8 3
7 4
2 2
8 9
8 10
8 9
2 1
1 5
4 7
4 9
6 9
8 10
2 4
6 3
4 1
2 10
3 5
10 7
7 1
4 10
6 6
1 4
4 8
10 9
3 9
5 5
6 1
9 2
2 7
9 5
9 8
1 3
5 6
7 ...

output:

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

result:

ok 

Test #28:

score: 0
Accepted
time: 1724ms
memory: 110444kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

25002 53479 
53479 63606 
40735 53479 
53479 83340 
53479 40775 
11458 53479 
53479 8684 
60405 53479 
53479 45116 
67722 53479 
26014 53479 
53479 87860 
55147 53479 
53479 22726 
67769 53479 
53479 129 
14600 53479 
53479 21514 
53479 32164 
60088 53479 
25415 53479 
53479 70946 
53479 27091 
3338...

result:

ok 

Test #29:

score: 0
Accepted
time: 1866ms
memory: 107572kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
79073 63660 
20397 41795 
1296 84311 
21178 3690 
31611 21052 
14323 51423 
34208 82468 
2785 83835 
28274 50594 
10993 59957 
34259 64334 
89407 73934 
14947 61083 
53201 89472 
33351 61243 
76632 58718 
85318 67464 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
79840 ...

result:

ok 

Test #30:

score: 0
Accepted
time: 905ms
memory: 108408kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

83824 80944 
26621 25208 
28836 57146 
43915 18169 
47842 59242 
78881 34224 
38791 20722 
91046 89723 
40306 72800 
94906 92681 
7263 41151 
76035 13332 
38800 93928 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
44111 42596 
36037 77687 
836 64592 
43568 35187 
34861 88539 
22111 37477 
98028...

result:

ok 

Test #31:

score: 0
Accepted
time: 1395ms
memory: 112484kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

91980 92592 
10704 12359 
56718 35873 
20301 28601 
78422 55548 
59974 74736 
81664 29025 
55916 70432 
34185 47381 
31764 56168 
30947 33997 
9029 70076 
52532 67057 
79680 99273 
54410 56704 
71652 45238 
12615 6894 
78041 66478 
40520 5451 
58133 5950 
89237 70551 
36028 97551 
83553 90630 
15211...

result:

ok 

Test #32:

score: 0
Accepted
time: 1537ms
memory: 108120kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457 
40457 80634 
49074 21580 
92701 14354 
44540 70461 
47132 47637 
84954 27979 
87556 60683 
43063 22633 
63643 49914 
4494 3571 
53632 88758 
17055 50019 
49334 79039 
67659 50111 
17945 48061 
60323 84596 
72033 14629 
77184 30069 
64209 36217 
49947 35279 
44707 45866 
58484 58146 
139...

result:

ok 

Subtask #4:

score: 5
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #33:

score: 5
Accepted
time: 3ms
memory: 25528kb

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
2 3 
3 2 

result:

ok 

Test #34:

score: 0
Accepted
time: 1507ms
memory: 99492kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

16598 13223 
18759 19981 
2642 8681 
4102 18080 
11473 16749 
690 15290 
16229 17900 
17481 10684 
6328 12171 
9417 1150 
7185 5689 
10346 17102 
17958 9727 
2117 13756 
10955 13157 
245 2840 
5257 5337 
16622 6429 
17516 10772 
19349 13007 
2821 11359 
8897 14341 
2482 3974 
16241 17966 
18146 1545...

result:

ok 

Test #35:

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

input:

99006 2 11
7 2
3 10
10 8
1 8
5 2
3 6
6 3
5 3
6 8
7 7
4 7
1 3
7 6
10 5
6 4
9 9
8 4
2 9
6 1
10 7
10 1
9 7
6 9
6 9
3 10
10 10
6 2
7 7
6 5
3 8
4 4
5 2
5 8
8 2
10 9
8 3
7 4
2 2
8 9
8 10
8 9
2 1
1 5
4 7
4 9
6 9
8 10
2 4
6 3
4 1
2 10
3 5
10 7
7 1
4 10
6 6
1 4
4 8
10 9
3 9
5 5
6 1
9 2
2 7
9 5
9 8
1 3
5 6
7 ...

output:

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

result:

ok 

Test #36:

score: 0
Accepted
time: 1674ms
memory: 110608kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

25002 53479 
53479 63606 
40735 53479 
53479 83340 
53479 40775 
11458 53479 
53479 8684 
60405 53479 
53479 45116 
67722 53479 
26014 53479 
53479 87860 
55147 53479 
53479 22726 
67769 53479 
53479 129 
14600 53479 
53479 21514 
53479 32164 
60088 53479 
25415 53479 
53479 70946 
53479 27091 
3338...

result:

ok 

Test #37:

score: 0
Accepted
time: 1876ms
memory: 107484kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
79073 63660 
20397 41795 
1296 84311 
21178 3690 
31611 21052 
14323 51423 
34208 82468 
2785 83835 
28274 50594 
10993 59957 
34259 64334 
89407 73934 
14947 61083 
53201 89472 
33351 61243 
76632 58718 
85318 67464 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
79840 ...

result:

ok 

Test #38:

score: 0
Accepted
time: 936ms
memory: 108048kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

83824 80944 
26621 25208 
28836 57146 
43915 18169 
47842 59242 
78881 34224 
38791 20722 
91046 89723 
40306 72800 
94906 92681 
7263 41151 
76035 13332 
38800 93928 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
44111 42596 
36037 77687 
836 64592 
43568 35187 
34861 88539 
22111 37477 
98028...

result:

ok 

Test #39:

score: 0
Accepted
time: 1421ms
memory: 118304kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

91980 92592 
10704 12359 
56718 35873 
20301 28601 
78422 55548 
59974 74736 
81664 29025 
55916 70432 
34185 47381 
31764 56168 
30947 33997 
9029 70076 
52532 67057 
79680 99273 
54410 56704 
71652 45238 
12615 6894 
78041 66478 
40520 5451 
58133 5950 
89237 70551 
36028 97551 
83553 90630 
15211...

result:

ok 

Test #40:

score: 0
Accepted
time: 1538ms
memory: 108728kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457 
40457 80634 
49074 21580 
92701 14354 
44540 70461 
47132 47637 
84954 27979 
87556 60683 
43063 22633 
63643 49914 
4494 3571 
53632 88758 
17055 50019 
49334 79039 
67659 50111 
17945 48061 
60323 84596 
72033 14629 
77184 30069 
64209 36217 
49947 35279 
44707 45866 
58484 58146 
139...

result:

ok 

Test #41:

score: 0
Accepted
time: 64ms
memory: 107724kb

input:

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

output:

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

result:

ok 

Test #42:

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

input:

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

output:

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

result:

ok 

Test #43:

score: 0
Accepted
time: 1738ms
memory: 113660kb

input:

100000 2 100000
47641 2360
32311 27712
96580 5576
74432 69601
5497 90724
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
35990 98338
39222 14744
65183 72902
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
65669 53200
74170 53434
44590 79062
45816 66321
37251 32926
26433 58003
...

output:

2360 47641 
32311 27712 
96580 5576 
69601 74432 
5497 90724 
72215 61408 
86499 23207 
43465 29593 
49534 20236 
83680 95890 
35990 98338 
39222 14744 
65183 72902 
73553 76527 
40936 27695 
96356 68239 
66861 20211 
59817 9499 
53200 65669 
74170 53434 
44590 79062 
45816 66321 
37251 32926 
26433...

result:

ok 

Test #44:

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

input:

20 2 20
18 2
12 5
20 9
4 2
17 4
7 15
9 2
5 5
13 15
19 5
3 5
10 19
8 5
7 10
9 11
3 16
7 18
9 5
3 8
18 4

output:

2 18 
5 12 
20 9 
2 4 
17 4 
15 7 
9 2 
5 5 
13 15 
19 5 
5 3 
10 19 
5 8 
7 10 
11 9 
3 16 
18 7 
9 5 
8 3 
4 18 

result:

ok 

Test #45:

score: 0
Accepted
time: 1205ms
memory: 103528kb

input:

99000 2 100
50 76
35 53
70 8
48 61
12 98
81 72
62 87
10 6
61 83
63 42
66 10
7 46
35 66
47 52
30 60
70 33
27 16
32 82
8 28
85 83
95 21
63 84
47 57
89 86
73 69
52 60
72 78
78 61
61 36
3 73
31 50
47 20
69 28
74 34
100 79
99 56
51 43
86 15
38 28
3 94
63 76
19 56
31 90
79 97
3 23
14 44
78 63
99 85
14 50
...

output:

50 76 
53 35 
8 70 
61 48 
98 12 
72 81 
87 62 
10 6 
61 83 
63 42 
66 10 
7 46 
35 66 
47 52 
60 30 
70 33 
16 27 
82 32 
28 8 
83 85 
21 95 
84 63 
57 47 
86 89 
69 73 
52 60 
72 78 
78 61 
36 61 
73 3 
31 50 
47 20 
69 28 
74 34 
79 100 
99 56 
51 43 
15 86 
28 38 
3 94 
76 63 
56 19 
90 31 
97 7...

result:

ok 

Test #46:

score: 0
Accepted
time: 1818ms
memory: 110308kb

input:

99000 2 40000
13317 12923
15159 469
15225 23585
11180 1824
7967 39735
13852 38886
33137 27292
21697 28740
9887 13116
25732 33405
9156 39496
24569 31286
12900 32138
2345 1862
18626 2824
19382 25016
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
39650 14279
8842 1957
15206 22521
1...

output:

13317 12923 
469 15159 
23585 15225 
1824 11180 
39735 7967 
38886 13852 
27292 33137 
21697 28740 
9887 13116 
25732 33405 
9156 39496 
24569 31286 
32138 12900 
2345 1862 
18626 2824 
25016 19382 
18721 11342 
10236 296 
8228 37626 
30418 10247 
29998 33581 
4543 21676 
14279 39650 
8842 1957 
225...

result:

ok 

Test #47:

score: 0
Accepted
time: 636ms
memory: 67032kb

input:

50000 2 100000
98362 76208
42505 92719
18460 89381
66596 99759
12116 82137
92591 4043
134 72622
43432 47060
48543 74386
24648 12398
15658 30807
44636 99813
53782 10967
99129 43783
31224 17380
1594 90445
4363 11935
83427 79197
57698 64946
55536 76058
25332 10458
66313 31325
77601 43931
23727 27286
38...

output:

98362 76208 
92719 42505 
18460 89381 
66596 99759 
82137 12116 
92591 4043 
134 72622 
47060 43432 
48543 74386 
12398 24648 
15658 30807 
44636 99813 
10967 53782 
99129 43783 
31224 17380 
90445 1594 
11935 4363 
83427 79197 
57698 64946 
55536 76058 
10458 25332 
66313 31325 
77601 43931 
27286 ...

result:

ok 

Test #48:

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

input:

1000 2 90000
23815 25217
6968 45020
4010 7431
26939 4476
2589 64334
32215 84328
8428 78626
15793 9319
30520 48129
73647 7113
69869 35054
2118 65562
13093 15772
66586 74609
2641 56451
80789 47288
35419 63553
4412 70594
45845 37418
71587 74602
19228 59932
53972 84459
7561 23333
29074 12664
26734 61072...

output:

25217 23815 
45020 6968 
4010 7431 
26939 4476 
2589 64334 
84328 32215 
78626 8428 
15793 9319 
30520 48129 
7113 73647 
69869 35054 
2118 65562 
15772 13093 
74609 66586 
56451 2641 
80789 47288 
35419 63553 
70594 4412 
37418 45845 
71587 74602 
59932 19228 
84459 53972 
7561 23333 
12664 29074 
...

result:

ok 

Test #49:

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

input:

20 2 12
12 11
1 9
12 12
3 4
3 9
8 3
8 11
10 9
4 3
6 7
11 6
11 3
7 10
12 10
11 10
11 11
11 2
1 12
6 12
2 7

output:

12 11 
9 1 
12 12 
4 3 
3 9 
8 3 
11 8 
9 10 
3 4 
6 7 
6 11 
11 3 
10 7 
10 12 
11 10 
11 11 
2 11 
1 12 
12 6 
7 2 

result:

ok 

Test #50:

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

input:

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

output:

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

result:

ok 

Test #51:

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

input:

12 2 20
13 1
4 14
14 13
17 1
8 15
14 5
3 7
20 6
1 9
19 11
6 20
11 13

output:

13 1 
14 4 
14 13 
17 1 
8 15 
5 14 
3 7 
6 20 
1 9 
11 19 
20 6 
13 11 

result:

ok 

Test #52:

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

input:

20 2 19
2 15
16 8
1 11
15 18
7 17
19 7
14 2
3 10
12 5
14 10
8 5
17 11
16 11
3 13
12 9
4 17
1 6
6 4
13 19
18 5

output:

2 15 
8 16 
1 11 
15 18 
17 7 
7 19 
14 2 
3 10 
12 5 
10 14 
5 8 
11 17 
16 11 
13 3 
9 12 
17 4 
6 1 
4 6 
19 13 
18 5 

result:

ok 

Test #53:

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

input:

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

output:

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

result:

ok 

Test #54:

score: 0
Accepted
time: 1736ms
memory: 108848kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
53683 63612 
70370 78264 
42647 76881 
31741 39251 
66491 61186 
57686 65819 
59145 53278 
26052 71962 
81040 55279 
50859 51310 
24546 46800 
85013 91165 
61530 21890 
29099 84003 
86182 33573 
49212 10639 
91851 97312 
57682 14067 
5243 69674 
62508 99007 
26...

result:

ok 

Test #55:

score: 0
Accepted
time: 1616ms
memory: 106804kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

27085 59126 
75021 23663 
67175 78883 
3919 90698 
20718 67504 
49374 44011 
3236 1660 
71971 79270 
24502 90540 
54202 9732 
14395 88659 
52635 56600 
17986 21912 
92420 56526 
3472 40254 
20431 64330 
56003 9381 
57750 45529 
45230 9388 
83797 53437 
47526 75562 
63126 45219 
71020 87437 
50298 20...

result:

ok 

Subtask #5:

score: 15
Accepted

Test #56:

score: 15
Accepted
time: 6ms
memory: 26400kb

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 2 3 3 
2 3 2 2 

result:

ok 

Test #57:

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

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

475 1156 2334 540 
2439 2421 750 1328 
1792 471 1051 2007 
705 2269 786 1776 
1622 755 1277 1674 
590 603 1378 1217 
239 1920 967 1658 
2307 78 1589 857 
861 1634 2322 2172 
2077 2021 1381 2179 
1547 1126 345 2126 
1214 412 1477 994 
1857 2085 978 831 
281 2406 1844 2174 
521 2334 2254 1779 
1508 28...

result:

ok 

Test #58:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

1 3 2 2 
1429 1 1429 1 
3 7 4 4 
1430 1430 3 3 
5 6 1 6 
1431 1431 5 5 
7 11 8 8 
1432 1432 7 7 
9 5 10 10 
1433 9 1433 9 
11 15 12 12 
1434 1434 11 11 
13 14 9 14 
1435 1435 13 13 
15 19 16 16 
1436 1436 15 15 
17 13 18 18 
1437 17 1437 17 
19 23 20 20 
1438 1438 19 19 
21 22 17 22 
1439 1439 21 21...

result:

ok 

Test #59:

score: 0
Accepted
time: 14ms
memory: 28620kb

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #60:

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

input:

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

output:

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

result:

ok 

Test #61:

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

input:

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

output:

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

result:

ok 

Test #62:

score: 0
Accepted
time: 10ms
memory: 27548kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

66 132 102 72 83 154 151 140 155 5 145 155 7 14 145 9 116 26 114 12 4 128 102 119 19 125 123 123 19 19 125 125 57 80 104 55 33 122 101 122 93 92 97 97 86 76 62 95 3 13 36 123 89 89 109 109 89 36 36 29 62 29 60 60 
148 71 154 63 127 61 25 78 25 71 127 122 78 10 10 5 125 113 125 150 123 123 119 123 15...

result:

ok 

Test #63:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 4 4 5 5 5 5 5 5 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

result:

ok 

Test #64:

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

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

1326 595 1986 967 
19 173 2187 880 
843 961 1179 1645 
1225 177 1102 1566 
961 354 1065 1553 
1814 625 611 1276 
572 1110 1097 845 
780 2178 1291 2041 
1138 1531 415 2390 
499 1649 1131 584 
752 754 1982 1296 
2295 498 1853 1627 
1628 1647 974 1282 
2097 265 1271 2321 
1161 2252 1776 123 
439 723 48...

result:

ok 

Test #65:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

1 2 
2 2 
2 1 
2 2 
2 1 
1 1 
1 2 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
1 2 
2 1 
2 2 
1 1 
2 2 
1 1 
1 2 
2 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 1 
2 2 
1 2 
2 2 
1 1 
2 1 
1 2 
2 1 
1 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
2 2 
2 1 
...

result:

ok 

Test #66:

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

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
2674 1208 
4977 2674 
2674 3028 
36 2674 
2674 1712 
2674 3561 
3033 2674 
4699 2674 
2674 1785 
2674 4345 
3302 2674 
2493 2674 
2674 4280 
3999 2674 
2674 4850 
4508 2674 
2674 3742 
2674 2718 
3461 2674 
260 2674 
2674 4223 
2674 2069 
1144 2674 
2674 1975 
527 2674 
3260 2674 
2674 28...

result:

ok 

Test #67:

score: 0
Accepted
time: 13ms
memory: 27688kb

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 793 317 417 
507 1990 1237 1460 
1155 1114 1030 1744 
1284 868 2376 486 
704 665 1441 2391 
173 789 1607 1283 
1045 1309 1466 2192 
254 284 766 734 
1181 1752 937 1814 
1459 1329 2346 1638 
443 1744 1155 1205 
1050 1098 430 1096 
186 930 2224 1622 
1833 2196 1916 1772 
114 739 757 2066 
277 786 ...

result:

ok 

Test #68:

score: 0
Accepted
time: 14ms
memory: 28476kb

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

788 926 833 795 67 830 580 861 
823 227 768 566 701 421 582 113 
868 745 981 644 76 910 494 188 
572 771 409 875 742 210 751 665 
131 3 455 151 442 298 145 387 
550 118 85 672 74 694 78 250 
855 977 857 695 944 533 807 431 
787 649 881 432 523 789 615 742 
29 159 114 942 894 619 538 42 
834 355 614 ...

result:

ok 

Test #69:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

131 161 981 1246 969 598 761 374 
119 163 257 658 674 749 826 837 
207 564 1166 802 929 863 733 891 
233 77 202 964 400 314 507 311 
71 376 388 408 445 1247 709 1093 
48 19 403 1020 566 581 468 966 
132 785 946 1201 479 703 822 730 
18 37 183 188 1202 349 731 861 
333 648 126 1226 896 614 882 523 
1...

result:

ok 

Subtask #6:

score: 5
Accepted

Dependency #5:

100%
Accepted

Test #70:

score: 5
Accepted
time: 3ms
memory: 25940kb

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 2 3 3 
2 3 2 2 

result:

ok 

Test #71:

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

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

475 1156 2334 540 
2439 2421 750 1328 
1792 471 1051 2007 
705 2269 786 1776 
1622 755 1277 1674 
590 603 1378 1217 
239 1920 967 1658 
2307 78 1589 857 
861 1634 2322 2172 
2077 2021 1381 2179 
1547 1126 345 2126 
1214 412 1477 994 
1857 2085 978 831 
281 2406 1844 2174 
521 2334 2254 1779 
1508 28...

result:

ok 

Test #72:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

1 3 2 2 
1429 1 1429 1 
3 7 4 4 
1430 1430 3 3 
5 6 1 6 
1431 1431 5 5 
7 11 8 8 
1432 1432 7 7 
9 5 10 10 
1433 9 1433 9 
11 15 12 12 
1434 1434 11 11 
13 14 9 14 
1435 1435 13 13 
15 19 16 16 
1436 1436 15 15 
17 13 18 18 
1437 17 1437 17 
19 23 20 20 
1438 1438 19 19 
21 22 17 22 
1439 1439 21 21...

result:

ok 

Test #73:

score: 0
Accepted
time: 15ms
memory: 29008kb

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #74:

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

input:

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

output:

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

result:

ok 

Test #75:

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

input:

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

output:

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

result:

ok 

Test #76:

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

input:

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

output:

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

result:

ok 

Test #77:

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

input:

2500 4 2500
648 780 1555 2479
544 2007 2025 186
2208 783 346 2150
462 975 240 1243
1693 1777 2390 522
1126 1859 505 1731
991 684 1608 751
1605 129 1236 1271
121 1073 2079 409
882 1636 2432 2416
2125 1519 1046 79
315 1906 679 2452
86 669 2191 1467
326 397 286 1986
1299 2409 2259 2166
854 1437 620 330...

output:

648 1555 780 2479 
186 2007 2025 544 
783 346 2208 2150 
240 1243 975 462 
2390 1693 522 1777 
1731 1859 1126 505 
684 751 991 1608 
1605 129 1236 1271 
409 121 1073 2079 
882 2432 1636 2416 
2125 79 1046 1519 
1906 2452 679 315 
86 669 1467 2191 
397 286 326 1986 
1299 2409 2166 2259 
330 854 620 1...

result:

ok 

Test #78:

score: 0
Accepted
time: 19ms
memory: 28600kb

input:

1250 8 1250
1143 47 853 56 15 316 165 820
768 1167 447 1006 696 621 491 431
301 1068 674 1050 1107 235 256 499
702 264 364 1158 959 489 450 966
972 83 910 399 944 744 202 196
433 893 553 1010 13 847 917 296
199 788 380 1018 442 1066 1064 1059
1206 686 399 975 298 730 439 781
964 398 283 449 241 788 ...

output:

15 56 47 316 165 1143 853 820 
768 431 1167 696 621 1006 447 491 
1107 301 499 1068 235 674 1050 256 
959 702 450 264 966 489 364 1158 
944 202 972 196 399 83 744 910 
553 296 433 1010 893 847 917 13 
442 199 380 1064 1059 1066 788 1018 
439 298 399 1206 686 975 730 781 
788 964 398 449 337 788 283 ...

result:

ok 

Test #79:

score: 0
Accepted
time: 20ms
memory: 28220kb

input:

2500 4 2500
11 34 1064 1548
2120 1668 2 1223
1208 390 12 1204
482 830 1427 2204
312 1940 1551 1432
2282 1122 2271 1334
1702 344 623 224
258 20 288 1335
262 308 1502 992
474 345 2403 2254
1466 930 1281 1642
2151 434 786 1345
64 464 2265 51
2054 274 435 2007
171 867 395 544
1766 358 872 1478
345 474 2...

output:

1548 11 1064 34 
1668 2120 1223 2 
1204 12 390 1208 
830 482 2204 1427 
312 1940 1432 1551 
2271 2282 1122 1334 
344 224 1702 623 
288 258 20 1335 
308 262 1502 992 
345 2403 2254 474 
1642 930 1466 1281 
2151 786 1345 434 
464 2265 51 64 
435 2054 2007 274 
867 171 395 544 
1766 358 1478 872 
2403 ...

result:

ok 

Test #80:

score: 0
Accepted
time: 14ms
memory: 28068kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

66 132 102 72 83 154 151 140 155 5 145 155 7 14 145 9 116 26 114 12 4 128 102 119 19 125 123 123 19 19 125 125 57 80 104 55 33 122 101 122 93 92 97 97 86 76 62 95 3 13 36 123 89 89 109 109 89 36 36 29 62 29 60 60 
148 71 154 63 127 61 25 78 25 71 127 122 78 10 10 5 125 113 125 150 123 123 119 123 15...

result:

ok 

Test #81:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 4 4 5 5 5 5 5 5 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

result:

ok 

Test #82:

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

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

1326 595 1986 967 
19 173 2187 880 
843 961 1179 1645 
1225 177 1102 1566 
961 354 1065 1553 
1814 625 611 1276 
572 1110 1097 845 
780 2178 1291 2041 
1138 1531 415 2390 
499 1649 1131 584 
752 754 1982 1296 
2295 498 1853 1627 
1628 1647 974 1282 
2097 265 1271 2321 
1161 2252 1776 123 
439 723 48...

result:

ok 

Test #83:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

1 2 
2 2 
2 1 
2 2 
2 1 
1 1 
1 2 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
1 2 
2 1 
2 2 
1 1 
2 2 
1 1 
1 2 
2 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 1 
2 2 
1 2 
2 2 
1 1 
2 1 
1 2 
2 1 
1 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
2 2 
2 1 
...

result:

ok 

Test #84:

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

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
2674 1208 
4977 2674 
2674 3028 
36 2674 
2674 1712 
2674 3561 
3033 2674 
4699 2674 
2674 1785 
2674 4345 
3302 2674 
2493 2674 
2674 4280 
3999 2674 
2674 4850 
4508 2674 
2674 3742 
2674 2718 
3461 2674 
260 2674 
2674 4223 
2674 2069 
1144 2674 
2674 1975 
527 2674 
3260 2674 
2674 28...

result:

ok 

Test #85:

score: 0
Accepted
time: 17ms
memory: 28052kb

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 793 317 417 
507 1990 1237 1460 
1155 1114 1030 1744 
1284 868 2376 486 
704 665 1441 2391 
173 789 1607 1283 
1045 1309 1466 2192 
254 284 766 734 
1181 1752 937 1814 
1459 1329 2346 1638 
443 1744 1155 1205 
1050 1098 430 1096 
186 930 2224 1622 
1833 2196 1916 1772 
114 739 757 2066 
277 786 ...

result:

ok 

Test #86:

score: 0
Accepted
time: 13ms
memory: 28896kb

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

788 926 833 795 67 830 580 861 
823 227 768 566 701 421 582 113 
868 745 981 644 76 910 494 188 
572 771 409 875 742 210 751 665 
131 3 455 151 442 298 145 387 
550 118 85 672 74 694 78 250 
855 977 857 695 944 533 807 431 
787 649 881 432 523 789 615 742 
29 159 114 942 894 619 538 42 
834 355 614 ...

result:

ok 

Test #87:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

131 161 981 1246 969 598 761 374 
119 163 257 658 674 749 826 837 
207 564 1166 802 929 863 733 891 
233 77 202 964 400 314 507 311 
71 376 388 408 445 1247 709 1093 
48 19 403 1020 566 581 468 966 
132 785 946 1201 479 703 822 730 
18 37 183 188 1202 349 731 861 
333 648 126 1226 896 614 882 523 
1...

result:

ok 

Subtask #7:

score: 5
Accepted

Dependency #6:

100%
Accepted

Test #88:

score: 5
Accepted
time: 6ms
memory: 27612kb

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 2 3 3 
2 3 2 2 

result:

ok 

Test #89:

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

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

475 1156 2334 540 
2439 2421 750 1328 
1792 471 1051 2007 
705 2269 786 1776 
1622 755 1277 1674 
590 603 1378 1217 
239 1920 967 1658 
2307 78 1589 857 
861 1634 2322 2172 
2077 2021 1381 2179 
1547 1126 345 2126 
1214 412 1477 994 
1857 2085 978 831 
281 2406 1844 2174 
521 2334 2254 1779 
1508 28...

result:

ok 

Test #90:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

1 3 2 2 
1429 1 1429 1 
3 7 4 4 
1430 1430 3 3 
5 6 1 6 
1431 1431 5 5 
7 11 8 8 
1432 1432 7 7 
9 5 10 10 
1433 9 1433 9 
11 15 12 12 
1434 1434 11 11 
13 14 9 14 
1435 1435 13 13 
15 19 16 16 
1436 1436 15 15 
17 13 18 18 
1437 17 1437 17 
19 23 20 20 
1438 1438 19 19 
21 22 17 22 
1439 1439 21 21...

result:

ok 

Test #91:

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

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #92:

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

input:

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

output:

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

result:

ok 

Test #93:

score: 0
Accepted
time: 10ms
memory: 29576kb

input:

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

output:

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

result:

ok 

Test #94:

score: 0
Accepted
time: 17ms
memory: 26588kb

input:

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

output:

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

result:

ok 

Test #95:

score: 0
Accepted
time: 14ms
memory: 28804kb

input:

2500 4 2500
648 780 1555 2479
544 2007 2025 186
2208 783 346 2150
462 975 240 1243
1693 1777 2390 522
1126 1859 505 1731
991 684 1608 751
1605 129 1236 1271
121 1073 2079 409
882 1636 2432 2416
2125 1519 1046 79
315 1906 679 2452
86 669 2191 1467
326 397 286 1986
1299 2409 2259 2166
854 1437 620 330...

output:

648 1555 780 2479 
186 2007 2025 544 
783 346 2208 2150 
240 1243 975 462 
2390 1693 522 1777 
1731 1859 1126 505 
684 751 991 1608 
1605 129 1236 1271 
409 121 1073 2079 
882 2432 1636 2416 
2125 79 1046 1519 
1906 2452 679 315 
86 669 1467 2191 
397 286 326 1986 
1299 2409 2166 2259 
330 854 620 1...

result:

ok 

Test #96:

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

input:

1250 8 1250
1143 47 853 56 15 316 165 820
768 1167 447 1006 696 621 491 431
301 1068 674 1050 1107 235 256 499
702 264 364 1158 959 489 450 966
972 83 910 399 944 744 202 196
433 893 553 1010 13 847 917 296
199 788 380 1018 442 1066 1064 1059
1206 686 399 975 298 730 439 781
964 398 283 449 241 788 ...

output:

15 56 47 316 165 1143 853 820 
768 431 1167 696 621 1006 447 491 
1107 301 499 1068 235 674 1050 256 
959 702 450 264 966 489 364 1158 
944 202 972 196 399 83 744 910 
553 296 433 1010 893 847 917 13 
442 199 380 1064 1059 1066 788 1018 
439 298 399 1206 686 975 730 781 
788 964 398 449 337 788 283 ...

result:

ok 

Test #97:

score: 0
Accepted
time: 18ms
memory: 36020kb

input:

2500 4 2500
11 34 1064 1548
2120 1668 2 1223
1208 390 12 1204
482 830 1427 2204
312 1940 1551 1432
2282 1122 2271 1334
1702 344 623 224
258 20 288 1335
262 308 1502 992
474 345 2403 2254
1466 930 1281 1642
2151 434 786 1345
64 464 2265 51
2054 274 435 2007
171 867 395 544
1766 358 872 1478
345 474 2...

output:

1548 11 1064 34 
1668 2120 1223 2 
1204 12 390 1208 
830 482 2204 1427 
312 1940 1432 1551 
2271 2282 1122 1334 
344 224 1702 623 
288 258 20 1335 
308 262 1502 992 
345 2403 2254 474 
1642 930 1466 1281 
2151 786 1345 434 
464 2265 51 64 
435 2054 2007 274 
867 171 395 544 
1766 358 1478 872 
2403 ...

result:

ok 

Test #98:

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

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
2 3 
3 2 

result:

ok 

Test #99:

score: 0
Accepted
time: 14ms
memory: 27440kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

66 132 102 72 83 154 151 140 155 5 145 155 7 14 145 9 116 26 114 12 4 128 102 119 19 125 123 123 19 19 125 125 57 80 104 55 33 122 101 122 93 92 97 97 86 76 62 95 3 13 36 123 89 89 109 109 89 36 36 29 62 29 60 60 
148 71 154 63 127 61 25 78 25 71 127 122 78 10 10 5 125 113 125 150 123 123 119 123 15...

result:

ok 

Test #100:

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

input:

20 2 20
18 2
12 5
20 9
4 2
17 4
7 15
9 2
5 5
13 15
19 5
3 5
10 19
8 5
7 10
9 11
3 16
7 18
9 5
3 8
18 4

output:

2 18 
5 12 
20 9 
2 4 
17 4 
15 7 
9 2 
5 5 
13 15 
19 5 
5 3 
10 19 
5 8 
7 10 
11 9 
3 16 
18 7 
9 5 
8 3 
4 18 

result:

ok 

Test #101:

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

input:

20 2 12
12 11
1 9
12 12
3 4
3 9
8 3
8 11
10 9
4 3
6 7
11 6
11 3
7 10
12 10
11 10
11 11
11 2
1 12
6 12
2 7

output:

12 11 
9 1 
12 12 
4 3 
3 9 
8 3 
11 8 
9 10 
3 4 
6 7 
6 11 
11 3 
10 7 
10 12 
11 10 
11 11 
2 11 
1 12 
12 6 
7 2 

result:

ok 

Test #102:

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

input:

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

output:

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

result:

ok 

Test #103:

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

input:

12 2 20
13 1
4 14
14 13
17 1
8 15
14 5
3 7
20 6
1 9
19 11
6 20
11 13

output:

13 1 
14 4 
14 13 
17 1 
8 15 
5 14 
3 7 
6 20 
1 9 
11 19 
20 6 
13 11 

result:

ok 

Test #104:

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

input:

20 2 19
2 15
16 8
1 11
15 18
7 17
19 7
14 2
3 10
12 5
14 10
8 5
17 11
16 11
3 13
12 9
4 17
1 6
6 4
13 19
18 5

output:

2 15 
8 16 
1 11 
15 18 
17 7 
7 19 
14 2 
3 10 
12 5 
10 14 
5 8 
11 17 
16 11 
13 3 
9 12 
17 4 
6 1 
4 6 
19 13 
18 5 

result:

ok 

Test #105:

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

input:

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

output:

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

result:

ok 

Test #106:

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

input:

78 128 100000
81808 77744 77980 20344 56544 50739 70835 39983 68165 34656 3072 42835 82535 82728 67410 26960 83125 8567 68716 87268 1041 55994 57260 55232 2311 39201 31839 52222 97649 77452 99484 9817 25951 19307 89403 41701 29144 21015 97490 47889 80786 38025 80518 41671 15279 15331 14598 14750 388...

output:

6989 95586 97490 97649 99484 91324 96115 96750 99906 81808 95228 91469 82317 82728 67126 67410 92918 87268 93636 68716 89129 68165 59653 87723 82850 51794 52222 83125 55232 61419 89273 89403 75728 89666 8223 77452 77705 90218 14750 20263 52468 22413 80518 29144 30001 82535 72929 73464 9817 61232 723...

result:

ok 

Test #107:

score: 0
Accepted
time: 10ms
memory: 29508kb

input:

4 2048 95000
38783 19709 71675 15481 45011 21868 31035 86793 51119 32657 89325 16883 19411 82169 55236 12196 70200 53239 39110 1874 74802 92295 14936 39296 33336 21076 44167 41683 70853 46547 4147 92052 23634 43406 21048 62597 37396 48811 32118 56333 72463 15734 84750 74354 93564 26993 34448 9656 49...

output:

69689 69705 69712 69753 69757 69810 69896 69933 69958 70007 70008 70036 70106 70162 70200 70225 70357 70367 70448 70504 70560 70654 70673 70675 70772 70809 70829 70836 70853 70973 71081 71126 71231 71239 71240 71242 71268 71315 71360 71365 71493 71523 71548 71562 71574 71675 71722 71738 71765 71801 ...

result:

ok 

Test #108:

score: 0
Accepted
time: 13ms
memory: 35788kb

input:

1250 8 8000
1142 5185 4039 4187 6143 3133 1453 6322
2826 1179 6307 4164 4163 1381 6393 5987
165 7650 2235 6199 1828 7154 1702 6555
1924 5298 6688 3890 2158 6145 6260 1593
6582 7121 595 566 1943 1749 498 4850
1658 2980 77 1807 19 5771 1887 1851
6975 6093 5956 6901 7876 3172 4955 7840
6805 5280 991 89...

output:

6143 6322 4187 1453 3133 4039 5185 1142 
6307 5987 1179 6393 1381 4164 4163 2826 
6555 6199 2235 1702 7154 7650 1828 165 
3890 5298 1593 6145 1924 6260 6688 2158 
1749 595 7121 6582 4850 566 498 1943 
1851 2980 5771 19 1887 1658 77 1807 
7840 6901 7876 3172 4955 5956 6975 6093 
892 991 7036 6805 528...

result:

ok 

Test #109:

score: 0
Accepted
time: 18ms
memory: 37840kb

input:

1250 8 100000
33559 35032 86872 2746 93799 19407 3978 35031
45242 19554 51244 7095 76508 73954 58274 17339
33768 22747 28465 45940 68882 8649 47192 74009
85827 61438 15635 42263 10935 25322 70609 29138
89239 2604 35343 91233 24911 24596 24352 4723
61239 30122 86493 3193 95509 53433 14784 66391
97818...

output:

93799 86872 3978 35032 33559 2746 35031 19407 
7095 73954 58274 19554 51244 76508 17339 45242 
33768 47192 28465 74009 8649 22747 68882 45940 
42263 70609 61438 85827 29138 10935 25322 15635 
91233 4723 2604 89239 24352 35343 24596 24911 
86493 61239 95509 3193 30122 53433 14784 66391 
88901 51969 6...

result:

ok 

Test #110:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 4 4 5 5 5 5 5 5 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

result:

ok 

Test #111:

score: 0
Accepted
time: 13ms
memory: 28988kb

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

1326 595 1986 967 
19 173 2187 880 
843 961 1179 1645 
1225 177 1102 1566 
961 354 1065 1553 
1814 625 611 1276 
572 1110 1097 845 
780 2178 1291 2041 
1138 1531 415 2390 
499 1649 1131 584 
752 754 1982 1296 
2295 498 1853 1627 
1628 1647 974 1282 
2097 265 1271 2321 
1161 2252 1776 123 
439 723 48...

result:

ok 

Test #112:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

1 2 
2 2 
2 1 
2 2 
2 1 
1 1 
1 2 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
1 2 
2 1 
2 2 
1 1 
2 2 
1 1 
1 2 
2 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 1 
2 2 
1 2 
2 2 
1 1 
2 1 
1 2 
2 1 
1 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
2 2 
2 1 
...

result:

ok 

Test #113:

score: 0
Accepted
time: 14ms
memory: 29300kb

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
2674 1208 
4977 2674 
2674 3028 
36 2674 
2674 1712 
2674 3561 
3033 2674 
4699 2674 
2674 1785 
2674 4345 
3302 2674 
2493 2674 
2674 4280 
3999 2674 
2674 4850 
4508 2674 
2674 3742 
2674 2718 
3461 2674 
260 2674 
2674 4223 
2674 2069 
1144 2674 
2674 1975 
527 2674 
3260 2674 
2674 28...

result:

ok 

Test #114:

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

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 793 317 417 
507 1990 1237 1460 
1155 1114 1030 1744 
1284 868 2376 486 
704 665 1441 2391 
173 789 1607 1283 
1045 1309 1466 2192 
254 284 766 734 
1181 1752 937 1814 
1459 1329 2346 1638 
443 1744 1155 1205 
1050 1098 430 1096 
186 930 2224 1622 
1833 2196 1916 1772 
114 739 757 2066 
277 786 ...

result:

ok 

Test #115:

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

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

788 926 833 795 67 830 580 861 
823 227 768 566 701 421 582 113 
868 745 981 644 76 910 494 188 
572 771 409 875 742 210 751 665 
131 3 455 151 442 298 145 387 
550 118 85 672 74 694 78 250 
855 977 857 695 944 533 807 431 
787 649 881 432 523 789 615 742 
29 159 114 942 894 619 538 42 
834 355 614 ...

result:

ok 

Test #116:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

131 161 981 1246 969 598 761 374 
119 163 257 658 674 749 826 837 
207 564 1166 802 929 863 733 891 
233 77 202 964 400 314 507 311 
71 376 388 408 445 1247 709 1093 
48 19 403 1020 566 581 468 966 
132 785 946 1201 479 703 822 730 
18 37 183 188 1202 349 731 861 
333 648 126 1226 896 614 882 523 
1...

result:

ok 

Subtask #8:

score: 0
Time Limit Exceeded

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Test #117:

score: 20
Accepted
time: 1716ms
memory: 108112kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
53683 63612 
70370 78264 
42647 76881 
31741 39251 
66491 61186 
57686 65819 
59145 53278 
26052 71962 
81040 55279 
50859 51310 
24546 46800 
85013 91165 
61530 21890 
29099 84003 
86182 33573 
49212 10639 
91851 97312 
57682 14067 
5243 69674 
62508 99007 
26...

result:

ok 

Test #118:

score: 0
Accepted
time: 62ms
memory: 108060kb

input:

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

output:

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

result:

ok 

Test #119:

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

input:

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

output:

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

result:

ok 

Test #120:

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

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 2 3 3 
2 3 2 2 

result:

ok 

Test #121:

score: 0
Accepted
time: 13ms
memory: 27668kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

66 132 102 72 83 154 151 140 155 5 145 155 7 14 145 9 116 26 114 12 4 128 102 119 19 125 123 123 19 19 125 125 57 80 104 55 33 122 101 122 93 92 97 97 86 76 62 95 3 13 36 123 89 89 109 109 89 36 36 29 62 29 60 60 
148 71 154 63 127 61 25 78 25 71 127 122 78 10 10 5 125 113 125 150 123 123 119 123 15...

result:

ok 

Test #122:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 4 4 5 5 5 5 5 5 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

result:

ok 

Test #123:

score: 0
Accepted
time: 13ms
memory: 27396kb

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

1326 595 1986 967 
19 173 2187 880 
843 961 1179 1645 
1225 177 1102 1566 
961 354 1065 1553 
1814 625 611 1276 
572 1110 1097 845 
780 2178 1291 2041 
1138 1531 415 2390 
499 1649 1131 584 
752 754 1982 1296 
2295 498 1853 1627 
1628 1647 974 1282 
2097 265 1271 2321 
1161 2252 1776 123 
439 723 48...

result:

ok 

Test #124:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

1 2 
2 2 
2 1 
2 2 
2 1 
1 1 
1 2 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
1 2 
2 1 
2 2 
1 1 
2 2 
1 1 
1 2 
2 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 1 
2 2 
1 2 
2 2 
1 1 
2 1 
1 2 
2 1 
1 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
2 2 
2 1 
...

result:

ok 

Test #125:

score: 0
Accepted
time: 14ms
memory: 28856kb

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
2674 1208 
4977 2674 
2674 3028 
36 2674 
2674 1712 
2674 3561 
3033 2674 
4699 2674 
2674 1785 
2674 4345 
3302 2674 
2493 2674 
2674 4280 
3999 2674 
2674 4850 
4508 2674 
2674 3742 
2674 2718 
3461 2674 
260 2674 
2674 4223 
2674 2069 
1144 2674 
2674 1975 
527 2674 
3260 2674 
2674 28...

result:

ok 

Test #126:

score: 0
Accepted
time: 10ms
memory: 28940kb

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 793 317 417 
507 1990 1237 1460 
1155 1114 1030 1744 
1284 868 2376 486 
704 665 1441 2391 
173 789 1607 1283 
1045 1309 1466 2192 
254 284 766 734 
1181 1752 937 1814 
1459 1329 2346 1638 
443 1744 1155 1205 
1050 1098 430 1096 
186 930 2224 1622 
1833 2196 1916 1772 
114 739 757 2066 
277 786 ...

result:

ok 

Test #127:

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

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

788 926 833 795 67 830 580 861 
823 227 768 566 701 421 582 113 
868 745 981 644 76 910 494 188 
572 771 409 875 742 210 751 665 
131 3 455 151 442 298 145 387 
550 118 85 672 74 694 78 250 
855 977 857 695 944 533 807 431 
787 649 881 432 523 789 615 742 
29 159 114 942 894 619 538 42 
834 355 614 ...

result:

ok 

Test #128:

score: 0
Accepted
time: 1644ms
memory: 107484kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

27085 59126 
75021 23663 
67175 78883 
3919 90698 
20718 67504 
49374 44011 
3236 1660 
71971 79270 
24502 90540 
54202 9732 
14395 88659 
52635 56600 
17986 21912 
92420 56526 
3472 40254 
20431 64330 
56003 9381 
57750 45529 
45230 9388 
83797 53437 
47526 75562 
63126 45219 
71020 87437 
50298 20...

result:

ok 

Test #129:

score: 0
Accepted
time: 15ms
memory: 28920kb

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

131 161 981 1246 969 598 761 374 
119 163 257 658 674 749 826 837 
207 564 1166 802 929 863 733 891 
233 77 202 964 400 314 507 311 
71 376 388 408 445 1247 709 1093 
48 19 403 1020 566 581 468 966 
132 785 946 1201 479 703 822 730 
18 37 183 188 1202 349 731 861 
333 648 126 1226 896 614 882 523 
1...

result:

ok 

Test #130:

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

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

475 1156 2334 540 
2439 2421 750 1328 
1792 471 1051 2007 
705 2269 786 1776 
1622 755 1277 1674 
590 603 1378 1217 
239 1920 967 1658 
2307 78 1589 857 
861 1634 2322 2172 
2077 2021 1381 2179 
1547 1126 345 2126 
1214 412 1477 994 
1857 2085 978 831 
281 2406 1844 2174 
521 2334 2254 1779 
1508 28...

result:

ok 

Test #131:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

1 3 2 2 
1429 1 1429 1 
3 7 4 4 
1430 1430 3 3 
5 6 1 6 
1431 1431 5 5 
7 11 8 8 
1432 1432 7 7 
9 5 10 10 
1433 9 1433 9 
11 15 12 12 
1434 1434 11 11 
13 14 9 14 
1435 1435 13 13 
15 19 16 16 
1436 1436 15 15 
17 13 18 18 
1437 17 1437 17 
19 23 20 20 
1438 1438 19 19 
21 22 17 22 
1439 1439 21 21...

result:

ok 

Test #132:

score: 0
Accepted
time: 15ms
memory: 28556kb

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #133:

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

input:

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

output:

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

result:

ok 

Test #134:

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

input:

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

output:

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

result:

ok 

Test #135:

score: -20
Time Limit Exceeded

input:

62400 8 62400
617 61873 50005 41067 20321 15682 32071 28672
22133 8305 52336 45992 33172 47471 17329 39927
42134 45570 15289 42551 55858 19194 10715 10649
8176 5735 13244 20965 61861 7073 12818 5527
21000 8783 29108 17636 58752 9701 42134 11867
35793 5665 25545 53912 41719 7606 30422 4734
6540 43594...

output:


result:


Subtask #9:

score: 0
Time Limit Exceeded

Dependency #3:

100%
Accepted

Dependency #6:

100%
Accepted

Test #163:

score: 10
Accepted
time: 1715ms
memory: 109384kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
53683 63612 
70370 78264 
42647 76881 
31741 39251 
66491 61186 
57686 65819 
59145 53278 
26052 71962 
81040 55279 
50859 51310 
24546 46800 
85013 91165 
61530 21890 
29099 84003 
86182 33573 
49212 10639 
91851 97312 
57682 14067 
5243 69674 
62508 99007 
26...

result:

ok 

Test #164:

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

input:

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

output:

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

result:

ok 

Test #165:

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

input:

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

output:

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

result:

ok 

Test #166:

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

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 2 3 3 
2 3 2 2 

result:

ok 

Test #167:

score: 0
Accepted
time: 10ms
memory: 28512kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

66 132 102 72 83 154 151 140 155 5 145 155 7 14 145 9 116 26 114 12 4 128 102 119 19 125 123 123 19 19 125 125 57 80 104 55 33 122 101 122 93 92 97 97 86 76 62 95 3 13 36 123 89 89 109 109 89 36 36 29 62 29 60 60 
148 71 154 63 127 61 25 78 25 71 127 122 78 10 10 5 125 113 125 150 123 123 119 123 15...

result:

ok 

Test #168:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 4 4 5 5 5 5 5 5 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

result:

ok 

Test #169:

score: 0
Accepted
time: 13ms
memory: 29060kb

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

1326 595 1986 967 
19 173 2187 880 
843 961 1179 1645 
1225 177 1102 1566 
961 354 1065 1553 
1814 625 611 1276 
572 1110 1097 845 
780 2178 1291 2041 
1138 1531 415 2390 
499 1649 1131 584 
752 754 1982 1296 
2295 498 1853 1627 
1628 1647 974 1282 
2097 265 1271 2321 
1161 2252 1776 123 
439 723 48...

result:

ok 

Test #170:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

1 2 
2 2 
2 1 
2 2 
2 1 
1 1 
1 2 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
1 2 
2 1 
2 2 
1 1 
2 2 
1 1 
1 2 
2 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 1 
2 2 
1 2 
2 2 
1 1 
2 1 
1 2 
2 1 
1 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
2 2 
2 1 
...

result:

ok 

Test #171:

score: 0
Accepted
time: 13ms
memory: 28644kb

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
2674 1208 
4977 2674 
2674 3028 
36 2674 
2674 1712 
2674 3561 
3033 2674 
4699 2674 
2674 1785 
2674 4345 
3302 2674 
2493 2674 
2674 4280 
3999 2674 
2674 4850 
4508 2674 
2674 3742 
2674 2718 
3461 2674 
260 2674 
2674 4223 
2674 2069 
1144 2674 
2674 1975 
527 2674 
3260 2674 
2674 28...

result:

ok 

Test #172:

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

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 793 317 417 
507 1990 1237 1460 
1155 1114 1030 1744 
1284 868 2376 486 
704 665 1441 2391 
173 789 1607 1283 
1045 1309 1466 2192 
254 284 766 734 
1181 1752 937 1814 
1459 1329 2346 1638 
443 1744 1155 1205 
1050 1098 430 1096 
186 930 2224 1622 
1833 2196 1916 1772 
114 739 757 2066 
277 786 ...

result:

ok 

Test #173:

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

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

788 926 833 795 67 830 580 861 
823 227 768 566 701 421 582 113 
868 745 981 644 76 910 494 188 
572 771 409 875 742 210 751 665 
131 3 455 151 442 298 145 387 
550 118 85 672 74 694 78 250 
855 977 857 695 944 533 807 431 
787 649 881 432 523 789 615 742 
29 159 114 942 894 619 538 42 
834 355 614 ...

result:

ok 

Test #174:

score: 0
Accepted
time: 1633ms
memory: 106760kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

27085 59126 
75021 23663 
67175 78883 
3919 90698 
20718 67504 
49374 44011 
3236 1660 
71971 79270 
24502 90540 
54202 9732 
14395 88659 
52635 56600 
17986 21912 
92420 56526 
3472 40254 
20431 64330 
56003 9381 
57750 45529 
45230 9388 
83797 53437 
47526 75562 
63126 45219 
71020 87437 
50298 20...

result:

ok 

Test #175:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

131 161 981 1246 969 598 761 374 
119 163 257 658 674 749 826 837 
207 564 1166 802 929 863 733 891 
233 77 202 964 400 314 507 311 
71 376 388 408 445 1247 709 1093 
48 19 403 1020 566 581 468 966 
132 785 946 1201 479 703 822 730 
18 37 183 188 1202 349 731 861 
333 648 126 1226 896 614 882 523 
1...

result:

ok 

Test #176:

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

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

475 1156 2334 540 
2439 2421 750 1328 
1792 471 1051 2007 
705 2269 786 1776 
1622 755 1277 1674 
590 603 1378 1217 
239 1920 967 1658 
2307 78 1589 857 
861 1634 2322 2172 
2077 2021 1381 2179 
1547 1126 345 2126 
1214 412 1477 994 
1857 2085 978 831 
281 2406 1844 2174 
521 2334 2254 1779 
1508 28...

result:

ok 

Test #177:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

1 3 2 2 
1429 1 1429 1 
3 7 4 4 
1430 1430 3 3 
5 6 1 6 
1431 1431 5 5 
7 11 8 8 
1432 1432 7 7 
9 5 10 10 
1433 9 1433 9 
11 15 12 12 
1434 1434 11 11 
13 14 9 14 
1435 1435 13 13 
15 19 16 16 
1436 1436 15 15 
17 13 18 18 
1437 17 1437 17 
19 23 20 20 
1438 1438 19 19 
21 22 17 22 
1439 1439 21 21...

result:

ok 

Test #178:

score: 0
Accepted
time: 15ms
memory: 28672kb

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #179:

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

input:

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

output:

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

result:

ok 

Test #180:

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

input:

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

output:

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

result:

ok 

Test #181:

score: -10
Time Limit Exceeded

input:

62400 8 62400
617 61873 50005 41067 20321 15682 32071 28672
22133 8305 52336 45992 33172 47471 17329 39927
42134 45570 15289 42551 55858 19194 10715 10649
8176 5735 13244 20965 61861 7073 12818 5527
21000 8783 29108 17636 58752 9701 42134 11867
35793 5665 25545 53912 41719 7606 30422 4734
6540 43594...

output:


result:


Subtask #10:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

0%