QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#571377#7278. Brought Down the Grading Server?qiuzx100 ✓712ms62900kbC++202.6kb2024-09-17 22:26:532024-09-17 22:26:56

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 4ms
memory: 12088kb

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
2 3 
3 2 

result:

ok 

Test #2:

score: 10
Accepted
time: 4ms
memory: 14060kb

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 
12 5 
9 20 
4 2 
17 4 
7 15 
2 9 
5 5 
15 13 
5 19 
5 3 
19 10 
5 8 
10 7 
11 9 
3 16 
18 7 
9 5 
8 3 
18 4 

result:

ok 

Test #3:

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

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:

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

result:

ok 

Test #4:

score: 10
Accepted
time: 4ms
memory: 16152kb

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 
7 8 
6 4 
4 7 
2 6 
6 4 
1 3 
3 2 
8 3 
6 7 
1 5 
3 6 
5 2 
4 1 
2 2 
2 6 
6 3 
5 2 
3 5 
3 3 

result:

ok 

Test #5:

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

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:

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

result:

ok 

Test #6:

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

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 
5 12 
10 14 
5 8 
11 17 
16 11 
13 3 
12 9 
17 4 
6 1 
4 6 
19 13 
18 5 

result:

ok 

Test #7:

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

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 
5 8 
3 5 
1 4 
10 9 
17 7 
4 2 
14 10 
6 16 
2 1 
16 11 
8 3 
15 13 
18 17 
11 6 

result:

ok 

Subtask #2:

score: 15
Accepted

Test #8:

score: 15
Accepted
time: 92ms
memory: 40072kb

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:

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

result:

ok 

Test #9:

score: 15
Accepted
time: 52ms
memory: 40064kb

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: 15
Accepted
time: 47ms
memory: 40044kb

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: 15
Accepted
time: 74ms
memory: 37016kb

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:

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

result:

ok 

Test #12:

score: 15
Accepted
time: 67ms
memory: 35240kb

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:

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

result:

ok 

Test #13:

score: 15
Accepted
time: 43ms
memory: 35132kb

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 
1 3 
7 6 
10 5 
4 6 
9 9 
8 4 
9 2 
6 1 
7 10 
10 1 
9 7 
6 9 
6 9 
3 10 
10 10 
2 6 
7 7 
5 6 
8 3 
4 4 
2 5 
5 8 
8 2 
10 9 
3 8 
4 7 
2 2 
9 8 
8 10 
8 9 
1 2 
1 5 
4 7 
9 4 
6 9 
10 8 
2 4 
3 6 
4 1 
10 2 
5 3 
7 10 
1 7 
10 4 
6 6 
4 1 
8...

result:

ok 

Test #14:

score: 15
Accepted
time: 91ms
memory: 37020kb

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:

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

result:

ok 

Test #15:

score: 15
Accepted
time: 83ms
memory: 38320kb

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 
63660 79073 
41795 20397 
84311 1296 
3690 21178 
21052 31611 
51423 14323 
34208 82468 
2785 83835 
50594 28274 
10993 59957 
34259 64334 
73934 89407 
61083 14947 
53201 89472 
33351 61243 
76632 58718 
67464 85318 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
85776 ...

result:

ok 

Test #16:

score: 15
Accepted
time: 82ms
memory: 28492kb

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 
25208 26621 
57146 28836 
18169 43915 
47842 59242 
34224 78881 
20722 38791 
89723 91046 
40306 72800 
92681 94906 
41151 7263 
76035 13332 
93928 38800 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
42596 44111 
36037 77687 
836 64592 
35187 43568 
34861 88539 
37477 22111 
85787...

result:

ok 

Test #17:

score: 15
Accepted
time: 70ms
memory: 38184kb

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: 15
Accepted
time: 73ms
memory: 37828kb

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:

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

result:

ok 

Subtask #3:

score: 5
Accepted

Dependency #2:

100%
Accepted

Test #19:

score: 5
Accepted
time: 103ms
memory: 40252kb

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:

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

result:

ok 

Test #20:

score: 5
Accepted
time: 48ms
memory: 40212kb

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: 5
Accepted
time: 52ms
memory: 40076kb

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: 5
Accepted
time: 101ms
memory: 42976kb

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 
29593 43465 
49534 20236 
95890 83680 
35990 98338 
39222 14744 
72902 65183 
76527 73553 
27695 40936 
68239 96356 
66861 20211 
9499 59817 
65669 53200 
74170 53434 
44590 79062 
66321 45816 
37251 32926 
58003...

result:

ok 

Test #23:

score: 5
Accepted
time: 35ms
memory: 36620kb

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:

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

result:

ok 

Test #24:

score: 5
Accepted
time: 98ms
memory: 37072kb

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 
15159 469 
15225 23585 
11180 1824 
7967 39735 
13852 38886 
27292 33137 
21697 28740 
9887 13116 
25732 33405 
39496 9156 
31286 24569 
32138 12900 
1862 2345 
2824 18626 
19382 25016 
18721 11342 
10236 296 
37626 8228 
30418 10247 
29998 33581 
4543 21676 
39650 14279 
1957 8842 
152...

result:

ok 

Test #25:

score: 5
Accepted
time: 88ms
memory: 37392kb

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:

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

result:

ok 

Test #26:

score: 5
Accepted
time: 68ms
memory: 35348kb

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:

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

result:

ok 

Test #27:

score: 5
Accepted
time: 37ms
memory: 34544kb

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 
1 3 
7 6 
10 5 
4 6 
9 9 
8 4 
9 2 
6 1 
7 10 
10 1 
9 7 
6 9 
6 9 
3 10 
10 10 
2 6 
7 7 
5 6 
8 3 
4 4 
2 5 
5 8 
8 2 
10 9 
3 8 
4 7 
2 2 
9 8 
8 10 
8 9 
1 2 
1 5 
4 7 
9 4 
6 9 
10 8 
2 4 
3 6 
4 1 
10 2 
5 3 
7 10 
1 7 
10 4 
6 6 
4 1 
8...

result:

ok 

Test #28:

score: 5
Accepted
time: 89ms
memory: 37100kb

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:

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

result:

ok 

Test #29:

score: 5
Accepted
time: 88ms
memory: 40400kb

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 
63660 79073 
41795 20397 
84311 1296 
3690 21178 
21052 31611 
51423 14323 
34208 82468 
2785 83835 
50594 28274 
10993 59957 
34259 64334 
73934 89407 
61083 14947 
53201 89472 
33351 61243 
76632 58718 
67464 85318 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
85776 ...

result:

ok 

Test #30:

score: 5
Accepted
time: 66ms
memory: 31132kb

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 
25208 26621 
57146 28836 
18169 43915 
47842 59242 
34224 78881 
20722 38791 
89723 91046 
40306 72800 
92681 94906 
41151 7263 
76035 13332 
93928 38800 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
42596 44111 
36037 77687 
836 64592 
35187 43568 
34861 88539 
37477 22111 
85787...

result:

ok 

Test #31:

score: 5
Accepted
time: 60ms
memory: 40188kb

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: 5
Accepted
time: 58ms
memory: 40056kb

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:

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

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: 11972kb

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
2 3 
3 2 

result:

ok 

Test #34:

score: 5
Accepted
time: 71ms
memory: 33800kb

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:

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

result:

ok 

Test #35:

score: 5
Accepted
time: 40ms
memory: 34564kb

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 
1 3 
7 6 
10 5 
4 6 
9 9 
8 4 
9 2 
6 1 
7 10 
10 1 
9 7 
6 9 
6 9 
3 10 
10 10 
2 6 
7 7 
5 6 
8 3 
4 4 
2 5 
5 8 
8 2 
10 9 
3 8 
4 7 
2 2 
9 8 
8 10 
8 9 
1 2 
1 5 
4 7 
9 4 
6 9 
10 8 
2 4 
3 6 
4 1 
10 2 
5 3 
7 10 
1 7 
10 4 
6 6 
4 1 
8...

result:

ok 

Test #36:

score: 5
Accepted
time: 77ms
memory: 37784kb

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:

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

result:

ok 

Test #37:

score: 5
Accepted
time: 83ms
memory: 39780kb

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 
63660 79073 
41795 20397 
84311 1296 
3690 21178 
21052 31611 
51423 14323 
34208 82468 
2785 83835 
50594 28274 
10993 59957 
34259 64334 
73934 89407 
61083 14947 
53201 89472 
33351 61243 
76632 58718 
67464 85318 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
85776 ...

result:

ok 

Test #38:

score: 5
Accepted
time: 76ms
memory: 29096kb

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 
25208 26621 
57146 28836 
18169 43915 
47842 59242 
34224 78881 
20722 38791 
89723 91046 
40306 72800 
92681 94906 
41151 7263 
76035 13332 
93928 38800 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
42596 44111 
36037 77687 
836 64592 
35187 43568 
34861 88539 
37477 22111 
85787...

result:

ok 

Test #39:

score: 5
Accepted
time: 63ms
memory: 40024kb

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: 5
Accepted
time: 64ms
memory: 38488kb

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:

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

result:

ok 

Test #41:

score: 5
Accepted
time: 56ms
memory: 40416kb

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: 5
Accepted
time: 49ms
memory: 40464kb

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: 5
Accepted
time: 93ms
memory: 42980kb

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 
29593 43465 
49534 20236 
95890 83680 
35990 98338 
39222 14744 
72902 65183 
76527 73553 
27695 40936 
68239 96356 
66861 20211 
9499 59817 
65669 53200 
74170 53434 
44590 79062 
66321 45816 
37251 32926 
58003...

result:

ok 

Test #44:

score: 5
Accepted
time: 4ms
memory: 14360kb

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 
12 5 
9 20 
4 2 
17 4 
7 15 
2 9 
5 5 
15 13 
5 19 
5 3 
19 10 
5 8 
10 7 
11 9 
3 16 
18 7 
9 5 
8 3 
18 4 

result:

ok 

Test #45:

score: 5
Accepted
time: 48ms
memory: 36228kb

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:

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

result:

ok 

Test #46:

score: 5
Accepted
time: 88ms
memory: 39144kb

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 
15159 469 
15225 23585 
11180 1824 
7967 39735 
13852 38886 
27292 33137 
21697 28740 
9887 13116 
25732 33405 
39496 9156 
31286 24569 
32138 12900 
1862 2345 
2824 18626 
19382 25016 
18721 11342 
10236 296 
37626 8228 
30418 10247 
29998 33581 
4543 21676 
39650 14279 
1957 8842 
152...

result:

ok 

Test #47:

score: 5
Accepted
time: 55ms
memory: 31272kb

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 
99759 66596 
12116 82137 
4043 92591 
134 72622 
47060 43432 
74386 48543 
12398 24648 
30807 15658 
99813 44636 
10967 53782 
99129 43783 
31224 17380 
90445 1594 
4363 11935 
83427 79197 
64946 57698 
76058 55536 
25332 10458 
31325 66313 
77601 43931 
23727 ...

result:

ok 

Test #48:

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

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:

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

result:

ok 

Test #49:

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

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:

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

result:

ok 

Test #50:

score: 5
Accepted
time: 4ms
memory: 16104kb

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 
7 8 
6 4 
4 7 
2 6 
6 4 
1 3 
3 2 
8 3 
6 7 
1 5 
3 6 
5 2 
4 1 
2 2 
2 6 
6 3 
5 2 
3 5 
3 3 

result:

ok 

Test #51:

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

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:

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

result:

ok 

Test #52:

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

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 
5 12 
10 14 
5 8 
11 17 
16 11 
13 3 
12 9 
17 4 
6 1 
4 6 
19 13 
18 5 

result:

ok 

Test #53:

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

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 
5 8 
3 5 
1 4 
10 9 
17 7 
4 2 
14 10 
6 16 
2 1 
16 11 
8 3 
15 13 
18 17 
11 6 

result:

ok 

Test #54:

score: 5
Accepted
time: 90ms
memory: 39764kb

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:

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

result:

ok 

Test #55:

score: 5
Accepted
time: 77ms
memory: 37472kb

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:

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

result:

ok 

Subtask #5:

score: 15
Accepted

Test #56:

score: 15
Accepted
time: 4ms
memory: 14340kb

input:

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

output:

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

result:

ok 

Test #57:

score: 15
Accepted
time: 7ms
memory: 12864kb

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:

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

result:

ok 

Test #58:

score: 15
Accepted
time: 3ms
memory: 14764kb

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

result:

ok 

Test #59:

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

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:

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

result:

ok 

Test #60:

score: 15
Accepted
time: 3ms
memory: 13368kb

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: 15
Accepted
time: 6ms
memory: 13324kb

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: 15
Accepted
time: 8ms
memory: 14680kb

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:

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

result:

ok 

Test #63:

score: 15
Accepted
time: 3ms
memory: 16392kb

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:

1 8 1 5 1 6 8 4 1 6 1 4 1 8 6 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 4 1 8 6 5 1 4 8 6 1 8 6 5 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 8 1 6 1 8 6 4 1 5 1 8 1 6 8 4 1 6 1 4 1 8 6 5 1 8 6 5 1 8 6 4 1 8 1 5 1 6 8 4 1 6 1 8 1 8 6 4 1 6 1 4 1 8 ...

result:

ok 

Test #64:

score: 15
Accepted
time: 3ms
memory: 12696kb

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:

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

result:

ok 

Test #65:

score: 15
Accepted
time: 5ms
memory: 15064kb

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 
1 2 
1 1 
2 1 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
1 2 
1 1 
2 1 
1 2 
1 1 
2 1 
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: 15
Accepted
time: 3ms
memory: 13296kb

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:

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

result:

ok 

Test #67:

score: 15
Accepted
time: 3ms
memory: 12776kb

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:

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

result:

ok 

Test #68:

score: 15
Accepted
time: 3ms
memory: 12772kb

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:

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

result:

ok 

Test #69:

score: 15
Accepted
time: 8ms
memory: 14484kb

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:

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

result:

ok 

Subtask #6:

score: 5
Accepted

Dependency #5:

100%
Accepted

Test #70:

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

input:

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

output:

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

result:

ok 

Test #71:

score: 5
Accepted
time: 7ms
memory: 13164kb

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:

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

result:

ok 

Test #72:

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

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

result:

ok 

Test #73:

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

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:

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

result:

ok 

Test #74:

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

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: 5
Accepted
time: 3ms
memory: 13316kb

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: 5
Accepted
time: 4ms
memory: 14328kb

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:

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

result:

ok 

Test #77:

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

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:

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

result:

ok 

Test #78:

score: 5
Accepted
time: 4ms
memory: 12856kb

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:

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

result:

ok 

Test #79:

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

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

result:

ok 

Test #80:

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

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:

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

result:

ok 

Test #81:

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

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:

1 8 1 5 1 6 8 4 1 6 1 4 1 8 6 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 4 1 8 6 5 1 4 8 6 1 8 6 5 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 8 1 6 1 8 6 4 1 5 1 8 1 6 8 4 1 6 1 4 1 8 6 5 1 8 6 5 1 8 6 4 1 8 1 5 1 6 8 4 1 6 1 8 1 8 6 4 1 6 1 4 1 8 ...

result:

ok 

Test #82:

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

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:

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

result:

ok 

Test #83:

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

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 
1 2 
1 1 
2 1 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
1 2 
1 1 
2 1 
1 2 
1 1 
2 1 
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: 5
Accepted
time: 7ms
memory: 15344kb

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:

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

result:

ok 

Test #85:

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

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:

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

result:

ok 

Test #86:

score: 5
Accepted
time: 8ms
memory: 15084kb

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:

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

result:

ok 

Test #87:

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

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:

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

result:

ok 

Subtask #7:

score: 5
Accepted

Dependency #6:

100%
Accepted

Test #88:

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

input:

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

output:

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

result:

ok 

Test #89:

score: 5
Accepted
time: 7ms
memory: 12936kb

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:

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

result:

ok 

Test #90:

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

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

result:

ok 

Test #91:

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

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:

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

result:

ok 

Test #92:

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

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: 5
Accepted
time: 3ms
memory: 13296kb

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: 5
Accepted
time: 4ms
memory: 14336kb

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:

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

result:

ok 

Test #95:

score: 5
Accepted
time: 8ms
memory: 15360kb

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:

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

result:

ok 

Test #96:

score: 5
Accepted
time: 8ms
memory: 14908kb

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:

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

result:

ok 

Test #97:

score: 5
Accepted
time: 7ms
memory: 12920kb

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

result:

ok 

Test #98:

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

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
2 3 
3 2 

result:

ok 

Test #99:

score: 5
Accepted
time: 4ms
memory: 14716kb

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:

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

result:

ok 

Test #100:

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

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 
12 5 
9 20 
4 2 
17 4 
7 15 
2 9 
5 5 
15 13 
5 19 
5 3 
19 10 
5 8 
10 7 
11 9 
3 16 
18 7 
9 5 
8 3 
18 4 

result:

ok 

Test #101:

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

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:

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

result:

ok 

Test #102:

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

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 
7 8 
6 4 
4 7 
2 6 
6 4 
1 3 
3 2 
8 3 
6 7 
1 5 
3 6 
5 2 
4 1 
2 2 
2 6 
6 3 
5 2 
3 5 
3 3 

result:

ok 

Test #103:

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

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:

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

result:

ok 

Test #104:

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

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 
5 12 
10 14 
5 8 
11 17 
16 11 
13 3 
12 9 
17 4 
6 1 
4 6 
19 13 
18 5 

result:

ok 

Test #105:

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

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 
5 8 
3 5 
1 4 
10 9 
17 7 
4 2 
14 10 
6 16 
2 1 
16 11 
8 3 
15 13 
18 17 
11 6 

result:

ok 

Test #106:

score: 5
Accepted
time: 63ms
memory: 17820kb

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:

21831 89273 83125 82535 39983 72373 73464 28260 72929 77705 13035 59023 15331 81808 80795 83931 77980 57260 97490 95586 9817 47154 20263 53954 19722 39993 64395 96115 25161 61419 89129 95228 14598 43890 26960 80088 39461 91469 41671 30768 75728 82317 52468 53271 29144 68165 91324 77452 34026 39136 4...

result:

ok 

Test #107:

score: 5
Accepted
time: 712ms
memory: 17196kb

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:

2 16190 29672 81221 3312 24558 7411 66068 2809 14188 30519 89171 75012 40730 50758 19617 67184 85957 89623 57009 26518 21809 75380 83405 67967 44954 88520 26853 29158 70973 34236 51599 73856 51063 68493 78579 36785 38693 53601 19007 26251 52690 64148 72463 31787 70367 55236 60894 73392 66739 49296 1...

result:

ok 

Test #108:

score: 5
Accepted
time: 11ms
memory: 15292kb

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:

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

result:

ok 

Test #109:

score: 5
Accepted
time: 5ms
memory: 15192kb

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:

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

result:

ok 

Test #110:

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

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:

1 8 1 5 1 6 8 4 1 6 1 4 1 8 6 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 4 1 8 6 5 1 4 8 6 1 8 6 5 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 8 1 6 1 8 6 4 1 5 1 8 1 6 8 4 1 6 1 4 1 8 6 5 1 8 6 5 1 8 6 4 1 8 1 5 1 6 8 4 1 6 1 8 1 8 6 4 1 6 1 4 1 8 ...

result:

ok 

Test #111:

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

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:

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

result:

ok 

Test #112:

score: 5
Accepted
time: 5ms
memory: 12740kb

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 
1 2 
1 1 
2 1 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
1 2 
1 1 
2 1 
1 2 
1 1 
2 1 
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: 5
Accepted
time: 3ms
memory: 13344kb

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:

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

result:

ok 

Test #114:

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

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:

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

result:

ok 

Test #115:

score: 5
Accepted
time: 8ms
memory: 12780kb

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:

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

result:

ok 

Test #116:

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

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:

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

result:

ok 

Subtask #8:

score: 20
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Test #117:

score: 20
Accepted
time: 71ms
memory: 39644kb

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:

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

result:

ok 

Test #118:

score: 20
Accepted
time: 43ms
memory: 38008kb

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: 20
Accepted
time: 45ms
memory: 40056kb

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: 20
Accepted
time: 0ms
memory: 14316kb

input:

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

output:

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

result:

ok 

Test #121:

score: 20
Accepted
time: 4ms
memory: 16468kb

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:

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

result:

ok 

Test #122:

score: 20
Accepted
time: 3ms
memory: 14352kb

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:

1 8 1 5 1 6 8 4 1 6 1 4 1 8 6 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 4 1 8 6 5 1 4 8 6 1 8 6 5 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 8 1 6 1 8 6 4 1 5 1 8 1 6 8 4 1 6 1 4 1 8 6 5 1 8 6 5 1 8 6 4 1 8 1 5 1 6 8 4 1 6 1 8 1 8 6 4 1 6 1 4 1 8 ...

result:

ok 

Test #123:

score: 20
Accepted
time: 3ms
memory: 12688kb

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:

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

result:

ok 

Test #124:

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

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 
1 2 
1 1 
2 1 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
1 2 
1 1 
2 1 
1 2 
1 1 
2 1 
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: 20
Accepted
time: 0ms
memory: 13304kb

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:

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

result:

ok 

Test #126:

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

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:

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

result:

ok 

Test #127:

score: 20
Accepted
time: 3ms
memory: 12752kb

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:

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

result:

ok 

Test #128:

score: 20
Accepted
time: 76ms
memory: 39408kb

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:

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

result:

ok 

Test #129:

score: 20
Accepted
time: 8ms
memory: 12484kb

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:

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

result:

ok 

Test #130:

score: 20
Accepted
time: 4ms
memory: 15000kb

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:

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

result:

ok 

Test #131:

score: 20
Accepted
time: 3ms
memory: 14780kb

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

result:

ok 

Test #132:

score: 20
Accepted
time: 3ms
memory: 13332kb

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:

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

result:

ok 

Test #133:

score: 20
Accepted
time: 3ms
memory: 13596kb

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: 20
Accepted
time: 6ms
memory: 15420kb

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
Accepted
time: 366ms
memory: 51872kb

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:

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

result:

ok 

Test #136:

score: 20
Accepted
time: 336ms
memory: 21948kb

input:

488 1024 488
437 386 352 3 204 235 111 327 270 195 436 108 324 319 398 484 177 270 133 272 484 202 67 380 1 215 36 327 104 412 432 67 157 455 286 196 62 262 437 4 289 108 272 402 136 265 291 48 135 182 385 319 112 186 70 50 273 196 231 195 17 319 178 270 132 424 78 406 324 346 57 71 97 186 396 422 3...

output:

1 484 290 360 238 259 374 156 272 133 84 470 202 386 52 357 402 196 467 36 56 74 396 256 195 180 298 86 48 78 35 69 415 255 158 406 327 416 62 170 45 356 373 317 333 179 142 258 172 231 205 324 295 44 18 273 268 319 361 468 217 471 223 173 415 274 478 271 229 303 240 254 347 350 299 215 76 218 353 4...

result:

ok 

Test #137:

score: 20
Accepted
time: 24ms
memory: 14052kb

input:

6 16384 6
2 5 1 6 5 2 5 1 6 1 5 5 6 5 5 6 2 6 2 1 6 6 5 5 6 5 2 2 1 1 1 6 5 1 5 6 6 2 6 1 2 6 6 2 2 1 6 6 6 1 5 5 1 5 5 6 2 5 1 5 1 5 1 2 5 1 1 6 5 6 5 2 1 1 6 1 6 6 5 5 5 1 5 6 2 5 6 5 5 6 6 6 2 5 5 6 2 5 6 1 5 6 6 2 2 5 1 2 5 5 6 5 6 6 1 1 2 2 5 5 6 5 6 5 5 1 6 6 6 6 1 6 5 6 5 2 6 6 6 5 5 6 6 6 6 ...

output:

1 6 5 6 1 2 5 6 1 5 6 2 6 5 6 5 1 5 6 2 1 2 5 6 1 5 6 5 5 6 6 2 1 5 5 6 1 2 5 6 1 5 6 2 5 6 6 2 1 5 6 2 5 6 5 6 1 5 5 6 6 2 5 6 1 5 5 6 1 6 5 2 1 5 5 6 5 6 6 2 1 5 5 6 1 6 5 2 1 5 6 2 6 2 5 6 1 5 5 6 1 6 5 2 1 5 6 2 6 2 5 6 1 5 5 6 5 6 6 2 1 5 6 2 6 2 5 6 1 5 5 6 1 6 5 2 1 5 5 6 5 6 6 2 1 5 5 6 1 6 ...

result:

ok 

Test #138:

score: 20
Accepted
time: 86ms
memory: 19056kb

input:

6035 32 3126
2384 1507 1419 2790 466 3034 613 391 1142 1913 2728 1770 1249 2719 457 1720 2670 541 568 1711 1147 1498 2929 1920 2067 351 2089 1076 3001 2562 2615 1630
1719 1848 849 3098 1026 1016 2612 2228 526 2395 1808 1898 1626 2249 2857 1473 2360 2448 1450 1045 55 2166 2597 1586 1181 540 789 612 1...

output:

2615 3001 391 1507 466 1147 1419 541 1913 2719 2067 457 2728 568 1076 1920 1249 1720 2929 351 1498 1770 1711 2562 1630 3034 2790 2670 2384 2089 613 1142 
612 1719 1026 1045 2448 2166 540 1626 1808 2828 2857 849 841 2395 2597 2612 1586 2228 789 1450 1898 335 526 1181 55 2360 1579 3098 2249 1473 1016 ...

result:

ok 

Test #139:

score: 20
Accepted
time: 67ms
memory: 34980kb

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:

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

result:

ok 

Test #140:

score: 20
Accepted
time: 242ms
memory: 17892kb

input:

442 1024 442
204 189 272 54 225 232 246 111 211 39 140 31 133 213 40 172 5 229 225 147 176 81 31 108 40 148 128 210 21 262 105 163 228 247 259 161 184 211 3 211 261 277 70 186 27 195 89 282 233 258 169 215 154 267 21 239 264 213 91 131 295 39 163 282 254 63 286 282 9 116 139 285 76 206 85 233 73 180...

output:

1 95 239 41 278 281 206 115 42 36 45 126 268 180 70 208 102 69 67 262 161 261 247 147 28 20 94 93 30 155 85 90 89 119 112 238 140 204 83 298 232 289 156 291 269 141 6 259 179 51 105 162 244 222 123 225 260 194 26 133 33 144 40 255 299 285 11 202 211 15 164 207 197 21 108 296 27 297 266 254 187 215 2...

result:

ok 

Test #141:

score: 20
Accepted
time: 373ms
memory: 44520kb

input:

59767 8 50000
14021 37442 6924 2683 26908 28108 49331 4157
37602 8443 19287 12234 4215 29554 33860 1201
2453 34206 48003 47930 30310 48979 24906 2040
19079 30112 42351 26155 23394 37361 37618 35224
18576 29106 48671 22449 25578 19435 4011 7931
7174 13442 3382 24117 23309 31964 19031 45122
33083 3854...

output:

28108 4157 37442 2683 26908 14021 6924 49331 
8443 33860 29554 19287 1201 37602 4215 12234 
47930 2453 2040 48979 24906 30310 34206 48003 
26155 30112 35224 23394 42351 37361 19079 37618 
18576 19435 22449 7931 4011 25578 29106 48671 
19031 3382 13442 23309 24117 31964 7174 45122 
45872 41121 49016 ...

result:

ok 

Test #142:

score: 20
Accepted
time: 505ms
memory: 54264kb

input:

62500 8 62500
51504 53517 18444 47810 55743 52115 39033 39945
39582 40153 48723 405 57762 57932 38589 34957
46544 29639 46926 5502 36080 4497 12837 5415
40364 54270 15841 56968 20512 49512 23271 29535
32613 29997 43963 8109 43144 40423 38621 31273
32431 16718 11192 30443 19278 38857 30834 60796
1958...

output:

39945 51504 52115 18444 39033 55743 47810 53517 
40153 34957 48723 57932 39582 405 57762 38589 
46544 36080 12837 5502 29639 4497 46926 5415 
29535 54270 15841 49512 56968 23271 40364 20512 
43144 29997 31273 8109 40423 32613 38621 43963 
19278 30834 32431 11192 38857 30443 60796 16718 
44729 16527 ...

result:

ok 

Test #143:

score: 20
Accepted
time: 130ms
memory: 16544kb

input:

61 8192 61
47 47 47 47 47 36 36 47 36 36 36 47 36 47 36 47 47 36 36 36 47 36 36 36 47 36 47 47 47 36 47 36 36 47 47 36 47 47 47 47 47 47 36 36 36 47 47 21 36 36 36 36 47 47 36 47 36 47 47 47 36 47 47 47 47 36 36 47 36 47 36 47 47 36 47 47 36 47 47 36 36 36 36 36 47 36 36 36 36 47 36 47 36 47 47 36 3...

output:

1 47 47 36 36 47 36 47 47 36 47 36 47 36 36 47 36 47 47 36 36 47 47 36 36 47 12 36 47 36 36 47 47 36 47 36 36 47 36 47 47 29 47 36 47 36 36 47 47 36 47 36 36 47 36 47 47 36 36 47 36 47 36 47 36 47 21 47 36 47 47 36 36 47 36 47 47 36 36 47 47 36 36 47 47 36 47 36 36 28 47 36 47 36 36 47 47 36 47 36 4...

result:

ok 

Test #144:

score: 20
Accepted
time: 104ms
memory: 16196kb

input:

50 8192 50
40 29 20 40 40 40 20 40 40 40 40 49 20 20 40 40 20 40 40 20 20 20 40 20 40 40 20 20 40 40 40 40 40 20 40 40 40 40 40 40 20 40 20 40 20 40 40 20 40 40 20 20 40 20 40 40 20 40 40 40 20 19 40 40 40 40 20 40 20 40 20 20 20 20 20 20 20 40 20 40 20 20 20 40 40 40 40 40 40 40 20 20 40 20 20 40 4...

output:

1 20 40 20 20 40 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 20 40 40 20 40 24 40 20 40 20 40 20 40 20 20 40 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 20 40 40 20 40 29 40 20 20 40 40 46 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 9 20 40 20 40 20 40 20 40 20 20 40 20...

result:

ok 

Test #145:

score: 20
Accepted
time: 310ms
memory: 39944kb

input:

56000 8 50000
38540 29053 29109 38746 29288 38450 43383 32332
14057 662 19282 8910 49216 18920 32722 25913
4461 24280 3328 17870 569 37854 3246 27991
35958 21836 18035 12840 25641 36792 21982 33634
6456 49901 35635 42812 24541 44145 8939 11926
29442 26462 18739 27152 42797 5777 15117 19193
40156 501...

output:

38450 32332 38746 29053 38540 29288 29109 43383 
25913 49216 19282 14057 18920 32722 662 8910 
17870 4461 37854 27991 569 3328 24280 3246 
36792 33634 21836 18035 35958 12840 21982 25641 
42812 24541 6456 11926 49901 35635 44145 8939 
26462 27152 5777 19193 18739 42797 29442 15117 
34145 45047 40156...

result:

ok 

Test #146:

score: 20
Accepted
time: 302ms
memory: 34116kb

input:

61952 8 61952
31143 31143 3756 34556 4617 49727 3756 48229
48054 10150 10150 1113 46750 1113 11148 44687
18150 50774 34447 50642 31286 44185 50642 18150
18803 8000 20838 21039 20764 18803 20764 56246
59196 9154 49057 7963 47927 59196 59996 7963
27925 33037 27925 25590 4557 12519 33037 21779
9336 551...

output:

3756 49727 31143 4617 48229 3756 31143 34556 
11148 10150 48054 1113 10150 46750 44687 1113 
50642 31286 50774 18150 18150 34447 44185 50642 
18803 21039 20838 20764 20764 56246 8000 18803 
49057 7963 59196 47927 59996 59196 7963 9154 
27925 4557 21779 33037 25590 27925 12519 33037 
56435 9336 1425 ...

result:

ok 

Test #147:

score: 20
Accepted
time: 88ms
memory: 43080kb

input:

99995 4 99995
1 2 28571 28571
2 4 28572 28572
3 1 28573 28573
4 6 28574 28574
5 3 28575 28575
6 8 28576 28576
7 5 28577 28577
8 10 28578 28578
9 7 28579 28579
10 12 28580 28580
11 9 28581 28581
12 14 28582 28582
13 11 28583 28583
14 16 28584 28584
15 13 28585 28585
16 18 28586 28586
17 15 28587 2858...

output:

1 28571 28571 2 
2 28572 28572 4 
3 28573 1 28573 
4 28574 28574 6 
5 28575 28575 3 
6 28576 28576 8 
7 28577 5 28577 
8 28578 28578 10 
9 28579 28579 7 
10 28580 28580 12 
11 28581 9 28581 
12 28582 28582 14 
13 28583 28583 11 
14 28584 28584 16 
15 28585 13 28585 
16 28586 28586 18 
17 28587 28587...

result:

ok 

Test #148:

score: 20
Accepted
time: 100ms
memory: 43072kb

input:

99995 4 99995
1 2 2 3
57141 1 1 57141
3 4 4 7
57142 3 3 57142
5 6 6 1
57143 5 5 57143
7 8 8 11
57144 7 7 57144
9 10 10 5
57145 9 9 57145
11 12 12 15
57146 11 11 57146
13 14 14 9
57147 13 13 57147
15 16 16 19
57148 15 15 57148
17 18 18 13
57149 17 17 57149
19 20 20 23
57150 19 19 57150
21 22 22 17
57...

output:

1 2 3 2 
57141 1 1 57141 
3 4 7 4 
57142 3 57142 3 
5 6 6 1 
57143 5 57143 5 
7 8 11 8 
57144 7 57144 7 
9 10 5 10 
57145 9 9 57145 
11 12 15 12 
57146 11 57146 11 
13 14 14 9 
57147 13 57147 13 
15 16 19 16 
57148 15 57148 15 
17 18 13 18 
57149 17 17 57149 
19 20 23 20 
57150 19 57150 19 
21 22 22...

result:

ok 

Test #149:

score: 20
Accepted
time: 91ms
memory: 43360kb

input:

99995 4 99995
71425 71425 99994 99995
71424 71424 99992 99994
71423 71423 99995 99993
71422 71422 99990 99992
71421 71421 99993 99991
71420 71420 99988 99990
71419 71419 99991 99989
71418 71418 99986 99988
71417 71417 99989 99987
71416 71416 99984 99986
71415 71415 99987 99985
71414 71414 99982 9998...

output:

71425 99994 71425 99995 
71424 99992 71424 99994 
99995 71423 71423 99993 
71422 99990 71422 99992 
71421 99993 71421 99991 
71420 99988 71420 99990 
99991 71419 71419 99989 
71418 99986 71418 99988 
71417 99989 71417 99987 
71416 99984 71416 99986 
99987 71415 71415 99985 
71414 99982 71414 99984 
...

result:

ok 

Test #150:

score: 20
Accepted
time: 39ms
memory: 33100kb

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 
1 3 
7 6 
10 5 
4 6 
9 9 
8 4 
9 2 
6 1 
7 10 
10 1 
9 7 
6 9 
6 9 
3 10 
10 10 
2 6 
7 7 
5 6 
8 3 
4 4 
2 5 
5 8 
8 2 
10 9 
3 8 
4 7 
2 2 
9 8 
8 10 
8 9 
1 2 
1 5 
4 7 
9 4 
6 9 
10 8 
2 4 
3 6 
4 1 
10 2 
5 3 
7 10 
1 7 
10 4 
6 6 
4 1 
8...

result:

ok 

Test #151:

score: 20
Accepted
time: 84ms
memory: 43412kb

input:

99995 4 99995
99993 99994 99994 99995
42855 99995 99995 42855
99989 99992 99992 99993
42854 99993 99993 42854
99995 99990 99990 99991
42853 99991 99991 42853
99985 99988 99988 99989
42852 99989 99989 42852
99991 99986 99986 99987
42851 99987 99987 42851
99981 99984 99984 99985
42850 99985 99985 4285...

output:

99994 99993 99994 99995 
42855 99995 99995 42855 
99992 99989 99992 99993 
99993 42854 99993 42854 
99995 99990 99990 99991 
99991 42853 99991 42853 
99988 99985 99988 99989 
99989 42852 99989 42852 
99986 99991 99986 99987 
42851 99987 99987 42851 
99984 99981 99984 99985 
99985 42850 99985 42850 
...

result:

ok 

Test #152:

score: 20
Accepted
time: 99ms
memory: 41372kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

71425 85710 71425 85710 
85709 71424 71424 85709 
85708 71423 71423 85708 
85707 71422 71422 85707 
71421 85706 71421 85706 
85705 71420 71420 85705 
85704 71419 71419 85704 
85703 71418 71418 85703 
71417 85702 71417 85702 
85701 71416 71416 85701 
85700 71415 71415 85700 
85699 71414 71414 85699 
...

result:

ok 

Test #153:

score: 20
Accepted
time: 94ms
memory: 41372kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 71425 85710 
71424 85709 71424 85709 
71423 85708 71423 85708 
71422 85707 71422 85707 
85706 71421 71421 85706 
71420 85705 71420 85705 
71419 85704 71419 85704 
71418 85703 71418 85703 
85702 71417 71417 85702 
71416 85701 71416 85701 
71415 85700 71415 85700 
71414 85699 71414 85699 
...

result:

ok 

Test #154:

score: 20
Accepted
time: 85ms
memory: 40864kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
14287 28572 14287 28572 
14288 28573 14288 28573 
14289 28574 14289 28574 
14290 28575 28575 14290 
14291 28576 14291 28576 
14292 28577 14292 28577 
14293 28578 14293 28578 
14294 28579 28579 14294 
14295 28580 14295 28580 
14296 28581 14296 28581 
14297 28582 14297 28582 
...

result:

ok 

Test #155:

score: 20
Accepted
time: 86ms
memory: 40756kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
14287 28572 14287 28572 
14288 28573 14288 28573 
14289 28574 14289 28574 
14290 28575 28575 14290 
14291 28576 14291 28576 
14292 28577 14292 28577 
14293 28578 14293 28578 
14294 28579 28579 14294 
14295 28580 14295 28580 
14296 28581 14296 28581 
14297 28582 14297 28582 
...

result:

ok 

Test #156:

score: 20
Accepted
time: 105ms
memory: 28452kb

input:

62496 8 62496
1 1 2 2 17857 17857 17857 17857
2 2 4 4 17858 17858 17858 17858
3 3 1 1 17859 17859 17859 17859
4 4 6 6 17860 17860 17860 17860
5 5 3 3 17861 17861 17861 17861
6 6 8 8 17862 17862 17862 17862
7 7 5 5 17863 17863 17863 17863
8 8 10 10 17864 17864 17864 17864
9 9 7 7 17865 17865 17865 17...

output:

1 17857 2 17857 1 17857 2 17857 
2 17858 4 17858 2 17858 4 17858 
3 17859 1 17859 3 17859 1 17859 
4 17860 6 17860 4 17860 6 17860 
5 17861 3 17861 5 17861 3 17861 
6 17862 8 17862 6 17862 8 17862 
7 17863 5 17863 7 17863 5 17863 
8 17864 10 17864 8 17864 10 17864 
9 17865 7 17865 9 17865 7 17865 
1...

result:

ok 

Test #157:

score: 20
Accepted
time: 114ms
memory: 28388kb

input:

62496 8 62496
1 3 2 2 2 2 1 3
35713 35713 1 1 1 1 35713 35713
3 7 4 4 4 4 3 7
35714 35714 3 3 3 3 35714 35714
5 1 6 6 6 6 5 1
35715 35715 5 5 5 5 35715 35715
7 11 8 8 8 8 7 11
35716 35716 7 7 7 7 35716 35716
9 5 10 10 10 10 9 5
35717 35717 9 9 9 9 35717 35717
11 15 12 12 12 12 11 15
35718 35718 11 1...

output:

1 2 2 3 1 2 2 3 
35713 1 1 35713 35713 1 1 35713 
3 4 4 7 3 4 4 7 
35714 3 3 35714 35714 3 3 35714 
5 6 6 1 5 6 6 1 
35715 5 5 35715 35715 5 5 35715 
7 8 8 11 7 8 8 11 
35716 7 7 35716 35716 7 7 35716 
9 10 10 5 9 10 10 5 
35717 9 9 35717 35717 9 9 35717 
11 12 12 15 11 12 12 15 
35718 11 11 35718 3...

result:

ok 

Test #158:

score: 20
Accepted
time: 73ms
memory: 40136kb

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:

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

result:

ok 

Test #159:

score: 20
Accepted
time: 92ms
memory: 40476kb

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 
63660 79073 
41795 20397 
84311 1296 
3690 21178 
21052 31611 
51423 14323 
34208 82468 
2785 83835 
50594 28274 
10993 59957 
34259 64334 
73934 89407 
61083 14947 
53201 89472 
33351 61243 
76632 58718 
67464 85318 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
85776 ...

result:

ok 

Test #160:

score: 20
Accepted
time: 98ms
memory: 28484kb

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 
25208 26621 
57146 28836 
18169 43915 
47842 59242 
34224 78881 
20722 38791 
89723 91046 
40306 72800 
92681 94906 
41151 7263 
76035 13332 
93928 38800 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
42596 44111 
36037 77687 
836 64592 
35187 43568 
34861 88539 
37477 22111 
85787...

result:

ok 

Test #161:

score: 20
Accepted
time: 76ms
memory: 40312kb

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 #162:

score: 20
Accepted
time: 67ms
memory: 37832kb

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:

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

result:

ok 

Subtask #9:

score: 10
Accepted

Dependency #3:

100%
Accepted

Dependency #6:

100%
Accepted

Test #163:

score: 10
Accepted
time: 94ms
memory: 37412kb

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:

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

result:

ok 

Test #164:

score: 10
Accepted
time: 56ms
memory: 40200kb

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: 10
Accepted
time: 48ms
memory: 39856kb

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: 10
Accepted
time: 0ms
memory: 14052kb

input:

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

output:

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

result:

ok 

Test #167:

score: 10
Accepted
time: 4ms
memory: 14424kb

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:

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

result:

ok 

Test #168:

score: 10
Accepted
time: 3ms
memory: 16104kb

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:

1 8 1 5 1 6 8 4 1 6 1 4 1 8 6 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 4 1 8 6 5 1 4 8 6 1 8 6 5 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 8 1 6 1 8 6 4 1 5 1 8 1 6 8 4 1 6 1 4 1 8 6 5 1 8 6 5 1 8 6 4 1 8 1 5 1 6 8 4 1 6 1 8 1 8 6 4 1 6 1 4 1 8 ...

result:

ok 

Test #169:

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

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:

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

result:

ok 

Test #170:

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

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 
1 2 
1 1 
2 1 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
1 2 
1 1 
2 1 
1 2 
1 1 
2 1 
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: 10
Accepted
time: 7ms
memory: 15628kb

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:

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

result:

ok 

Test #172:

score: 10
Accepted
time: 3ms
memory: 12836kb

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:

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

result:

ok 

Test #173:

score: 10
Accepted
time: 2ms
memory: 14888kb

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:

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

result:

ok 

Test #174:

score: 10
Accepted
time: 70ms
memory: 38752kb

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:

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

result:

ok 

Test #175:

score: 10
Accepted
time: 4ms
memory: 12436kb

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:

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

result:

ok 

Test #176:

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

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:

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

result:

ok 

Test #177:

score: 10
Accepted
time: 3ms
memory: 14792kb

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

result:

ok 

Test #178:

score: 10
Accepted
time: 7ms
memory: 15384kb

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:

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

result:

ok 

Test #179:

score: 10
Accepted
time: 6ms
memory: 13316kb

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: 10
Accepted
time: 3ms
memory: 15388kb

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
Accepted
time: 406ms
memory: 52608kb

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:

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

result:

ok 

Test #182:

score: 10
Accepted
time: 343ms
memory: 20960kb

input:

488 1024 488
437 386 352 3 204 235 111 327 270 195 436 108 324 319 398 484 177 270 133 272 484 202 67 380 1 215 36 327 104 412 432 67 157 455 286 196 62 262 437 4 289 108 272 402 136 265 291 48 135 182 385 319 112 186 70 50 273 196 231 195 17 319 178 270 132 424 78 406 324 346 57 71 97 186 396 422 3...

output:

1 484 290 360 238 259 374 156 272 133 84 470 202 386 52 357 402 196 467 36 56 74 396 256 195 180 298 86 48 78 35 69 415 255 158 406 327 416 62 170 45 356 373 317 333 179 142 258 172 231 205 324 295 44 18 273 268 319 361 468 217 471 223 173 415 274 478 271 229 303 240 254 347 350 299 215 76 218 353 4...

result:

ok 

Test #183:

score: 10
Accepted
time: 24ms
memory: 16408kb

input:

6 16384 6
2 5 1 6 5 2 5 1 6 1 5 5 6 5 5 6 2 6 2 1 6 6 5 5 6 5 2 2 1 1 1 6 5 1 5 6 6 2 6 1 2 6 6 2 2 1 6 6 6 1 5 5 1 5 5 6 2 5 1 5 1 5 1 2 5 1 1 6 5 6 5 2 1 1 6 1 6 6 5 5 5 1 5 6 2 5 6 5 5 6 6 6 2 5 5 6 2 5 6 1 5 6 6 2 2 5 1 2 5 5 6 5 6 6 1 1 2 2 5 5 6 5 6 5 5 1 6 6 6 6 1 6 5 6 5 2 6 6 6 5 5 6 6 6 6 ...

output:

1 6 5 6 1 2 5 6 1 5 6 2 6 5 6 5 1 5 6 2 1 2 5 6 1 5 6 5 5 6 6 2 1 5 5 6 1 2 5 6 1 5 6 2 5 6 6 2 1 5 6 2 5 6 5 6 1 5 5 6 6 2 5 6 1 5 5 6 1 6 5 2 1 5 5 6 5 6 6 2 1 5 5 6 1 6 5 2 1 5 6 2 6 2 5 6 1 5 5 6 1 6 5 2 1 5 6 2 6 2 5 6 1 5 5 6 5 6 6 2 1 5 6 2 6 2 5 6 1 5 5 6 1 6 5 2 1 5 5 6 5 6 6 2 1 5 5 6 1 6 ...

result:

ok 

Test #184:

score: 10
Accepted
time: 83ms
memory: 21160kb

input:

6035 32 3126
2384 1507 1419 2790 466 3034 613 391 1142 1913 2728 1770 1249 2719 457 1720 2670 541 568 1711 1147 1498 2929 1920 2067 351 2089 1076 3001 2562 2615 1630
1719 1848 849 3098 1026 1016 2612 2228 526 2395 1808 1898 1626 2249 2857 1473 2360 2448 1450 1045 55 2166 2597 1586 1181 540 789 612 1...

output:

2615 3001 391 1507 466 1147 1419 541 1913 2719 2067 457 2728 568 1076 1920 1249 1720 2929 351 1498 1770 1711 2562 1630 3034 2790 2670 2384 2089 613 1142 
612 1719 1026 1045 2448 2166 540 1626 1808 2828 2857 849 841 2395 2597 2612 1586 2228 789 1450 1898 335 526 1181 55 2360 1579 3098 2249 1473 1016 ...

result:

ok 

Test #185:

score: 10
Accepted
time: 71ms
memory: 35228kb

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:

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

result:

ok 

Test #186:

score: 10
Accepted
time: 242ms
memory: 19256kb

input:

442 1024 442
204 189 272 54 225 232 246 111 211 39 140 31 133 213 40 172 5 229 225 147 176 81 31 108 40 148 128 210 21 262 105 163 228 247 259 161 184 211 3 211 261 277 70 186 27 195 89 282 233 258 169 215 154 267 21 239 264 213 91 131 295 39 163 282 254 63 286 282 9 116 139 285 76 206 85 233 73 180...

output:

1 95 239 41 278 281 206 115 42 36 45 126 268 180 70 208 102 69 67 262 161 261 247 147 28 20 94 93 30 155 85 90 89 119 112 238 140 204 83 298 232 289 156 291 269 141 6 259 179 51 105 162 244 222 123 225 260 194 26 133 33 144 40 255 299 285 11 202 211 15 164 207 197 21 108 296 27 297 266 254 187 215 2...

result:

ok 

Test #187:

score: 10
Accepted
time: 341ms
memory: 44968kb

input:

59767 8 50000
14021 37442 6924 2683 26908 28108 49331 4157
37602 8443 19287 12234 4215 29554 33860 1201
2453 34206 48003 47930 30310 48979 24906 2040
19079 30112 42351 26155 23394 37361 37618 35224
18576 29106 48671 22449 25578 19435 4011 7931
7174 13442 3382 24117 23309 31964 19031 45122
33083 3854...

output:

28108 4157 37442 2683 26908 14021 6924 49331 
8443 33860 29554 19287 1201 37602 4215 12234 
47930 2453 2040 48979 24906 30310 34206 48003 
26155 30112 35224 23394 42351 37361 19079 37618 
18576 19435 22449 7931 4011 25578 29106 48671 
19031 3382 13442 23309 24117 31964 7174 45122 
45872 41121 49016 ...

result:

ok 

Test #188:

score: 10
Accepted
time: 441ms
memory: 53828kb

input:

62500 8 62500
51504 53517 18444 47810 55743 52115 39033 39945
39582 40153 48723 405 57762 57932 38589 34957
46544 29639 46926 5502 36080 4497 12837 5415
40364 54270 15841 56968 20512 49512 23271 29535
32613 29997 43963 8109 43144 40423 38621 31273
32431 16718 11192 30443 19278 38857 30834 60796
1958...

output:

39945 51504 52115 18444 39033 55743 47810 53517 
40153 34957 48723 57932 39582 405 57762 38589 
46544 36080 12837 5502 29639 4497 46926 5415 
29535 54270 15841 49512 56968 23271 40364 20512 
43144 29997 31273 8109 40423 32613 38621 43963 
19278 30834 32431 11192 38857 30443 60796 16718 
44729 16527 ...

result:

ok 

Test #189:

score: 10
Accepted
time: 131ms
memory: 16244kb

input:

61 8192 61
47 47 47 47 47 36 36 47 36 36 36 47 36 47 36 47 47 36 36 36 47 36 36 36 47 36 47 47 47 36 47 36 36 47 47 36 47 47 47 47 47 47 36 36 36 47 47 21 36 36 36 36 47 47 36 47 36 47 47 47 36 47 47 47 47 36 36 47 36 47 36 47 47 36 47 47 36 47 47 36 36 36 36 36 47 36 36 36 36 47 36 47 36 47 47 36 3...

output:

1 47 47 36 36 47 36 47 47 36 47 36 47 36 36 47 36 47 47 36 36 47 47 36 36 47 12 36 47 36 36 47 47 36 47 36 36 47 36 47 47 29 47 36 47 36 36 47 47 36 47 36 36 47 36 47 47 36 36 47 36 47 36 47 36 47 21 47 36 47 47 36 36 47 36 47 47 36 36 47 47 36 36 47 47 36 47 36 36 28 47 36 47 36 36 47 47 36 47 36 4...

result:

ok 

Test #190:

score: 10
Accepted
time: 108ms
memory: 14296kb

input:

50 8192 50
40 29 20 40 40 40 20 40 40 40 40 49 20 20 40 40 20 40 40 20 20 20 40 20 40 40 20 20 40 40 40 40 40 20 40 40 40 40 40 40 20 40 20 40 20 40 40 20 40 40 20 20 40 20 40 40 20 40 40 40 20 19 40 40 40 40 20 40 20 40 20 20 20 20 20 20 20 40 20 40 20 20 20 40 40 40 40 40 40 40 20 20 40 20 20 40 4...

output:

1 20 40 20 20 40 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 20 40 40 20 40 24 40 20 40 20 40 20 40 20 20 40 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 20 40 40 20 40 29 40 20 20 40 40 46 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 9 20 40 20 40 20 40 20 40 20 20 40 20...

result:

ok 

Test #191:

score: 10
Accepted
time: 304ms
memory: 43324kb

input:

56000 8 50000
38540 29053 29109 38746 29288 38450 43383 32332
14057 662 19282 8910 49216 18920 32722 25913
4461 24280 3328 17870 569 37854 3246 27991
35958 21836 18035 12840 25641 36792 21982 33634
6456 49901 35635 42812 24541 44145 8939 11926
29442 26462 18739 27152 42797 5777 15117 19193
40156 501...

output:

38450 32332 38746 29053 38540 29288 29109 43383 
25913 49216 19282 14057 18920 32722 662 8910 
17870 4461 37854 27991 569 3328 24280 3246 
36792 33634 21836 18035 35958 12840 21982 25641 
42812 24541 6456 11926 49901 35635 44145 8939 
26462 27152 5777 19193 18739 42797 29442 15117 
34145 45047 40156...

result:

ok 

Test #192:

score: 10
Accepted
time: 307ms
memory: 33852kb

input:

61952 8 61952
31143 31143 3756 34556 4617 49727 3756 48229
48054 10150 10150 1113 46750 1113 11148 44687
18150 50774 34447 50642 31286 44185 50642 18150
18803 8000 20838 21039 20764 18803 20764 56246
59196 9154 49057 7963 47927 59196 59996 7963
27925 33037 27925 25590 4557 12519 33037 21779
9336 551...

output:

3756 49727 31143 4617 48229 3756 31143 34556 
11148 10150 48054 1113 10150 46750 44687 1113 
50642 31286 50774 18150 18150 34447 44185 50642 
18803 21039 20838 20764 20764 56246 8000 18803 
49057 7963 59196 47927 59996 59196 7963 9154 
27925 4557 21779 33037 25590 27925 12519 33037 
56435 9336 1425 ...

result:

ok 

Test #193:

score: 10
Accepted
time: 101ms
memory: 41652kb

input:

99995 4 99995
1 2 28571 28571
2 4 28572 28572
3 1 28573 28573
4 6 28574 28574
5 3 28575 28575
6 8 28576 28576
7 5 28577 28577
8 10 28578 28578
9 7 28579 28579
10 12 28580 28580
11 9 28581 28581
12 14 28582 28582
13 11 28583 28583
14 16 28584 28584
15 13 28585 28585
16 18 28586 28586
17 15 28587 2858...

output:

1 28571 28571 2 
2 28572 28572 4 
3 28573 1 28573 
4 28574 28574 6 
5 28575 28575 3 
6 28576 28576 8 
7 28577 5 28577 
8 28578 28578 10 
9 28579 28579 7 
10 28580 28580 12 
11 28581 9 28581 
12 28582 28582 14 
13 28583 28583 11 
14 28584 28584 16 
15 28585 13 28585 
16 28586 28586 18 
17 28587 28587...

result:

ok 

Test #194:

score: 10
Accepted
time: 103ms
memory: 40500kb

input:

99995 4 99995
1 2 2 3
57141 1 1 57141
3 4 4 7
57142 3 3 57142
5 6 6 1
57143 5 5 57143
7 8 8 11
57144 7 7 57144
9 10 10 5
57145 9 9 57145
11 12 12 15
57146 11 11 57146
13 14 14 9
57147 13 13 57147
15 16 16 19
57148 15 15 57148
17 18 18 13
57149 17 17 57149
19 20 20 23
57150 19 19 57150
21 22 22 17
57...

output:

1 2 3 2 
57141 1 1 57141 
3 4 7 4 
57142 3 57142 3 
5 6 6 1 
57143 5 57143 5 
7 8 11 8 
57144 7 57144 7 
9 10 5 10 
57145 9 9 57145 
11 12 15 12 
57146 11 57146 11 
13 14 14 9 
57147 13 57147 13 
15 16 19 16 
57148 15 57148 15 
17 18 13 18 
57149 17 17 57149 
19 20 23 20 
57150 19 57150 19 
21 22 22...

result:

ok 

Test #195:

score: 10
Accepted
time: 96ms
memory: 41232kb

input:

99995 4 99995
71425 71425 99994 99995
71424 71424 99992 99994
71423 71423 99995 99993
71422 71422 99990 99992
71421 71421 99993 99991
71420 71420 99988 99990
71419 71419 99991 99989
71418 71418 99986 99988
71417 71417 99989 99987
71416 71416 99984 99986
71415 71415 99987 99985
71414 71414 99982 9998...

output:

71425 99994 71425 99995 
71424 99992 71424 99994 
99995 71423 71423 99993 
71422 99990 71422 99992 
71421 99993 71421 99991 
71420 99988 71420 99990 
99991 71419 71419 99989 
71418 99986 71418 99988 
71417 99989 71417 99987 
71416 99984 71416 99986 
99987 71415 71415 99985 
71414 99982 71414 99984 
...

result:

ok 

Test #196:

score: 10
Accepted
time: 40ms
memory: 32720kb

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 
1 3 
7 6 
10 5 
4 6 
9 9 
8 4 
9 2 
6 1 
7 10 
10 1 
9 7 
6 9 
6 9 
3 10 
10 10 
2 6 
7 7 
5 6 
8 3 
4 4 
2 5 
5 8 
8 2 
10 9 
3 8 
4 7 
2 2 
9 8 
8 10 
8 9 
1 2 
1 5 
4 7 
9 4 
6 9 
10 8 
2 4 
3 6 
4 1 
10 2 
5 3 
7 10 
1 7 
10 4 
6 6 
4 1 
8...

result:

ok 

Test #197:

score: 10
Accepted
time: 87ms
memory: 41400kb

input:

99995 4 99995
99993 99994 99994 99995
42855 99995 99995 42855
99989 99992 99992 99993
42854 99993 99993 42854
99995 99990 99990 99991
42853 99991 99991 42853
99985 99988 99988 99989
42852 99989 99989 42852
99991 99986 99986 99987
42851 99987 99987 42851
99981 99984 99984 99985
42850 99985 99985 4285...

output:

99994 99993 99994 99995 
42855 99995 99995 42855 
99992 99989 99992 99993 
99993 42854 99993 42854 
99995 99990 99990 99991 
99991 42853 99991 42853 
99988 99985 99988 99989 
99989 42852 99989 42852 
99986 99991 99986 99987 
42851 99987 99987 42851 
99984 99981 99984 99985 
99985 42850 99985 42850 
...

result:

ok 

Test #198:

score: 10
Accepted
time: 91ms
memory: 41664kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

71425 85710 71425 85710 
85709 71424 71424 85709 
85708 71423 71423 85708 
85707 71422 71422 85707 
71421 85706 71421 85706 
85705 71420 71420 85705 
85704 71419 71419 85704 
85703 71418 71418 85703 
71417 85702 71417 85702 
85701 71416 71416 85701 
85700 71415 71415 85700 
85699 71414 71414 85699 
...

result:

ok 

Test #199:

score: 10
Accepted
time: 101ms
memory: 42796kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 71425 85710 
71424 85709 71424 85709 
71423 85708 71423 85708 
71422 85707 71422 85707 
85706 71421 71421 85706 
71420 85705 71420 85705 
71419 85704 71419 85704 
71418 85703 71418 85703 
85702 71417 71417 85702 
71416 85701 71416 85701 
71415 85700 71415 85700 
71414 85699 71414 85699 
...

result:

ok 

Test #200:

score: 10
Accepted
time: 79ms
memory: 42280kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
14287 28572 14287 28572 
14288 28573 14288 28573 
14289 28574 14289 28574 
14290 28575 28575 14290 
14291 28576 14291 28576 
14292 28577 14292 28577 
14293 28578 14293 28578 
14294 28579 28579 14294 
14295 28580 14295 28580 
14296 28581 14296 28581 
14297 28582 14297 28582 
...

result:

ok 

Test #201:

score: 10
Accepted
time: 85ms
memory: 42356kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
14287 28572 14287 28572 
14288 28573 14288 28573 
14289 28574 14289 28574 
14290 28575 28575 14290 
14291 28576 14291 28576 
14292 28577 14292 28577 
14293 28578 14293 28578 
14294 28579 28579 14294 
14295 28580 14295 28580 
14296 28581 14296 28581 
14297 28582 14297 28582 
...

result:

ok 

Test #202:

score: 10
Accepted
time: 102ms
memory: 26508kb

input:

62496 8 62496
1 1 2 2 17857 17857 17857 17857
2 2 4 4 17858 17858 17858 17858
3 3 1 1 17859 17859 17859 17859
4 4 6 6 17860 17860 17860 17860
5 5 3 3 17861 17861 17861 17861
6 6 8 8 17862 17862 17862 17862
7 7 5 5 17863 17863 17863 17863
8 8 10 10 17864 17864 17864 17864
9 9 7 7 17865 17865 17865 17...

output:

1 17857 2 17857 1 17857 2 17857 
2 17858 4 17858 2 17858 4 17858 
3 17859 1 17859 3 17859 1 17859 
4 17860 6 17860 4 17860 6 17860 
5 17861 3 17861 5 17861 3 17861 
6 17862 8 17862 6 17862 8 17862 
7 17863 5 17863 7 17863 5 17863 
8 17864 10 17864 8 17864 10 17864 
9 17865 7 17865 9 17865 7 17865 
1...

result:

ok 

Test #203:

score: 10
Accepted
time: 109ms
memory: 29588kb

input:

62496 8 62496
1 3 2 2 2 2 1 3
35713 35713 1 1 1 1 35713 35713
3 7 4 4 4 4 3 7
35714 35714 3 3 3 3 35714 35714
5 1 6 6 6 6 5 1
35715 35715 5 5 5 5 35715 35715
7 11 8 8 8 8 7 11
35716 35716 7 7 7 7 35716 35716
9 5 10 10 10 10 9 5
35717 35717 9 9 9 9 35717 35717
11 15 12 12 12 12 11 15
35718 35718 11 1...

output:

1 2 2 3 1 2 2 3 
35713 1 1 35713 35713 1 1 35713 
3 4 4 7 3 4 4 7 
35714 3 3 35714 35714 3 3 35714 
5 6 6 1 5 6 6 1 
35715 5 5 35715 35715 5 5 35715 
7 8 8 11 7 8 8 11 
35716 7 7 35716 35716 7 7 35716 
9 10 10 5 9 10 10 5 
35717 9 9 35717 35717 9 9 35717 
11 12 12 15 11 12 12 15 
35718 11 11 35718 3...

result:

ok 

Test #204:

score: 10
Accepted
time: 104ms
memory: 43040kb

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 
29593 43465 
49534 20236 
95890 83680 
35990 98338 
39222 14744 
72902 65183 
76527 73553 
27695 40936 
68239 96356 
66861 20211 
9499 59817 
65669 53200 
74170 53434 
44590 79062 
66321 45816 
37251 32926 
58003...

result:

ok 

Test #205:

score: 10
Accepted
time: 40ms
memory: 34188kb

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:

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

result:

ok 

Test #206:

score: 10
Accepted
time: 86ms
memory: 39084kb

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 
15159 469 
15225 23585 
11180 1824 
7967 39735 
13852 38886 
27292 33137 
21697 28740 
9887 13116 
25732 33405 
39496 9156 
31286 24569 
32138 12900 
1862 2345 
2824 18626 
19382 25016 
18721 11342 
10236 296 
37626 8228 
30418 10247 
29998 33581 
4543 21676 
39650 14279 
1957 8842 
152...

result:

ok 

Test #207:

score: 10
Accepted
time: 84ms
memory: 37212kb

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:

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

result:

ok 

Test #208:

score: 10
Accepted
time: 4ms
memory: 14304kb

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:

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

result:

ok 

Test #209:

score: 10
Accepted
time: 4ms
memory: 15108kb

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:

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

result:

ok 

Test #210:

score: 10
Accepted
time: 5ms
memory: 12872kb

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:

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

result:

ok 

Test #211:

score: 10
Accepted
time: 8ms
memory: 14900kb

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

result:

ok 

Test #212:

score: 10
Accepted
time: 501ms
memory: 55700kb

input:

62400 8 62400
5188 33581 46727 35079 3348 8641 17498 61564
1499 10536 5260 46927 42257 15268 36883 24071
31082 61126 59908 2546 59816 3061 37827 42689
23810 46627 29196 43959 32642 46947 37580 52853
5006 31921 23183 24255 36324 28016 9897 60742
23751 8953 4221 30097 16775 29090 56313 39890
51318 481...

output:

61564 35079 3348 5188 46727 17498 33581 8641 
1499 24071 46927 42257 10536 5260 36883 15268 
37827 2546 3061 61126 59908 42689 31082 59816 
23810 32642 52853 29196 37580 43959 46627 46947 
23183 28016 9897 5006 31921 24255 60742 36324 
16775 56313 23751 30097 39890 29090 8953 4221 
6725 48101 61171 ...

result:

ok 

Test #213:

score: 10
Accepted
time: 367ms
memory: 24408kb

input:

488 1024 488
361 52 274 408 68 408 418 219 150 132 313 90 10 252 93 305 248 282 313 92 89 288 275 145 132 418 40 109 120 478 12 422 307 116 20 349 73 61 397 448 170 243 146 114 339 399 219 409 479 263 324 485 355 78 250 54 250 91 177 466 469 91 237 128 329 390 97 265 279 52 274 172 11 108 436 182 48...

output:

1 458 167 314 126 129 408 5 417 112 12 356 359 201 422 114 134 274 409 288 361 136 453 43 225 383 230 174 138 420 294 482 123 149 109 104 423 223 346 162 116 349 53 71 139 118 473 177 128 172 222 455 357 50 217 97 386 318 272 124 305 295 117 379 21 86 42 69 436 103 192 313 427 101 202 243 23 121 448...

result:

ok 

Test #214:

score: 10
Accepted
time: 50ms
memory: 20228kb

input:

3125 32 500
188 390 285 364 119 368 262 180 41 62 258 496 127 290 336 432 311 497 117 169 172 53 163 87 342 412 465 289 25 437 485 193
261 209 264 96 96 379 114 262 157 150 158 483 237 397 469 124 365 376 446 467 253 50 495 212 15 39 312 239 243 144 441 244
140 250 154 190 141 44 190 420 158 245 115...

output:

258 262 485 290 437 87 172 368 117 432 390 497 289 342 285 62 364 311 41 53 163 412 465 25 496 169 336 188 119 193 180 127 
209 483 441 212 365 96 446 243 15 264 114 253 397 312 157 469 376 244 124 50 144 495 158 261 237 96 150 39 262 239 379 467 
109 308 140 41 44 141 245 273 96 235 190 71 137 158 ...

result:

ok 

Test #215:

score: 10
Accepted
time: 474ms
memory: 56496kb

input:

62500 8 62500
46488 52402 21194 39212 48030 31027 19457 19667
28217 23438 19249 49763 2901 28183 50603 11194
12227 36765 49103 12181 16487 48688 49739 61678
51394 13263 45768 56681 1581 48948 46469 40968
41220 28651 46739 56642 31209 20995 20092 15482
20680 8170 6057 46079 30434 58927 39166 24658
54...

output:

48030 19667 46488 39212 52402 21194 19457 31027 
19249 2901 11194 23438 28217 50603 49763 28183 
36765 48688 49739 49103 16487 12227 61678 12181 
13263 45768 48948 40968 51394 56681 46469 1581 
20092 28651 20995 46739 56642 31209 15482 41220 
58927 20680 46079 24658 8170 6057 30434 39166 
27192 2929...

result:

ok 

Test #216:

score: 10
Accepted
time: 482ms
memory: 55820kb

input:

62500 8 62500
5352 15707 5368 54933 21632 60466 37351 23799
46948 9283 34675 19763 9959 24375 51015 61792
13241 51137 21151 47696 38988 34663 29805 49112
31589 24811 28603 33429 38151 53298 52012 14937
25429 45252 47376 61770 59450 30664 10556 55337
16471 49621 21903 37035 17113 46640 47306 30894
45...

output:

54933 23799 15707 21632 60466 37351 5368 5352 
24375 9283 61792 34675 46948 19763 9959 51015 
29805 51137 38988 47696 13241 21151 34663 49112 
14937 38151 24811 28603 33429 52012 53298 31589 
45252 10556 59450 47376 25429 55337 30664 61770 
46640 47306 37035 16471 21903 49621 17113 30894 
43134 2239...

result:

ok 

Test #217:

score: 10
Accepted
time: 135ms
memory: 14756kb

input:

61 8192 61
60 37 60 38 60 42 60 59 14 29 60 55 60 60 13 60 41 29 15 60 60 4 60 31 60 51 60 13 60 60 27 60 60 60 50 60 60 61 29 60 27 60 60 60 43 60 60 49 38 60 60 59 60 48 4 27 29 54 1 61 60 60 34 59 60 37 13 23 60 22 11 60 26 10 60 40 61 60 38 33 60 22 23 60 60 60 23 57 60 60 43 60 42 43 3 37 46 60...

output:

1 23 60 50 41 60 60 2 60 35 60 59 60 34 60 18 60 28 60 57 60 16 60 14 60 4 60 46 36 60 8 60 60 37 60 54 60 25 60 49 60 51 60 24 60 45 60 10 60 6 60 53 60 26 60 55 60 31 60 9 60 33 5 60 1 39 45 60 60 52 60 13 32 60 60 42 60 7 60 11 60 58 60 38 60 14 60 21 3 60 60 10 60 47 22 60 30 60 60 56 60 12 60 2...

result:

ok 

Test #218:

score: 10
Accepted
time: 94ms
memory: 39556kb

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 
63660 79073 
41795 20397 
84311 1296 
3690 21178 
21052 31611 
51423 14323 
34208 82468 
2785 83835 
50594 28274 
10993 59957 
34259 64334 
73934 89407 
61083 14947 
53201 89472 
33351 61243 
76632 58718 
67464 85318 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
85776 ...

result:

ok 

Test #219:

score: 10
Accepted
time: 435ms
memory: 49200kb

input:

62500 8 62500
1631 47668 41265 13185 25144 29997 4807 14330
44766 52903 23537 27686 25928 49599 20552 27102
46072 43971 2883 50670 5227 40537 5360 31935
21192 11606 4682 7186 27459 22911 7051 53129
31978 41143 24464 48853 55408 7134 15223 54130
41468 35600 14315 7487 13955 12966 27899 22216
14216 84...

output:

47668 13185 25144 14330 29997 1631 4807 41265 
49599 20552 23537 44766 25928 27102 27686 52903 
43971 5227 5360 50670 31935 40537 46072 2883 
4682 11606 22911 53129 7051 7186 21192 27459 
31978 55408 48853 54130 41143 15223 24464 7134 
14315 27899 35600 12966 13955 22216 41468 7487 
14216 52143 1552...

result:

ok 

Test #220:

score: 10
Accepted
time: 78ms
memory: 30620kb

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 
25208 26621 
57146 28836 
18169 43915 
47842 59242 
34224 78881 
20722 38791 
89723 91046 
40306 72800 
92681 94906 
41151 7263 
76035 13332 
93928 38800 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
42596 44111 
36037 77687 
836 64592 
35187 43568 
34861 88539 
37477 22111 
85787...

result:

ok 

Test #221:

score: 10
Accepted
time: 77ms
memory: 37892kb

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 #222:

score: 10
Accepted
time: 81ms
memory: 38688kb

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:

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

result:

ok 

Subtask #10:

score: 10
Accepted

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:

100%
Accepted

Dependency #9:

100%
Accepted

Test #223:

score: 10
Accepted
time: 94ms
memory: 40140kb

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:

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

result:

ok 

Test #224:

score: 10
Accepted
time: 54ms
memory: 37900kb

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 #225:

score: 10
Accepted
time: 54ms
memory: 40008kb

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 #226:

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

input:

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

output:

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

result:

ok 

Test #227:

score: 10
Accepted
time: 8ms
memory: 14396kb

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:

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

result:

ok 

Test #228:

score: 10
Accepted
time: 3ms
memory: 14060kb

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:

1 8 1 5 1 6 8 4 1 6 1 4 1 8 6 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 4 1 8 6 5 1 4 8 6 1 8 6 5 1 6 1 8 1 8 6 4 1 8 1 4 1 6 8 5 1 6 1 8 1 8 6 4 1 8 6 5 1 8 6 4 1 8 1 6 1 8 6 4 1 5 1 8 1 6 8 4 1 6 1 4 1 8 6 5 1 8 6 5 1 8 6 4 1 8 1 5 1 6 8 4 1 6 1 8 1 8 6 4 1 6 1 4 1 8 ...

result:

ok 

Test #229:

score: 10
Accepted
time: 7ms
memory: 14748kb

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:

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

result:

ok 

Test #230:

score: 10
Accepted
time: 5ms
memory: 14756kb

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 
1 2 
1 1 
2 1 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
1 2 
1 1 
2 1 
1 2 
1 1 
2 1 
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 #231:

score: 10
Accepted
time: 7ms
memory: 15644kb

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:

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

result:

ok 

Test #232:

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

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:

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

result:

ok 

Test #233:

score: 10
Accepted
time: 8ms
memory: 13032kb

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:

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

result:

ok 

Test #234:

score: 10
Accepted
time: 76ms
memory: 36784kb

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:

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

result:

ok 

Test #235:

score: 10
Accepted
time: 4ms
memory: 12348kb

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:

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

result:

ok 

Test #236:

score: 10
Accepted
time: 4ms
memory: 14912kb

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:

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

result:

ok 

Test #237:

score: 10
Accepted
time: 6ms
memory: 14672kb

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

result:

ok 

Test #238:

score: 10
Accepted
time: 6ms
memory: 13344kb

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:

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

result:

ok 

Test #239:

score: 10
Accepted
time: 6ms
memory: 15300kb

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 #240:

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

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 #241:

score: 10
Accepted
time: 397ms
memory: 52320kb

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:

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

result:

ok 

Test #242:

score: 10
Accepted
time: 342ms
memory: 22172kb

input:

488 1024 488
437 386 352 3 204 235 111 327 270 195 436 108 324 319 398 484 177 270 133 272 484 202 67 380 1 215 36 327 104 412 432 67 157 455 286 196 62 262 437 4 289 108 272 402 136 265 291 48 135 182 385 319 112 186 70 50 273 196 231 195 17 319 178 270 132 424 78 406 324 346 57 71 97 186 396 422 3...

output:

1 484 290 360 238 259 374 156 272 133 84 470 202 386 52 357 402 196 467 36 56 74 396 256 195 180 298 86 48 78 35 69 415 255 158 406 327 416 62 170 45 356 373 317 333 179 142 258 172 231 205 324 295 44 18 273 268 319 361 468 217 471 223 173 415 274 478 271 229 303 240 254 347 350 299 215 76 218 353 4...

result:

ok 

Test #243:

score: 10
Accepted
time: 20ms
memory: 13996kb

input:

6 16384 6
2 5 1 6 5 2 5 1 6 1 5 5 6 5 5 6 2 6 2 1 6 6 5 5 6 5 2 2 1 1 1 6 5 1 5 6 6 2 6 1 2 6 6 2 2 1 6 6 6 1 5 5 1 5 5 6 2 5 1 5 1 5 1 2 5 1 1 6 5 6 5 2 1 1 6 1 6 6 5 5 5 1 5 6 2 5 6 5 5 6 6 6 2 5 5 6 2 5 6 1 5 6 6 2 2 5 1 2 5 5 6 5 6 6 1 1 2 2 5 5 6 5 6 5 5 1 6 6 6 6 1 6 5 6 5 2 6 6 6 5 5 6 6 6 6 ...

output:

1 6 5 6 1 2 5 6 1 5 6 2 6 5 6 5 1 5 6 2 1 2 5 6 1 5 6 5 5 6 6 2 1 5 5 6 1 2 5 6 1 5 6 2 5 6 6 2 1 5 6 2 5 6 5 6 1 5 5 6 6 2 5 6 1 5 5 6 1 6 5 2 1 5 5 6 5 6 6 2 1 5 5 6 1 6 5 2 1 5 6 2 6 2 5 6 1 5 5 6 1 6 5 2 1 5 6 2 6 2 5 6 1 5 5 6 5 6 6 2 1 5 6 2 6 2 5 6 1 5 5 6 1 6 5 2 1 5 5 6 5 6 6 2 1 5 5 6 1 6 ...

result:

ok 

Test #244:

score: 10
Accepted
time: 84ms
memory: 21076kb

input:

6035 32 3126
2384 1507 1419 2790 466 3034 613 391 1142 1913 2728 1770 1249 2719 457 1720 2670 541 568 1711 1147 1498 2929 1920 2067 351 2089 1076 3001 2562 2615 1630
1719 1848 849 3098 1026 1016 2612 2228 526 2395 1808 1898 1626 2249 2857 1473 2360 2448 1450 1045 55 2166 2597 1586 1181 540 789 612 1...

output:

2615 3001 391 1507 466 1147 1419 541 1913 2719 2067 457 2728 568 1076 1920 1249 1720 2929 351 1498 1770 1711 2562 1630 3034 2790 2670 2384 2089 613 1142 
612 1719 1026 1045 2448 2166 540 1626 1808 2828 2857 849 841 2395 2597 2612 1586 2228 789 1450 1898 335 526 1181 55 2360 1579 3098 2249 1473 1016 ...

result:

ok 

Test #245:

score: 10
Accepted
time: 83ms
memory: 34960kb

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:

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

result:

ok 

Test #246:

score: 10
Accepted
time: 250ms
memory: 19452kb

input:

442 1024 442
204 189 272 54 225 232 246 111 211 39 140 31 133 213 40 172 5 229 225 147 176 81 31 108 40 148 128 210 21 262 105 163 228 247 259 161 184 211 3 211 261 277 70 186 27 195 89 282 233 258 169 215 154 267 21 239 264 213 91 131 295 39 163 282 254 63 286 282 9 116 139 285 76 206 85 233 73 180...

output:

1 95 239 41 278 281 206 115 42 36 45 126 268 180 70 208 102 69 67 262 161 261 247 147 28 20 94 93 30 155 85 90 89 119 112 238 140 204 83 298 232 289 156 291 269 141 6 259 179 51 105 162 244 222 123 225 260 194 26 133 33 144 40 255 299 285 11 202 211 15 164 207 197 21 108 296 27 297 266 254 187 215 2...

result:

ok 

Test #247:

score: 10
Accepted
time: 355ms
memory: 44824kb

input:

59767 8 50000
14021 37442 6924 2683 26908 28108 49331 4157
37602 8443 19287 12234 4215 29554 33860 1201
2453 34206 48003 47930 30310 48979 24906 2040
19079 30112 42351 26155 23394 37361 37618 35224
18576 29106 48671 22449 25578 19435 4011 7931
7174 13442 3382 24117 23309 31964 19031 45122
33083 3854...

output:

28108 4157 37442 2683 26908 14021 6924 49331 
8443 33860 29554 19287 1201 37602 4215 12234 
47930 2453 2040 48979 24906 30310 34206 48003 
26155 30112 35224 23394 42351 37361 19079 37618 
18576 19435 22449 7931 4011 25578 29106 48671 
19031 3382 13442 23309 24117 31964 7174 45122 
45872 41121 49016 ...

result:

ok 

Test #248:

score: 10
Accepted
time: 428ms
memory: 53172kb

input:

62500 8 62500
51504 53517 18444 47810 55743 52115 39033 39945
39582 40153 48723 405 57762 57932 38589 34957
46544 29639 46926 5502 36080 4497 12837 5415
40364 54270 15841 56968 20512 49512 23271 29535
32613 29997 43963 8109 43144 40423 38621 31273
32431 16718 11192 30443 19278 38857 30834 60796
1958...

output:

39945 51504 52115 18444 39033 55743 47810 53517 
40153 34957 48723 57932 39582 405 57762 38589 
46544 36080 12837 5502 29639 4497 46926 5415 
29535 54270 15841 49512 56968 23271 40364 20512 
43144 29997 31273 8109 40423 32613 38621 43963 
19278 30834 32431 11192 38857 30443 60796 16718 
44729 16527 ...

result:

ok 

Test #249:

score: 10
Accepted
time: 128ms
memory: 14780kb

input:

61 8192 61
47 47 47 47 47 36 36 47 36 36 36 47 36 47 36 47 47 36 36 36 47 36 36 36 47 36 47 47 47 36 47 36 36 47 47 36 47 47 47 47 47 47 36 36 36 47 47 21 36 36 36 36 47 47 36 47 36 47 47 47 36 47 47 47 47 36 36 47 36 47 36 47 47 36 47 47 36 47 47 36 36 36 36 36 47 36 36 36 36 47 36 47 36 47 47 36 3...

output:

1 47 47 36 36 47 36 47 47 36 47 36 47 36 36 47 36 47 47 36 36 47 47 36 36 47 12 36 47 36 36 47 47 36 47 36 36 47 36 47 47 29 47 36 47 36 36 47 47 36 47 36 36 47 36 47 47 36 36 47 36 47 36 47 36 47 21 47 36 47 47 36 36 47 36 47 47 36 36 47 47 36 36 47 47 36 47 36 36 28 47 36 47 36 36 47 47 36 47 36 4...

result:

ok 

Test #250:

score: 10
Accepted
time: 106ms
memory: 15220kb

input:

50 8192 50
40 29 20 40 40 40 20 40 40 40 40 49 20 20 40 40 20 40 40 20 20 20 40 20 40 40 20 20 40 40 40 40 40 20 40 40 40 40 40 40 20 40 20 40 20 40 40 20 40 40 20 20 40 20 40 40 20 40 40 40 20 19 40 40 40 40 20 40 20 40 20 20 20 20 20 20 20 40 20 40 20 20 20 40 40 40 40 40 40 40 20 20 40 20 20 40 4...

output:

1 20 40 20 20 40 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 20 40 40 20 40 24 40 20 40 20 40 20 40 20 20 40 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 20 40 40 20 40 29 40 20 20 40 40 46 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 40 20 9 20 40 20 40 20 40 20 40 20 20 40 20...

result:

ok 

Test #251:

score: 10
Accepted
time: 285ms
memory: 42376kb

input:

56000 8 50000
38540 29053 29109 38746 29288 38450 43383 32332
14057 662 19282 8910 49216 18920 32722 25913
4461 24280 3328 17870 569 37854 3246 27991
35958 21836 18035 12840 25641 36792 21982 33634
6456 49901 35635 42812 24541 44145 8939 11926
29442 26462 18739 27152 42797 5777 15117 19193
40156 501...

output:

38450 32332 38746 29053 38540 29288 29109 43383 
25913 49216 19282 14057 18920 32722 662 8910 
17870 4461 37854 27991 569 3328 24280 3246 
36792 33634 21836 18035 35958 12840 21982 25641 
42812 24541 6456 11926 49901 35635 44145 8939 
26462 27152 5777 19193 18739 42797 29442 15117 
34145 45047 40156...

result:

ok 

Test #252:

score: 10
Accepted
time: 307ms
memory: 31904kb

input:

61952 8 61952
31143 31143 3756 34556 4617 49727 3756 48229
48054 10150 10150 1113 46750 1113 11148 44687
18150 50774 34447 50642 31286 44185 50642 18150
18803 8000 20838 21039 20764 18803 20764 56246
59196 9154 49057 7963 47927 59196 59996 7963
27925 33037 27925 25590 4557 12519 33037 21779
9336 551...

output:

3756 49727 31143 4617 48229 3756 31143 34556 
11148 10150 48054 1113 10150 46750 44687 1113 
50642 31286 50774 18150 18150 34447 44185 50642 
18803 21039 20838 20764 20764 56246 8000 18803 
49057 7963 59196 47927 59996 59196 7963 9154 
27925 4557 21779 33037 25590 27925 12519 33037 
56435 9336 1425 ...

result:

ok 

Test #253:

score: 10
Accepted
time: 94ms
memory: 41860kb

input:

99995 4 99995
1 2 28571 28571
2 4 28572 28572
3 1 28573 28573
4 6 28574 28574
5 3 28575 28575
6 8 28576 28576
7 5 28577 28577
8 10 28578 28578
9 7 28579 28579
10 12 28580 28580
11 9 28581 28581
12 14 28582 28582
13 11 28583 28583
14 16 28584 28584
15 13 28585 28585
16 18 28586 28586
17 15 28587 2858...

output:

1 28571 28571 2 
2 28572 28572 4 
3 28573 1 28573 
4 28574 28574 6 
5 28575 28575 3 
6 28576 28576 8 
7 28577 5 28577 
8 28578 28578 10 
9 28579 28579 7 
10 28580 28580 12 
11 28581 9 28581 
12 28582 28582 14 
13 28583 28583 11 
14 28584 28584 16 
15 28585 13 28585 
16 28586 28586 18 
17 28587 28587...

result:

ok 

Test #254:

score: 10
Accepted
time: 91ms
memory: 43596kb

input:

99995 4 99995
1 2 2 3
57141 1 1 57141
3 4 4 7
57142 3 3 57142
5 6 6 1
57143 5 5 57143
7 8 8 11
57144 7 7 57144
9 10 10 5
57145 9 9 57145
11 12 12 15
57146 11 11 57146
13 14 14 9
57147 13 13 57147
15 16 16 19
57148 15 15 57148
17 18 18 13
57149 17 17 57149
19 20 20 23
57150 19 19 57150
21 22 22 17
57...

output:

1 2 3 2 
57141 1 1 57141 
3 4 7 4 
57142 3 57142 3 
5 6 6 1 
57143 5 57143 5 
7 8 11 8 
57144 7 57144 7 
9 10 5 10 
57145 9 9 57145 
11 12 15 12 
57146 11 57146 11 
13 14 14 9 
57147 13 57147 13 
15 16 19 16 
57148 15 57148 15 
17 18 13 18 
57149 17 17 57149 
19 20 23 20 
57150 19 57150 19 
21 22 22...

result:

ok 

Test #255:

score: 10
Accepted
time: 93ms
memory: 42508kb

input:

99995 4 99995
71425 71425 99994 99995
71424 71424 99992 99994
71423 71423 99995 99993
71422 71422 99990 99992
71421 71421 99993 99991
71420 71420 99988 99990
71419 71419 99991 99989
71418 71418 99986 99988
71417 71417 99989 99987
71416 71416 99984 99986
71415 71415 99987 99985
71414 71414 99982 9998...

output:

71425 99994 71425 99995 
71424 99992 71424 99994 
99995 71423 71423 99993 
71422 99990 71422 99992 
71421 99993 71421 99991 
71420 99988 71420 99990 
99991 71419 71419 99989 
71418 99986 71418 99988 
71417 99989 71417 99987 
71416 99984 71416 99986 
99987 71415 71415 99985 
71414 99982 71414 99984 
...

result:

ok 

Test #256:

score: 10
Accepted
time: 40ms
memory: 34704kb

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 
1 3 
7 6 
10 5 
4 6 
9 9 
8 4 
9 2 
6 1 
7 10 
10 1 
9 7 
6 9 
6 9 
3 10 
10 10 
2 6 
7 7 
5 6 
8 3 
4 4 
2 5 
5 8 
8 2 
10 9 
3 8 
4 7 
2 2 
9 8 
8 10 
8 9 
1 2 
1 5 
4 7 
9 4 
6 9 
10 8 
2 4 
3 6 
4 1 
10 2 
5 3 
7 10 
1 7 
10 4 
6 6 
4 1 
8...

result:

ok 

Test #257:

score: 10
Accepted
time: 87ms
memory: 43232kb

input:

99995 4 99995
99993 99994 99994 99995
42855 99995 99995 42855
99989 99992 99992 99993
42854 99993 99993 42854
99995 99990 99990 99991
42853 99991 99991 42853
99985 99988 99988 99989
42852 99989 99989 42852
99991 99986 99986 99987
42851 99987 99987 42851
99981 99984 99984 99985
42850 99985 99985 4285...

output:

99994 99993 99994 99995 
42855 99995 99995 42855 
99992 99989 99992 99993 
99993 42854 99993 42854 
99995 99990 99990 99991 
99991 42853 99991 42853 
99988 99985 99988 99989 
99989 42852 99989 42852 
99986 99991 99986 99987 
42851 99987 99987 42851 
99984 99981 99984 99985 
99985 42850 99985 42850 
...

result:

ok 

Test #258:

score: 10
Accepted
time: 92ms
memory: 43952kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

71425 85710 71425 85710 
85709 71424 71424 85709 
85708 71423 71423 85708 
85707 71422 71422 85707 
71421 85706 71421 85706 
85705 71420 71420 85705 
85704 71419 71419 85704 
85703 71418 71418 85703 
71417 85702 71417 85702 
85701 71416 71416 85701 
85700 71415 71415 85700 
85699 71414 71414 85699 
...

result:

ok 

Test #259:

score: 10
Accepted
time: 91ms
memory: 44480kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 71425 85710 
71424 85709 71424 85709 
71423 85708 71423 85708 
71422 85707 71422 85707 
85706 71421 71421 85706 
71420 85705 71420 85705 
71419 85704 71419 85704 
71418 85703 71418 85703 
85702 71417 71417 85702 
71416 85701 71416 85701 
71415 85700 71415 85700 
71414 85699 71414 85699 
...

result:

ok 

Test #260:

score: 10
Accepted
time: 91ms
memory: 43464kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
14287 28572 14287 28572 
14288 28573 14288 28573 
14289 28574 14289 28574 
14290 28575 28575 14290 
14291 28576 14291 28576 
14292 28577 14292 28577 
14293 28578 14293 28578 
14294 28579 28579 14294 
14295 28580 14295 28580 
14296 28581 14296 28581 
14297 28582 14297 28582 
...

result:

ok 

Test #261:

score: 10
Accepted
time: 92ms
memory: 40692kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
14287 28572 14287 28572 
14288 28573 14288 28573 
14289 28574 14289 28574 
14290 28575 28575 14290 
14291 28576 14291 28576 
14292 28577 14292 28577 
14293 28578 14293 28578 
14294 28579 28579 14294 
14295 28580 14295 28580 
14296 28581 14296 28581 
14297 28582 14297 28582 
...

result:

ok 

Test #262:

score: 10
Accepted
time: 99ms
memory: 28140kb

input:

62496 8 62496
1 1 2 2 17857 17857 17857 17857
2 2 4 4 17858 17858 17858 17858
3 3 1 1 17859 17859 17859 17859
4 4 6 6 17860 17860 17860 17860
5 5 3 3 17861 17861 17861 17861
6 6 8 8 17862 17862 17862 17862
7 7 5 5 17863 17863 17863 17863
8 8 10 10 17864 17864 17864 17864
9 9 7 7 17865 17865 17865 17...

output:

1 17857 2 17857 1 17857 2 17857 
2 17858 4 17858 2 17858 4 17858 
3 17859 1 17859 3 17859 1 17859 
4 17860 6 17860 4 17860 6 17860 
5 17861 3 17861 5 17861 3 17861 
6 17862 8 17862 6 17862 8 17862 
7 17863 5 17863 7 17863 5 17863 
8 17864 10 17864 8 17864 10 17864 
9 17865 7 17865 9 17865 7 17865 
1...

result:

ok 

Test #263:

score: 10
Accepted
time: 110ms
memory: 28448kb

input:

62496 8 62496
1 3 2 2 2 2 1 3
35713 35713 1 1 1 1 35713 35713
3 7 4 4 4 4 3 7
35714 35714 3 3 3 3 35714 35714
5 1 6 6 6 6 5 1
35715 35715 5 5 5 5 35715 35715
7 11 8 8 8 8 7 11
35716 35716 7 7 7 7 35716 35716
9 5 10 10 10 10 9 5
35717 35717 9 9 9 9 35717 35717
11 15 12 12 12 12 11 15
35718 35718 11 1...

output:

1 2 2 3 1 2 2 3 
35713 1 1 35713 35713 1 1 35713 
3 4 4 7 3 4 4 7 
35714 3 3 35714 35714 3 3 35714 
5 6 6 1 5 6 6 1 
35715 5 5 35715 35715 5 5 35715 
7 8 8 11 7 8 8 11 
35716 7 7 35716 35716 7 7 35716 
9 10 10 5 9 10 10 5 
35717 9 9 35717 35717 9 9 35717 
11 12 12 15 11 12 12 15 
35718 11 11 35718 3...

result:

ok 

Test #264:

score: 10
Accepted
time: 108ms
memory: 43044kb

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 
29593 43465 
49534 20236 
95890 83680 
35990 98338 
39222 14744 
72902 65183 
76527 73553 
27695 40936 
68239 96356 
66861 20211 
9499 59817 
65669 53200 
74170 53434 
44590 79062 
66321 45816 
37251 32926 
58003...

result:

ok 

Test #265:

score: 10
Accepted
time: 46ms
memory: 36056kb

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:

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

result:

ok 

Test #266:

score: 10
Accepted
time: 93ms
memory: 39036kb

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 
15159 469 
15225 23585 
11180 1824 
7967 39735 
13852 38886 
27292 33137 
21697 28740 
9887 13116 
25732 33405 
39496 9156 
31286 24569 
32138 12900 
1862 2345 
2824 18626 
19382 25016 
18721 11342 
10236 296 
37626 8228 
30418 10247 
29998 33581 
4543 21676 
39650 14279 
1957 8842 
152...

result:

ok 

Test #267:

score: 10
Accepted
time: 82ms
memory: 37024kb

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:

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

result:

ok 

Test #268:

score: 10
Accepted
time: 5ms
memory: 14628kb

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:

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

result:

ok 

Test #269:

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

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:

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

result:

ok 

Test #270:

score: 10
Accepted
time: 4ms
memory: 14900kb

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:

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

result:

ok 

Test #271:

score: 10
Accepted
time: 4ms
memory: 15192kb

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

result:

ok 

Test #272:

score: 10
Accepted
time: 493ms
memory: 56184kb

input:

62400 8 62400
5188 33581 46727 35079 3348 8641 17498 61564
1499 10536 5260 46927 42257 15268 36883 24071
31082 61126 59908 2546 59816 3061 37827 42689
23810 46627 29196 43959 32642 46947 37580 52853
5006 31921 23183 24255 36324 28016 9897 60742
23751 8953 4221 30097 16775 29090 56313 39890
51318 481...

output:

61564 35079 3348 5188 46727 17498 33581 8641 
1499 24071 46927 42257 10536 5260 36883 15268 
37827 2546 3061 61126 59908 42689 31082 59816 
23810 32642 52853 29196 37580 43959 46627 46947 
23183 28016 9897 5006 31921 24255 60742 36324 
16775 56313 23751 30097 39890 29090 8953 4221 
6725 48101 61171 ...

result:

ok 

Test #273:

score: 10
Accepted
time: 382ms
memory: 26280kb

input:

488 1024 488
361 52 274 408 68 408 418 219 150 132 313 90 10 252 93 305 248 282 313 92 89 288 275 145 132 418 40 109 120 478 12 422 307 116 20 349 73 61 397 448 170 243 146 114 339 399 219 409 479 263 324 485 355 78 250 54 250 91 177 466 469 91 237 128 329 390 97 265 279 52 274 172 11 108 436 182 48...

output:

1 458 167 314 126 129 408 5 417 112 12 356 359 201 422 114 134 274 409 288 361 136 453 43 225 383 230 174 138 420 294 482 123 149 109 104 423 223 346 162 116 349 53 71 139 118 473 177 128 172 222 455 357 50 217 97 386 318 272 124 305 295 117 379 21 86 42 69 436 103 192 313 427 101 202 243 23 121 448...

result:

ok 

Test #274:

score: 10
Accepted
time: 47ms
memory: 20424kb

input:

3125 32 500
188 390 285 364 119 368 262 180 41 62 258 496 127 290 336 432 311 497 117 169 172 53 163 87 342 412 465 289 25 437 485 193
261 209 264 96 96 379 114 262 157 150 158 483 237 397 469 124 365 376 446 467 253 50 495 212 15 39 312 239 243 144 441 244
140 250 154 190 141 44 190 420 158 245 115...

output:

258 262 485 290 437 87 172 368 117 432 390 497 289 342 285 62 364 311 41 53 163 412 465 25 496 169 336 188 119 193 180 127 
209 483 441 212 365 96 446 243 15 264 114 253 397 312 157 469 376 244 124 50 144 495 158 261 237 96 150 39 262 239 379 467 
109 308 140 41 44 141 245 273 96 235 190 71 137 158 ...

result:

ok 

Test #275:

score: 10
Accepted
time: 477ms
memory: 56784kb

input:

62500 8 62500
46488 52402 21194 39212 48030 31027 19457 19667
28217 23438 19249 49763 2901 28183 50603 11194
12227 36765 49103 12181 16487 48688 49739 61678
51394 13263 45768 56681 1581 48948 46469 40968
41220 28651 46739 56642 31209 20995 20092 15482
20680 8170 6057 46079 30434 58927 39166 24658
54...

output:

48030 19667 46488 39212 52402 21194 19457 31027 
19249 2901 11194 23438 28217 50603 49763 28183 
36765 48688 49739 49103 16487 12227 61678 12181 
13263 45768 48948 40968 51394 56681 46469 1581 
20092 28651 20995 46739 56642 31209 15482 41220 
58927 20680 46079 24658 8170 6057 30434 39166 
27192 2929...

result:

ok 

Test #276:

score: 10
Accepted
time: 461ms
memory: 56864kb

input:

62500 8 62500
5352 15707 5368 54933 21632 60466 37351 23799
46948 9283 34675 19763 9959 24375 51015 61792
13241 51137 21151 47696 38988 34663 29805 49112
31589 24811 28603 33429 38151 53298 52012 14937
25429 45252 47376 61770 59450 30664 10556 55337
16471 49621 21903 37035 17113 46640 47306 30894
45...

output:

54933 23799 15707 21632 60466 37351 5368 5352 
24375 9283 61792 34675 46948 19763 9959 51015 
29805 51137 38988 47696 13241 21151 34663 49112 
14937 38151 24811 28603 33429 52012 53298 31589 
45252 10556 59450 47376 25429 55337 30664 61770 
46640 47306 37035 16471 21903 49621 17113 30894 
43134 2239...

result:

ok 

Test #277:

score: 10
Accepted
time: 128ms
memory: 15992kb

input:

61 8192 61
60 37 60 38 60 42 60 59 14 29 60 55 60 60 13 60 41 29 15 60 60 4 60 31 60 51 60 13 60 60 27 60 60 60 50 60 60 61 29 60 27 60 60 60 43 60 60 49 38 60 60 59 60 48 4 27 29 54 1 61 60 60 34 59 60 37 13 23 60 22 11 60 26 10 60 40 61 60 38 33 60 22 23 60 60 60 23 57 60 60 43 60 42 43 3 37 46 60...

output:

1 23 60 50 41 60 60 2 60 35 60 59 60 34 60 18 60 28 60 57 60 16 60 14 60 4 60 46 36 60 8 60 60 37 60 54 60 25 60 49 60 51 60 24 60 45 60 10 60 6 60 53 60 26 60 55 60 31 60 9 60 33 5 60 1 39 45 60 60 52 60 13 32 60 60 42 60 7 60 11 60 58 60 38 60 14 60 21 3 60 60 10 60 47 22 60 30 60 60 56 60 12 60 2...

result:

ok 

Test #278:

score: 10
Accepted
time: 68ms
memory: 37584kb

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 
63660 79073 
41795 20397 
84311 1296 
3690 21178 
21052 31611 
51423 14323 
34208 82468 
2785 83835 
50594 28274 
10993 59957 
34259 64334 
73934 89407 
61083 14947 
53201 89472 
33351 61243 
76632 58718 
67464 85318 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
85776 ...

result:

ok 

Test #279:

score: 10
Accepted
time: 452ms
memory: 47860kb

input:

62500 8 62500
1631 47668 41265 13185 25144 29997 4807 14330
44766 52903 23537 27686 25928 49599 20552 27102
46072 43971 2883 50670 5227 40537 5360 31935
21192 11606 4682 7186 27459 22911 7051 53129
31978 41143 24464 48853 55408 7134 15223 54130
41468 35600 14315 7487 13955 12966 27899 22216
14216 84...

output:

47668 13185 25144 14330 29997 1631 4807 41265 
49599 20552 23537 44766 25928 27102 27686 52903 
43971 5227 5360 50670 31935 40537 46072 2883 
4682 11606 22911 53129 7051 7186 21192 27459 
31978 55408 48853 54130 41143 15223 24464 7134 
14315 27899 35600 12966 13955 22216 41468 7487 
14216 52143 1552...

result:

ok 

Test #280:

score: 10
Accepted
time: 2ms
memory: 14340kb

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
2 3 
3 2 

result:

ok 

Test #281:

score: 10
Accepted
time: 4ms
memory: 11980kb

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 
12 5 
9 20 
4 2 
17 4 
7 15 
2 9 
5 5 
15 13 
5 19 
5 3 
19 10 
5 8 
10 7 
11 9 
3 16 
18 7 
9 5 
8 3 
18 4 

result:

ok 

Test #282:

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

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:

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

result:

ok 

Test #283:

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

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 
7 8 
6 4 
4 7 
2 6 
6 4 
1 3 
3 2 
8 3 
6 7 
1 5 
3 6 
5 2 
4 1 
2 2 
2 6 
6 3 
5 2 
3 5 
3 3 

result:

ok 

Test #284:

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

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:

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

result:

ok 

Test #285:

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

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 
5 12 
10 14 
5 8 
11 17 
16 11 
13 3 
12 9 
17 4 
6 1 
4 6 
19 13 
18 5 

result:

ok 

Test #286:

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

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 
5 8 
3 5 
1 4 
10 9 
17 7 
4 2 
14 10 
6 16 
2 1 
16 11 
8 3 
15 13 
18 17 
11 6 

result:

ok 

Test #287:

score: 10
Accepted
time: 44ms
memory: 31372kb

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 
99759 66596 
12116 82137 
4043 92591 
134 72622 
47060 43432 
74386 48543 
12398 24648 
30807 15658 
99813 44636 
10967 53782 
99129 43783 
31224 17380 
90445 1594 
4363 11935 
83427 79197 
64946 57698 
76058 55536 
25332 10458 
31325 66313 
77601 43931 
23727 ...

result:

ok 

Test #288:

score: 10
Accepted
time: 3ms
memory: 14532kb

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:

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

result:

ok 

Test #289:

score: 10
Accepted
time: 71ms
memory: 29192kb

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 
25208 26621 
57146 28836 
18169 43915 
47842 59242 
34224 78881 
20722 38791 
89723 91046 
40306 72800 
92681 94906 
41151 7263 
76035 13332 
93928 38800 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
42596 44111 
36037 77687 
836 64592 
35187 43568 
34861 88539 
37477 22111 
85787...

result:

ok 

Test #290:

score: 10
Accepted
time: 63ms
memory: 15560kb

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:

21831 89273 83125 82535 39983 72373 73464 28260 72929 77705 13035 59023 15331 81808 80795 83931 77980 57260 97490 95586 9817 47154 20263 53954 19722 39993 64395 96115 25161 61419 89129 95228 14598 43890 26960 80088 39461 91469 41671 30768 75728 82317 52468 53271 29144 68165 91324 77452 34026 39136 4...

result:

ok 

Test #291:

score: 10
Accepted
time: 705ms
memory: 19172kb

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:

2 16190 29672 81221 3312 24558 7411 66068 2809 14188 30519 89171 75012 40730 50758 19617 67184 85957 89623 57009 26518 21809 75380 83405 67967 44954 88520 26853 29158 70973 34236 51599 73856 51063 68493 78579 36785 38693 53601 19007 26251 52690 64148 72463 31787 70367 55236 60894 73392 66739 49296 1...

result:

ok 

Test #292:

score: 10
Accepted
time: 11ms
memory: 15312kb

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:

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

result:

ok 

Test #293:

score: 10
Accepted
time: 6ms
memory: 15196kb

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:

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

result:

ok 

Test #294:

score: 10
Accepted
time: 581ms
memory: 58512kb

input:

62400 8 100000
7324 34007 89967 39540 19251 93843 18929 39731
47872 52435 11015 51213 36149 92229 79678 8542
68819 93790 26712 81439 16048 748 28856 44128
83761 80415 55213 58021 26346 26581 43271 52217
62896 62612 84933 73003 39705 52869 89876 35829
50243 95931 95455 39446 31424 11301 5835 65363
21...

output:

89967 39731 19251 7324 18929 93843 39540 34007 
36149 47872 11015 79678 52435 51213 92229 8542 
44128 16048 93790 81439 68819 26712 748 28856 
80415 43271 55213 26346 58021 52217 83761 26581 
73003 35829 62612 39705 52869 84933 62896 89876 
50243 65363 95455 11301 39446 31424 5835 95931 
13375 51379...

result:

ok 

Test #295:

score: 10
Accepted
time: 532ms
memory: 36460kb

input:

488 1024 2000
681 1638 782 301 1645 521 1389 150 1560 38 597 1423 1415 755 1392 1386 467 1209 1131 1897 71 449 1862 642 218 1691 1323 1598 437 721 535 484 244 1505 1914 30 64 387 1458 372 1995 1284 529 339 245 556 539 976 1933 1357 211 780 1894 684 1512 479 1356 1882 1981 1586 1467 1219 205 1296 178...

output:

1641 429 1968 1948 1657 725 684 1035 1086 476 457 1903 19 1247 667 1886 411 106 1122 1705 420 806 953 372 1842 1822 1935 1219 388 1848 1060 406 543 140 1855 114 300 839 66 999 218 1667 1517 1877 1110 109 299 1536 35 1576 1715 519 995 1505 1597 797 108 424 1852 173 1820 230 569 1615 1291 535 1284 897...

result:

ok 

Test #296:

score: 10
Accepted
time: 152ms
memory: 15808kb

input:

61 8192 200
99 170 170 170 170 99 99 170 170 170 99 170 99 170 170 99 99 170 170 170 99 99 99 170 99 99 99 104 170 170 162 170 99 170 170 170 170 99 170 99 170 99 99 170 99 170 170 99 170 99 99 99 170 99 170 99 99 99 170 99 170 99 170 170 170 99 99 170 170 170 99 99 99 170 170 170 99 170 170 99 99 9...

output:

1 99 99 170 99 170 99 170 170 99 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 170 92 99 170 170 99 99 170 99 170 170 99 99 170 99 170 99 170 99 170 99 170 99 170 170 148 99 170 99 170 99 170 99 170 99 170 99 170 99 170 99 170 ...

result:

ok 

Test #297:

score: 10
Accepted
time: 135ms
memory: 15884kb

input:

61 8192 70
11 67 11 65 65 65 11 11 65 11 65 11 11 65 65 11 11 11 11 11 65 65 65 11 11 11 11 65 11 65 65 11 6 11 65 65 11 65 65 65 65 11 65 11 65 11 65 65 65 11 65 65 11 11 65 65 11 65 11 11 65 65 65 11 52 20 11 11 11 11 11 65 11 65 61 65 65 65 65 11 65 11 65 11 11 65 65 11 11 65 65 11 40 65 11 65 11...

output:

1 65 65 11 65 11 11 65 65 11 11 65 65 11 11 65 65 11 65 11 65 11 52 11 65 11 65 11 65 11 65 11 65 11 65 11 65 11 65 11 65 46 65 11 65 11 65 11 65 11 11 65 65 11 22 11 65 11 11 65 11 65 65 11 11 65 65 11 65 11 65 11 18 11 65 11 65 11 11 65 65 11 11 65 65 11 65 11 11 65 65 11 65 11 65 11 65 11 65 11 6...

result:

ok 

Test #298:

score: 10
Accepted
time: 130ms
memory: 15048kb

input:

61 8192 80
74 74 74 44 74 74 74 74 44 74 74 74 44 44 74 74 74 44 74 74 74 44 74 74 44 44 74 74 44 74 44 44 4 74 44 44 44 74 74 74 44 33 74 74 74 44 74 44 74 74 74 74 74 74 74 44 44 74 74 74 44 44 44 74 16 44 44 74 74 44 74 44 44 74 44 74 74 44 74 44 44 44 74 37 44 44 74 74 44 74 44 44 74 74 44 74 74...

output:

1 44 44 74 44 74 74 44 44 74 74 44 74 44 74 44 26 74 74 44 74 44 74 44 74 44 74 44 74 44 44 74 44 74 74 44 44 74 44 74 74 44 74 44 74 44 72 74 74 44 74 44 44 74 44 74 44 74 74 44 44 74 44 4 74 44 74 44 74 44 44 74 70 44 74 44 74 44 44 74 74 44 74 44 74 44 44 74 74 73 74 44 44 74 74 44 61 74 74 44 44...

result:

ok 

Test #299:

score: 10
Accepted
time: 480ms
memory: 56836kb

input:

62500 8 70000
64472 41906 37052 44464 53555 58131 329 22786
55165 43943 64063 32035 22052 52983 35450 47115
42348 48425 22268 3633 15516 28887 32636 48547
20247 30100 44729 17574 13491 8828 14663 64636
7335 62796 54561 19353 43316 65390 9000 30320
8335 56377 6106 55566 36702 57785 11840 23320
3230 4...

output:

22786 53555 44464 64472 329 58131 41906 37052 
55165 32035 35450 22052 43943 47115 64063 52983 
28887 42348 22268 48547 3633 15516 32636 48425 
44729 14663 30100 8828 64636 17574 13491 20247 
19353 43316 30320 7335 65390 54561 62796 9000 
55566 11840 8335 36702 56377 57785 6106 23320 
46318 62872 45...

result:

ok 

Test #300:

score: 10
Accepted
time: 62ms
memory: 40252kb

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 #301:

score: 10
Accepted
time: 501ms
memory: 62388kb

input:

62500 8 100000
47172 98715 32573 10450 57470 57785 14618 26881
82542 14477 54747 90100 28448 58443 38091 88923
35476 3812 18616 40241 37528 97066 63939 99345
89936 22796 3166 12257 68822 862 51368 1274
3728 15897 5024 77108 47176 30543 68911 16457
3043 71632 92951 31443 88863 88950 41175 10918
13709...

output:

47172 32573 26881 57785 57470 98715 10450 14618 
90100 58443 82542 88923 38091 28448 14477 54747 
18616 3812 63939 97066 99345 35476 40241 37528 
68822 12257 22796 1274 862 89936 51368 3166 
47176 5024 68911 3728 30543 77108 16457 15897 
88950 31443 41175 71632 10918 3043 92951 88863 
50396 81007 20...

result:

ok 

Test #302:

score: 10
Accepted
time: 483ms
memory: 62900kb

input:

62496 8 100000
92424 32969 88476 83157 26937 10720 48350 99360
85305 23955 10048 64444 63891 12816 29853 71331
61936 49932 48976 6234 77639 33648 36768 3193
12060 69101 59074 35029 63097 76282 44013 93083
46256 39387 91809 14571 23462 21416 49200 22090
57525 95911 66504 79489 59895 59787 19475 1477
...

output:

10720 83157 32969 48350 26937 88476 99360 92424 
12816 71331 64444 85305 10048 23955 29853 63891 
77639 36768 48976 49932 6234 61936 33648 3193 
69101 59074 76282 44013 63097 35029 93083 12060 
14571 46256 21416 22090 49200 23462 39387 91809 
95911 19475 59787 66504 57525 1477 59895 79489 
31812 868...

result:

ok 

Test #303:

score: 10
Accepted
time: 554ms
memory: 57612kb

input:

31250 16 100000
38541 93204 27590 15361 66717 47252 45666 97504 23510 29022 67421 9583 26198 14461 95157 20540
68091 37113 17290 88353 39292 67411 26393 92637 14252 31217 88721 63983 36434 66431 61347 83636
55923 37831 35042 64077 54372 60464 29813 33353 98528 15152 15477 78600 29076 27693 13281 239...

output:

14461 27590 23510 97504 66717 9583 20540 93204 15361 67421 29022 26198 38541 95157 47252 45666 
66431 14252 83636 39292 63983 68091 17290 92637 88353 36434 67411 31217 37113 61347 88721 26393 
29076 33353 98528 37831 60464 13281 15477 64077 55923 35042 29813 15152 23908 78600 27693 54372 
71554 3997...

result:

ok 

Test #304:

score: 10
Accepted
time: 387ms
memory: 38708kb

input:

62500 8 100000
99332 49767 67282 81878 81878 90800 57079 57079
83482 30201 63213 77987 74799 98108 98108 83482
38347 91232 62597 68142 81727 30450 91232 81727
84080 54724 20495 44364 38865 54724 20495 96039
21322 14652 50336 99451 40 14652 70644 70644
73656 50229 50229 66534 27734 25964 27734 59412
...

output:

57079 90800 99332 81878 57079 49767 67282 81878 
30201 83482 74799 98108 83482 63213 77987 98108 
68142 91232 38347 81727 91232 62597 81727 30450 
54724 44364 38865 20495 54724 84080 20495 96039 
70644 99451 14652 21322 50336 70644 14652 40 
27734 66534 59412 50229 25964 50229 27734 73656 
15631 674...

result:

ok 

Test #305:

score: 10
Accepted
time: 71ms
memory: 40364kb

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:

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

result:

ok 

Extra Test:

score: 0
Extra Test Passed