QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#242763#5545. Contingency PlanGuanYunchangAC ✓419ms56652kbC++172.0kb2023-11-07 16:53:562023-11-07 16:53:56

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 12968kb

input:

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

output:

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

result:

ok AC

Test #2:

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

input:

3
1 2
2 3

output:

-1

result:

ok AC

Test #3:

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

input:

2
2 1

output:

-1

result:

ok AC

Test #4:

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

input:

5
2 1
2 3
2 4
4 5

output:

1 3
4 1
2 5
1 5

result:

ok AC

Test #5:

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

input:

5
1 4
3 4
4 5
2 5

output:

1 2
3 1
4 2
5 1

result:

ok AC

Test #6:

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

input:

5
5 2
1 2
4 2
3 4

output:

5 1
5 4
2 3
3 5

result:

ok AC

Test #7:

score: 0
Accepted
time: 32ms
memory: 21716kb

input:

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

output:

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

result:

ok AC

Test #8:

score: 0
Accepted
time: 46ms
memory: 21440kb

input:

20000
7662 1
9205 1
5971 1
1 9886
1 18853
14108 1
998 1
1 14958
7100 1
1 2670
1 18493
13838 1
4644 1
2139 1
1 18540
1 14081
1 16836
1 9357
245 1
242 1
1 13472
1 1471
3792 1
1 17875
13976 1
1 15085
1 17283
15014 1
17477 1
11578 1
18441 1
1 14367
3018 1
1 7186
1 4939
2470 1
2993 1
6175 1
1 19886
1 125...

output:

7662 2
9205 2
5971 2
9886 2
18853 2
14108 2
998 2
14958 2
7100 2
2670 2
18493 2
13838 2
4644 2
2139 2
18540 2
14081 2
16836 2
9357 2
245 2
242 2
13472 2
1471 2
3792 2
17875 2
13976 2
15085 2
17283 2
15014 2
17477 2
11578 2
18441 2
14367 2
3018 2
7186 2
4939 2
2470 2
2993 2
6175 2
19886 2
12592 2
195...

result:

ok AC

Test #9:

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

input:

20000
8854 1
15635 1
8088 1
1 12138
12367 1
1 15051
6392 1
15564 1
17334 1
1 10164
8704 1
1 13795
1 10292
12108 1
1 50
4 1
1 18364
13341 1
19203 1
1 3017
1 5133
3499 1
19202 1
1 10304
12975 1
1 17220
1 1716
1 4158
1 16763
1 301
1 16645
8690 1
1 10064
16977 1
1 19618
1 5471
1 8763
3997 1
1 3283
11332...

output:

8854 2
15635 2
8088 2
12138 2
12367 2
15051 2
6392 2
15564 2
17334 2
10164 2
8704 2
13795 2
10292 2
12108 2
50 2
4 2
18364 2
13341 2
19203 2
3017 2
5133 2
3499 2
19202 2
10304 2
12975 2
17220 2
1716 2
4158 2
16763 2
301 2
16645 2
8690 2
10064 2
16977 2
19618 2
5471 2
8763 2
3997 2
3283 2
11332 2
163...

result:

ok AC

Test #10:

score: 0
Accepted
time: 35ms
memory: 21392kb

input:

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

output:

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

result:

ok AC

Test #11:

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

input:

20000
1 13291
13291 19998
3314 13291
13291 3339
13291 10237
13244 13291
13291 3392
13291 4459
13291 17335
13291 10356
6124 13291
13291 4470
12896 13291
13291 12094
3309 13291
13319 13291
13291 15658
13291 2305
13291 13710
13291 16520
13291 16234
6697 13291
13291 6686
9187 13291
13291 43
13291 2764
1...

output:

1 2
19998 1
3314 1
3339 1
10237 1
13244 1
3392 1
4459 1
17335 1
10356 1
6124 1
4470 1
12896 1
12094 1
3309 1
13319 1
15658 1
2305 1
13710 1
16520 1
16234 1
6697 1
6686 1
9187 1
43 1
2764 1
9061 1
8113 1
8449 1
3304 1
16249 1
3859 1
5651 1
8941 1
13460 1
19932 1
10868 1
10878 1
12114 1
2249 1
8469 1
...

result:

ok AC

Test #12:

score: 0
Accepted
time: 49ms
memory: 21520kb

input:

20000
4030 5565
1206 5565
5565 8947
4887 5565
14605 5565
5565 2947
5565 9038
5565 5326
5565 9021
11087 5565
5565 19562
895 5565
14653 5565
5565 10803
5565 9750
5565 16331
4689 5565
14307 5565
11631 5565
5565 13244
10554 5565
8112 5565
5565 9394
5565 5945
15279 5565
5565 15512
1334 5565
5565 6025
556...

output:

4030 1
1206 1
8947 1
4887 1
14605 1
2947 1
9038 1
5326 1
9021 1
11087 1
19562 1
895 1
14653 1
10803 1
9750 1
16331 1
4689 1
14307 1
11631 1
13244 1
10554 1
8112 1
9394 1
5945 1
15279 1
15512 1
1334 1
6025 1
19566 1
3491 1
6766 1
9409 1
4818 1
1704 1
6243 1
17787 1
3781 1
14151 1
7743 1
8018 1
14844 ...

result:

ok AC

Test #13:

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

input:

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

output:

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

result:

ok AC

Test #14:

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

input:

5
2 1
3 2
4 3
5 4

output:

1 3
2 4
4 1
5 1

result:

ok AC

Test #15:

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

input:

100000
21871 1
13678 1
27196 1
70437 1
1 35891
1 43010
28018 1
1 64489
61157 1
1 35572
1 41613
1 73049
93865 1
83507 1
1 92127
86278 1
1 15004
1 44154
2005 1
1 94210
41410 1
1 5886
69836 1
1 24120
1 80802
1 9940
66220 1
66549 1
1 20103
1 5
1 33021
35482 1
76185 1
34850 1
1 55173
1 72488
1 76286
1 99...

output:

21871 2
13678 2
27196 2
70437 2
35891 2
43010 2
28018 2
64489 2
61157 2
35572 2
41613 2
73049 2
93865 2
83507 2
92127 2
86278 2
15004 2
44154 2
2005 2
94210 2
41410 2
5886 2
69836 2
24120 2
80802 2
9940 2
66220 2
66549 2
20103 2
5 2
33021 2
35482 2
76185 2
34850 2
55173 2
72488 2
76286 2
99583 2
698...

result:

ok AC

Test #16:

score: 0
Accepted
time: 407ms
memory: 56588kb

input:

100000
1 12976
28108 1
87682 1
79359 1
16128 1
1 90652
1 55874
27276 1
1 66899
1 10296
1 37870
1 78978
26221 1
28589 1
1 46430
32252 1
22407 1
68230 1
64944 1
1 53457
31023 1
1 57101
1 82578
1 33273
69683 1
64357 1
1 32517
1 45623
1 29497
41082 1
1 43731
1 28620
1 64304
1 23462
1 81982
1 91877
1 309...

output:

12976 2
28108 2
87682 2
79359 2
16128 2
90652 2
55874 2
27276 2
66899 2
10296 2
37870 2
78978 2
26221 2
28589 2
46430 2
32252 2
22407 2
68230 2
64944 2
53457 2
31023 2
57101 2
82578 2
33273 2
69683 2
64357 2
32517 2
45623 2
29497 2
41082 2
43731 2
28620 2
64304 2
23462 2
81982 2
91877 2
30971 2
8678...

result:

ok AC

Test #17:

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

input:

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

output:

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

result:

ok AC

Test #18:

score: 0
Accepted
time: 382ms
memory: 56652kb

input:

100000
15924 1
13919 15924
86413 15924
15924 78418
36904 15924
15924 60478
15924 78563
15924 23855
63531 15924
15574 15924
73713 15924
62532 15924
15924 19461
15924 80750
15924 57012
15924 27046
55780 15924
69619 15924
58970 15924
65824 15924
15924 3195
26782 15924
71411 15924
84915 15924
95347 1592...

output:

1 2
13919 1
86413 1
78418 1
36904 1
60478 1
78563 1
23855 1
63531 1
15574 1
73713 1
62532 1
19461 1
80750 1
57012 1
27046 1
55780 1
69619 1
58970 1
65824 1
3195 1
26782 1
71411 1
84915 1
95347 1
53739 1
88602 1
19186 1
23093 1
21581 1
95624 1
48747 1
91189 1
63350 1
63254 1
669 1
33246 1
4974 1
7053...

result:

ok AC

Test #19:

score: 0
Accepted
time: 346ms
memory: 56584kb

input:

100000
40659 47250
51514 40659
40659 83613
16333 40659
25291 40659
40659 61711
40659 37621
40659 66805
40659 59550
67744 40659
40659 46644
40659 21771
40659 98164
40659 6655
75053 40659
90431 40659
40659 58023
48769 40659
11506 40659
19125 40659
52852 40659
98702 40659
53360 40659
40659 3999
66767 4...

output:

47250 1
51514 1
83613 1
16333 1
25291 1
61711 1
37621 1
66805 1
59550 1
67744 1
46644 1
21771 1
98164 1
6655 1
75053 1
90431 1
58023 1
48769 1
11506 1
19125 1
52852 1
98702 1
53360 1
3999 1
66767 1
82867 1
10045 1
17184 1
77910 1
18776 1
86383 1
20673 1
68349 1
65580 1
45242 1
52336 1
96304 1
90409 ...

result:

ok AC

Test #20:

score: 0
Accepted
time: 39ms
memory: 21436kb

input:

20000
13211 1
1 10767
13211 16998
13211 495
10767 7635
10767 6994
10669 16998
1369 16998
495 4745
722 495
7635 251
3552 7635
7267 6994
6994 1772
10669 18929
10669 9328
3076 1369
1369 14212
4745 284
4745 9599
722 6137
722 10565
15137 251
5349 251
16431 3552
3552 15719
7267 10917
598 7267
19533 1772
1...

output:

495 10767
1 2
1369 495
13211 2
495 251
1772 495
9328 1369
16998 1
251 284
251 6137
284 3552
7635 1
598 1772
6994 1
10707 9328
10669 1
495 6305
495 12864
251 9599
4745 1
251 10565
722 1
284 1217
284 3827
5321 284
436 284
11967 598
7267 1
495 39
495 1190
8367 10707
18929 1
1369 8015
16785 1369
6192 63...

result:

ok AC

Test #21:

score: 0
Accepted
time: 46ms
memory: 21720kb

input:

20000
11262 14400
16805 2790
19084 11979
15259 5949
9916 12236
2445 1637
1905 15141
9540 16655
12812 16186
19052 1523
6643 1443
13738 10091
9218 1337
16617 16436
17295 16466
1171 1217
19150 5280
2830 8076
16135 7234
11460 213
8101 341
5438 6331
5029 14871
10725 2090
5998 12241
8902 3420
4340 7265
18...

output:

14400 1
16805 1
13507 15251
12963 5656
9916 1
2445 1
15141 1
11641 5203
3873 4110
8631 13757
1443 1
10091 1
9218 1
16617 1
16466 1
110 8129
19150 1
2830 1
7234 1
3226 4729
9725 11282
6331 1
14871 1
10725 1
10295 2487
8902 1
1613 12945
5618 1
8660 6721
741 1
19617 1
8720 5790
12234 1
759 2272
18805 1...

result:

ok AC

Test #22:

score: 0
Accepted
time: 34ms
memory: 21620kb

input:

20000
19272 1
19272 7240
6952 7240
6952 10594
12564 10594
12564 13132
14483 13132
14483 1891
9772 1891
16614 9772
14519 16614
12050 14519
4039 12050
4039 9679
8408 4039
12050 6797
17990 6797
6797 17659
14519 14985
16415 14985
1735 16415
16415 18821
14985 9402
9402 18947
9402 5386
17560 16614
17560 1...

output:

688 327
6952 688
688 12151
688 2192
11498 2192
3663 11498
1891 3663
3663 8585
1977 3663
14519 1977
1977 17560
4039 1977
1977 6797
9679 1
8408 1
12050 1
17990 1
17659 1
9402 1977
1735 9402
9402 18821
16415 1
14985 1
18947 1
5386 1
16614 1
793 7537
793 16466
19700 1
9876 1
1094 1
11779 1
8212 1
7537 1...

result:

ok AC

Test #23:

score: 0
Accepted
time: 35ms
memory: 21456kb

input:

20000
4410 1
7210 1
1 2389
4410 18377
4410 4507
7905 4410
7210 14849
12441 7210
7210 9005
17807 2389
2389 6619
2389 6604
6913 18377
5811 18377
7249 18377
4507 1582
4507 8857
4507 17635
10077 7905
7905 4687
8607 7905
14849 16870
14849 3298
14849 2376
12441 9009
12441 10729
19879 12441
9005 19790
7715...

output:

4507 2389
9005 2389
1 2
5811 4507
1582 7905
4410 2
2376 9005
9009 9005
7210 2
4507 8360
4507 2365
5414 4507
14304 5811
4507 7249
18377 1
2365 726
2365 3127
2365 5480
5550 1582
2121 1582
4225 1582
13184 2376
8656 2376
14849 1
2336 10729
858 19879
12441 1
2376 3676
2376 2164
2497 2376
819 8360
9329 83...

result:

ok AC

Test #24:

score: 0
Accepted
time: 47ms
memory: 21516kb

input:

20000
7223 19213
12395 18674
16451 12980
18029 7848
16056 11920
6906 11077
3923 10662
9192 4837
17604 11135
16462 2457
18842 9770
15130 10251
19601 6770
7954 12079
7559 642
15051 17509
1146 18583
18196 17621
4980 8041
19973 15310
16834 11112
3176 8010
957 12737
4072 830
3194 1873
11400 3394
6914 806...

output:

19213 1
12395 1
12980 1
7848 1
10423 2808
6906 1
3690 180
4837 1
11135 1
9573 4193
9770 1
7691 1584
6770 1
1464 301
7559 1
14497 1881
1146 1
17621 1
8041 1
7388 11862
11112 1
6310 5324
957 1
7391 12952
3194 1
8980 1656
6914 1
14516 1
1202 2810
1868 1
1403 1654
163 1
13285 1
3523 1
5435 1
11408 1
133...

result:

ok AC

Test #25:

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

input:

5
2 1
3 1
4 1
1 5

output:

-1

result:

ok AC

Test #26:

score: 0
Accepted
time: 37ms
memory: 21680kb

input:

20000
1 4794
4794 19823
8249 19823
8249 19672
16549 19672
13478 16549
3608 13478
3608 14623
14623 10303
19353 14623
14623 7999
3608 14367
14367 17910
14367 8488
16947 14367
3608 1121
1121 1836
13048 1121
17393 1121
11488 13478
11488 17346
8954 17346
17346 4922
17346 13440
11488 2278
16202 2278
593 2...

output:

12693 8746
8249 12693
12693 11014
12693 4979
4448 4979
3608 4448
1121 4302
1121 7999
10303 1
19353 1
14623 1
8488 1121
17910 1
16947 1121
14367 1
1836 4448
4302 4448
13048 1
17393 1
2278 4302
4922 2278
8954 1
13440 2278
17346 1
593 12496
16202 1
4302 12496
13598 1
11488 1
7488 1
8346 1
2126 1
13478 ...

result:

ok AC

Test #27:

score: 0
Accepted
time: 36ms
memory: 21396kb

input:

20000
1 17253
5390 1
1 10221
1 16259
8902 1
10509 1
1 16551
1 13314
1 12754
1 11707
1 7781
1 2105
1 18132
1 12907
1 5609
1 15234
1 18609
1 13919
1 13882
1 15621
1 1997
1 14002
1 18056
7498 1
13534 1
1530 1
1 14773
1 2001
1 10679
1 13745
6140 1
19975 1
14198 1
1 7536
5623 1
1 6120
1 6954
730 1
1 1601...

output:

71 151
73 151
3 151
255 151
57 151
106 151
171 151
537 151
94 151
80 151
97 151
140 151
20 151
53 151
370 151
25 151
128 151
18 151
520 151
78 151
74 151
2 151
225 151
121 151
317 151
42 151
310 151
45 151
425 151
138 151
165 151
5 151
7 151
103 151
65 151
16 151
54 151
249 151
79 151
46 151
163 151...

result:

ok AC

Test #28:

score: 0
Accepted
time: 46ms
memory: 21392kb

input:

20000
5445 4016
925 12966
8179 19342
5779 1
9123 4530
5079 8720
8754 5478
17667 13748
7203 13819
10489 7645
8537 14929
4717 5427
239 4564
17407 14318
6756 7348
4638 17915
19455 15109
3853 19342
15246 17470
8228 16612
7726 13819
1 16617
16607 6208
6228 12081
1615 14545
11897 16624
7653 14499
7273 195...

output:

5445 1
12966 1
8179 1
95 290
9123 1
5079 1
5478 1
13748 1
7203 1
7645 1
14929 1
4717 1
4564 1
14318 1
7348 1
17915 1
15109 1
3853 1
15246 1
8228 1
7726 1
95 510
16607 1
6228 1
1615 1
11897 1
14499 1
19530 1
15437 1
17582 1
9523 1
18894 1
7204 1
1183 1
6264 1
12776 1
10060 1
4195 1
15487 1
6735 1
180...

result:

ok AC

Test #29:

score: 0
Accepted
time: 40ms
memory: 21520kb

input:

20000
1 10558
10558 7298
7298 3082
17807 7298
793 7298
11663 7298
12412 7298
10699 7298
7298 1146
2462 7298
7298 12577
11701 7298
7298 7622
3831 7298
19955 7298
3001 7298
7298 18329
7298 851
7298 16782
7298 17396
7298 15015
12771 7298
7298 10926
4736 7298
9088 7298
4867 7298
16066 7298
7298 2148
729...

output:

69 527
129 69
3082 1
17807 1
793 1
11663 1
12412 1
10699 1
1146 1
2462 1
12577 1
11701 1
7622 1
3831 1
19955 1
3001 1
18329 1
851 1
16782 1
17396 1
15015 1
12771 1
10926 1
4736 1
9088 1
4867 1
16066 1
2148 1
9282 1
3101 1
1177 1
16186 1
18525 1
9265 1
10881 1
15895 1
14732 1
15331 1
10411 1
13920 1
...

result:

ok AC

Test #30:

score: 0
Accepted
time: 38ms
memory: 21716kb

input:

20000
1 11767
10226 11767
6246 10226
6576 6246
458 6576
458 5997
16052 5997
16052 10900
4370 10900
4370 17480
17480 11379
4859 11379
14663 4859
18363 14663
1454 18363
18490 1454
18490 17760
17760 19850
19832 19850
4252 19832
5482 4252
2802 5482
17779 2802
17779 8601
10844 8601
10844 17372
1230 17372...

output:

1 2
11767 2
10226 1
6246 1
6576 1
458 1
5997 1
16052 1
10900 1
4370 1
17480 1
11379 1
4859 1
14663 1
18363 1
1454 1
18490 1
17760 1
19850 1
19832 1
4252 1
5482 1
2802 1
17779 1
8601 1
10844 1
17372 1
1230 1
13019 1
3128 1
19136 1
9687 1
9016 1
12862 1
18082 1
14262 1
11849 1
3064 1
15552 1
3949 1
10...

result:

ok AC

Test #31:

score: 0
Accepted
time: 37ms
memory: 21720kb

input:

20000
16653 18166
1123 17313
12716 14313
11207 7401
2794 831
480 7420
4462 1161
575 456
15192 3052
12389 7101
15729 18976
18772 19492
18805 2052
866 10412
8160 3697
13319 15062
19241 11526
11876 3502
613 17770
15035 14829
6518 16531
11665 19122
15722 18062
19841 14843
5758 3123
1633 14519
3637 13277...

output:

4595 10350
16681 2237
16693 19519
8634 4865
18812 7847
14208 510
10704 14393
19994 13906
2526 17063
9028 10656
1868 16947
16979 4428
10339 6445
13907 3256
8136 15143
9621 55
15795 13821
6450 7471
17128 19962
5082 2698
4449 1835
7369 7242
2266 4405
14370 13929
14082 348
2989 8859
3048 14685
8826 1109...

result:

ok AC

Test #32:

score: 0
Accepted
time: 48ms
memory: 21524kb

input:

20000
5613 1
1 999
1 16709
1 2491
9549 1
19706 1
1 1022
1 3884
1 1916
6627 1
1 1600
10265 1
1 19100
19766 1
1 7450
1 14375
5986 1
10295 1
8625 1
11810 1
1 15542
1 5745
3506 1
12842 1
1 11860
1 16317
1 6553
12476 1
1 6031
8445 1
6462 1
1 1601
1 3014
14100 1
1 6771
1 2360
1 15402
4549 1
6116 1
1 17848...

output:

-1

result:

ok AC

Test #33:

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

input:

20000
2509 13795
17043 13795
12006 13795
13795 822
3022 13795
8572 13795
2579 13795
13795 9673
12654 13795
4181 13795
13795 15912
13795 8902
13795 19201
5015 13795
243 13795
13795 6524
13795 9461
16403 13795
13795 18444
1316 13795
15366 13795
13795 17126
13795 309
13795 10938
13795 1255
13795 5588
1...

output:

-1

result:

ok AC

Test #34:

score: 0
Accepted
time: 35ms
memory: 21524kb

input:

20000
12144 2902
8713 11740
8870 10266
6116 3885
5943 8380
10496 956
14162 9193
4497 3275
5480 4601
6858 17285
1067 3003
19501 1958
5579 12167
844 12167
5372 16648
18876 13545
6559 10656
2910 6918
5632 16656
10135 11948
11253 13524
10068 15948
17884 3833
6830 16257
1248 6924
9806 14359
11033 8077
86...

output:

12144 1
8713 1
10266 1
6116 1
5943 1
10496 1
9193 1
4497 1
5480 1
6858 1
3003 1
1958 1
5579 1
12167 1
16648 1
18876 1
10656 1
6918 1
5632 1
10135 1
11253 1
10068 1
3833 1
16257 1
6924 1
9806 1
8077 1
8650 1
9461 1
2145 1
18808 1
17834 1
17118 1
5268 1
17239 1
12697 1
18861 1
6613 1
14103 1
3550 1
60...

result:

ok AC

Test #35:

score: 0
Accepted
time: 48ms
memory: 21728kb

input:

20000
1284 10854
1436 9770
17852 14859
19561 13068
19123 19730
8297 15453
7167 3888
5853 15710
18440 5611
9368 5242
6667 12315
19899 12021
13550 19105
16314 1977
18051 11095
4122 16348
1987 4873
14613 10548
375 11649
6442 1199
228 18390
4006 7870
2115 10763
13056 1980
4042 9649
11446 10078
14111 289...

output:

7124 8188
1436 1
5090 1825
228 12429
6424 7062
467 7747
7280 8937
5853 1
4408 10153
5242 1
9118 2567
12021 1
19105 1
8575 18055
11095 1
4122 1
2182 20
10548 1
12696 12389
17448 15676
12429 753
10682 5507
4520 19792
2556 8333
1832 8599
7071 6214
1750 14892
4735 9136
4407 9435
6627 1
1149 19378
1982 6...

result:

ok AC

Test #36:

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

input:

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

output:

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

result:

ok AC

Test #37:

score: 0
Accepted
time: 37ms
memory: 21440kb

input:

20000
1 1914
16448 1914
16448 447
1 19785
19232 19785
17236 19785
12409 17236
11707 12409
15526 11707
15526 12645
19367 12645
19367 7871
12617 7871
658 7871
2936 7871
10186 2936
10186 12483
4222 12483
4222 6106
3280 6106
7313 6106
17305 6106
2244 17305
17305 18735
16748 6106
16748 1554
16748 1261
73...

output:

19785 16448
1914 2
447 1
19785 447
19232 1
447 12409
17236 1
4017 447
10364 4017
10364 19367
12645 1
658 10364
12617 1
10364 2936
7871 1
12483 10364
4222 17414
6106 10364
3280 17414
7313 17414
10364 17414
2244 10364
10364 18735
17305 1
1261 10364
1554 1
7318 10364
6734 13963
6734 7917
9524 1
7917 10...

result:

ok AC

Test #38:

score: 0
Accepted
time: 43ms
memory: 21752kb

input:

20000
8234 1
16079 8234
18825 16079
18825 12361
12361 6709
6709 10905
12205 10905
3916 12205
16311 3916
16423 16311
16423 10094
10094 9710
1474 9710
1474 18631
18631 13459
6640 13459
19380 6640
19380 6320
19874 6320
2212 19874
2212 8880
8880 2809
15348 2809
14869 15348
14869 8029
924 8029
924 10270
...

output:

1 2
2843 3930
4793 2843
1147 4793
1147 10905
6709 1
1147 3916
12205 1
1147 16423
16311 1
1147 9710
10094 1
1147 18631
1474 1
6640 1147
1147 18718
6320 1147
1147 7353
1147 2212
19874 1
1147 2809
1147 6642
14869 1147
1147 18149
1147 924
1147 18298
10381 1147
10381 4694
16526 1
15046 10381
1818 1
7645 ...

result:

ok AC

Test #39:

score: 0
Accepted
time: 39ms
memory: 21436kb

input:

20000
3828 10203
17892 5873
17224 10321
12241 7554
2948 6507
17619 16861
11410 1012
17019 18616
13582 19398
16411 15552
578 14161
9621 19542
9684 1699
16733 9223
16474 19501
15178 3217
9743 11111
6539 14379
5655 12001
10637 2251
13411 7006
7104 9228
15833 19339
12622 4315
19092 7490
8033 12870
19399...

output:

3828 1
16399 16260
8129 3077
7554 1
665 9043
6469 3467
1012 1
11704 14075
19398 1
16411 1
578 1
9621 1
1051 12390
8574 719
19501 1
354 17767
9304 11557
3278 3700
12001 1
1195 7631
4543 7874
987 9521
3265 17129
16549 9234
1451 4870
1725 13704
1103 1
12722 1
4428 13116
2690 18087
12735 6897
15830 1
24...

result:

ok AC

Test #40:

score: 0
Accepted
time: 31ms
memory: 21680kb

input:

20000
6712 1
6712 16871
8572 16871
8572 10641
10641 16702
16702 18095
14014 18095
14014 10577
10577 1956
1956 13463
4593 13463
4593 17604
8524 17604
8524 4625
4625 5906
5906 17983
17983 13029
13029 7366
13038 7366
13038 3804
3804 3699
3699 15717
15717 967
16443 967
16443 1797
3079 1797
9213 3079
232...

output:

2833 16871
6712 2
2833 5822
16702 5822
5822 18036
5822 2031
454 2031
1956 454
454 2728
1353 454
1353 17203
17203 8524
17604 1
17203 5906
4625 1
11839 13029
17983 1
11839 13038
7366 1
11839 3699
3804 1
11839 967
15717 1
1797 11839
16443 1
9213 11839
3079 1
16743 11839
232 1
6866 4937
1222 1
9423 6866...

result:

ok AC

Test #41:

score: 0
Accepted
time: 44ms
memory: 21508kb

input:

20000
2591 11751
5562 1300
9597 7814
11201 6762
9942 6089
18201 10054
14040 17666
14050 3479
2754 6286
5122 10070
2705 10053
3703 8076
33 13628
18330 17144
15031 16159
668 10414
14591 4857
15396 13207
6623 13987
3946 9270
15622 17484
4063 8811
12866 7551
3439 8748
10982 6076
15522 1678
8947 4749
677...

output:

11751 1
1300 1
9597 1
6363 18150
909 1532
10054 1
4930 8415
14050 1
10854 4327
10070 1
10053 1
8007 905
2811 9257
7838 11
14937 9343
5895 17841
4857 1
4979 3682
6623 1
3697 17637
17484 1
11401 7049
5807 1138
3439 1
6076 1
1678 1
2358 803
6774 1
19379 1
16853 1
7621 1
12599 1
7397 10787
13256 4254
12...

result:

ok AC

Test #42:

score: 0
Accepted
time: 265ms
memory: 56652kb

input:

100000
1 72500
1 89151
72500 50542
16422 72500
31678 89151
89151 54297
19071 50542
25039 50542
59896 16422
57305 16422
17263 31678
31678 3514
54297 25341
13381 54297
19071 7507
15806 19071
25039 62775
20433 25039
59896 28013
59896 2793
84857 57305
57305 84225
17263 6434
17263 61853
37741 3514
3514 8...

output:

16422 89151
1 2
19071 16422
72500 2
3514 16422
13381 16422
7507 25039
50542 1
3514 2793
3514 84225
6434 3514
31678 1
13085 13381
54297 1
25039 15806
7022 16422
7507 9513
40559 7507
53307 2793
59896 1
1693 84225
57305 1
3514 61853
17263 1
2793 74447
2793 28941
6449 13085
25341 1
13085 70275
17273 130...

result:

ok AC

Test #43:

score: 0
Accepted
time: 323ms
memory: 56556kb

input:

100000
37174 25594
26356 56758
70911 5299
53571 20298
89704 67180
69629 74497
31785 14492
10546 1814
71677 54029
2466 28838
57294 23003
35667 41920
5998 95159
14430 34895
74794 85483
87138 10195
54295 96087
21621 26770
92353 70922
56725 17254
67745 92044
30390 34948
64685 31050
54736 78533
63644 859...

output:

380 54691
9930 14111
70911 1
20298 1
9915 60163
16212 67839
14492 1
59743 32541
67480 6328
66799 15110
23003 1
41920 1
7630 10518
34895 1
74794 1
10195 1
54295 1
21621 1
18190 15837
56725 1
67745 1
19259 35207
56914 29637
78533 1
92209 35383
41599 1
83052 1
72832 1
91279 1
67635 1
93515 1
12147 1
81...

result:

ok AC

Test #44:

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

input:

100000
90403 1
90403 84049
84049 28339
50038 28339
50038 23735
23735 87291
87291 26404
26404 3276
3276 37488
67144 37488
67144 15335
15335 73596
32815 73596
58348 32815
32340 58348
77042 32340
32340 17210
58348 68281
68281 13360
68281 52957
32815 3781
88746 3781
33513 88746
88746 23338
11895 3781
90...

output:

35029 31209
28339 35029
147 41035
1681 147
63088 1681
26404 63088
3276 97189
37488 63088
63088 62799
15335 63088
7359 69223
7359 32815
3781 48662
32340 3781
3781 68281
77042 1
17210 1
58348 1
13360 1
52957 1
11895 7359
11895 23338
33513 1
88746 1
7359 32340
90021 1
30580 1
73596 1
3781 74409
3781 83...

result:

ok AC

Test #45:

score: 0
Accepted
time: 278ms
memory: 56636kb

input:

100000
10753 1
31716 1
1 8354
41344 10753
10753 22340
33736 10753
31716 74747
24655 31716
31716 93736
4454 8354
65308 8354
36992 8354
53743 41344
59301 41344
41344 86462
22340 77782
22340 49193
90415 22340
33736 2126
72574 33736
33736 98153
92064 74747
23614 74747
74747 96121
24655 95702
47727 24655...

output:

22340 8354
24655 8354
1 2
53743 22340
8354 33736
10753 2
23614 24655
8354 93736
31716 2
22340 40253
22340 11024
22340 5716
4120 59301
4120 86462
41344 1
5716 32722
5716 39322
5716 32
8354 7871
1960 8354
5620 8354
21454 23614
21454 96121
74747 1
8354 54886
2915 8354
12626 8354
18250 8354
36740 8354
2...

result:

ok AC

Test #46:

score: 0
Accepted
time: 304ms
memory: 56588kb

input:

100000
82182 59525
43093 74187
83434 62328
30609 75691
98351 97443
93951 9234
89762 57868
66707 24839
91314 82444
9148 12031
46318 817
9254 56692
67828 19158
29614 79432
64090 86748
43645 44758
91501 26481
13108 70283
53676 76180
2183 16343
17086 64156
13813 38661
1934 69441
21652 50770
62980 13969
...

output:

82182 1
74187 1
83434 1
30609 1
97443 1
6058 6851
57868 1
24839 1
91314 1
9148 1
817 1
26920 34062
67828 1
79432 1
64090 1
29730 2817
26481 1
70283 1
76180 1
2183 1
17086 1
38661 1
69441 1
60495 28140
285 32668
32887 1
53464 1
25844 3061
42547 8315
72413 1
94757 1
7155 11991
37806 4719
67989 1
9866 ...

result:

ok AC

Test #47:

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

input:

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

output:

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

result:

ok AC

Test #48:

score: 0
Accepted
time: 259ms
memory: 56508kb

input:

100000
1 59819
46211 59819
46211 78631
78631 6887
6887 15685
45496 15685
45496 38399
38399 43932
22491 43932
22491 57782
25655 57782
57782 81578
40906 57782
22491 8185
8185 92518
96199 8185
63790 8185
22491 64847
84427 64847
34665 64847
30015 64847
34952 43932
34952 12997
41447 12997
19357 12997
307...

output:

46211 27108
20783 58121
20783 6887
12639 16518
12639 8679
5925 8679
43932 5925
5925 45760
8185 5925
25655 8185
40906 8185
81578 1
57782 1
5925 64847
92518 1
96199 1
63790 1
22491 1
84427 1
34665 1
30015 1
12997 5925
5925 41985
41447 1
19357 1
30750 1
5925 56846
17269 1
73496 1
97851 1
34952 1
2593 1...

result:

ok AC

Test #49:

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

input:

100000
70720 1
71027 1
48338 1
1 61809
1 79963
1 39740
86644 1
14939 1
39918 1
41470 1
23364 1
1 54664
1 96370
1 53835
1 67313
33696 1
44243 1
50423 1
1 70539
73776 1
560 1
98363 1
71623 1
72365 1
1 73548
1 82843
1 64083
52686 1
1 44452
1 94601
1 43725
88136 1
1 65340
30989 1
1 94282
76705 1
1 4208
...

output:

804 560
264 560
93 560
96 560
384 560
80 560
40 560
63 560
693 560
103 560
985 560
95 560
101 560
193 560
76 560
1312 560
60 560
38 560
137 560
12 560
12 1116
836 1116
122 1116
45 1116
522 1116
334 1116
88 1116
109 1116
104 1116
69 1116
662 1116
510 1116
743 1116
337 1116
284 1116
436 1116
407 1116
...

result:

ok AC

Test #50:

score: 0
Accepted
time: 366ms
memory: 56532kb

input:

100000
55448 49209
4084 16405
52470 22193
57007 13008
43787 82824
91893 67413
72105 89438
5791 85302
74502 44950
57906 11997
53465 42216
63894 41770
20892 54078
19530 68055
34937 22893
43941 47065
54015 53196
91519 81132
80483 71834
1399 53196
18226 23550
46619 51969
78131 47878
85576 60764
37319 88...

output:

55448 1
4084 1
22193 1
13008 1
82824 1
91893 1
72105 1
5791 1
44950 1
11997 1
42216 1
41770 1
20892 1
68055 1
22893 1
47065 1
54015 1
91519 1
80483 1
1399 1
23550 1
46619 1
47878 1
85576 1
37319 1
32182 1
81586 1
8618 1
79665 1
71947 1
32200 1
98413 1
2876 1
42148 1
83951 1
9727 1
95950 1
24562 1
59...

result:

ok AC

Test #51:

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

input:

100000
1 13485
13485 21238
21238 89751
21238 74621
14404 21238
60040 21238
21238 46089
46928 21238
73214 21238
88224 21238
47403 21238
21238 99205
89778 21238
21238 89464
22870 21238
21238 75159
40123 21238
33512 21238
21238 30257
70298 21238
21238 79591
57804 21238
21238 99840
64087 21238
12717 212...

output:

412 60
834 412
89751 1
74621 1
14404 1
60040 1
46089 1
46928 1
73214 1
88224 1
47403 1
99205 1
89778 1
89464 1
22870 1
75159 1
40123 1
33512 1
30257 1
70298 1
79591 1
57804 1
99840 1
64087 1
12717 1
80599 1
94369 1
17735 1
40969 1
4985 1
18584 1
2198 1
19418 1
83752 1
84416 1
20892 1
61478 1
9546 1
...

result:

ok AC

Test #52:

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

input:

100000
43730 1
43730 8413
8413 13508
53025 13508
44444 53025
44444 46747
54535 46747
54535 16058
16058 27066
27066 73721
35961 73721
18398 35961
18398 3188
3188 9998
57229 9998
57229 96831
2109 96831
2109 89059
89059 89520
89520 62512
62512 9136
9136 32949
27353 32949
19993 27353
19993 17305
91005 1...

output:

1 2
43730 2
8413 1
13508 1
53025 1
44444 1
46747 1
54535 1
16058 1
27066 1
73721 1
35961 1
18398 1
3188 1
9998 1
57229 1
96831 1
2109 1
89059 1
89520 1
62512 1
9136 1
32949 1
27353 1
19993 1
17305 1
91005 1
89369 1
44544 1
62632 1
97627 1
63485 1
91766 1
7276 1
21832 1
27796 1
99690 1
25279 1
82445 ...

result:

ok AC

Test #53:

score: 0
Accepted
time: 286ms
memory: 56512kb

input:

100000
5616 54215
70847 24268
13256 88765
87054 72678
65173 1284
61132 24104
29759 37270
50005 62107
8909 58386
97772 68628
3463 41963
93835 10608
7780 68599
97385 40426
52295 15155
65521 84045
97372 22218
24089 69011
44236 64952
21273 33469
21618 31458
76924 4738
27278 21658
6790 18294
2343 82355
8...

output:

78572 22388
12726 82199
89727 79339
88519 87149
30390 80813
87577 37905
5035 65187
29822 27716
12707 44345
94916 62520
99336 70032
61857 30939
83497 91457
87767 26962
5879 98494
69068 76078
63008 51279
84659 47160
80169 51136
58784 57218
39378 78047
12149 91186
4211 31564
92904 83366
98429 79517
543...

result:

ok AC

Test #54:

score: 0
Accepted
time: 337ms
memory: 56492kb

input:

100000
1 81565
21567 1
86484 1
95714 1
1 93565
1 15812
51087 1
15941 1
36746 1
1 34149
1 71887
1 61269
1 93111
1 52394
8732 1
1 62378
1 74176
1362 1
15806 1
91535 1
1 77121
1 17356
1 23401
70673 1
1 21367
77472 1
1 44692
1 45094
1 43652
62628 1
1 81187
1 98635
2258 1
1 491
1 1963
1 83580
12393 1
1 5...

output:

-1

result:

ok AC

Test #55:

score: 0
Accepted
time: 331ms
memory: 56508kb

input:

100000
62999 54230
62172 54230
54230 87813
80978 54230
54230 13635
8808 54230
34109 54230
54230 13451
54230 30179
9847 54230
93260 54230
54230 45610
54230 7282
54230 42958
54230 54480
54230 62452
54230 95890
32418 54230
54230 8456
54230 64404
54230 40018
54230 70843
38010 54230
57364 54230
95022 542...

output:

-1

result:

ok AC

Test #56:

score: 0
Accepted
time: 278ms
memory: 56504kb

input:

100000
85431 10525
82137 81079
48778 58755
215 90110
51120 51131
16823 69899
6320 72931
65015 30930
68354 78098
32070 13344
55633 13621
69157 69872
92675 79903
96312 24145
13234 89857
62310 15217
7671 50027
34561 73029
90324 42836
14988 3767
96314 18015
665 82164
49080 34432
24022 62814
89664 13182
...

output:

85431 1
81079 1
48778 1
215 1
51131 1
16823 1
72931 1
30930 1
78098 1
13344 1
13621 1
69157 1
79903 1
24145 1
13234 1
15217 1
7671 1
73029 1
90324 1
3767 1
18015 1
665 1
49080 1
24022 1
13182 1
34581 1
15439 1
37149 1
98006 1
28737 1
556 1
21022 1
81316 1
25192 1
44380 1
29136 1
94415 1
22535 1
5644...

result:

ok AC

Test #57:

score: 0
Accepted
time: 292ms
memory: 56648kb

input:

100000
54861 12509
16932 42872
34657 39417
13373 37054
53410 71695
2271 28730
77047 80422
7187 34867
94140 69441
47384 90599
15092 60892
94502 35186
58059 98865
46037 92080
96465 56648
81008 245
86644 72226
35703 96730
7922 3613
97616 90536
41294 92557
22776 10335
74308 16656
86493 81735
91472 93048...

output:

12509 1
42872 1
34657 1
33936 5430
7794 20184
28730 1
77047 1
7187 1
55538 22967
5609 53358
37220 13310
3937 7414
98865 1
46037 1
31452 45572
245 1
26897 39980
84465 63569
31122 36724
97616 1
87937 13970
22776 1
10180 5421
81735 1
16963 61858
76450 1
54929 1
95864 1
61190 1
23905 98953
13616 69502
5...

result:

ok AC

Test #58:

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

input:

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

output:

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

result:

ok AC

Test #59:

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

input:

100000
88390 1
1 51242
1 73844
73844 82993
69357 82993
82993 89153
89153 92016
36977 89153
75137 36977
82993 53533
97404 53533
49989 97404
67125 49989
53533 7006
7006 63635
60387 7006
59312 60387
24309 59312
26526 24309
24309 9985
9985 26403
60387 55203
55203 79993
79993 71230
71230 52071
52071 8306...

output:

88390 2
51242 2
1 2
73844 2
69357 1
36977 53533
92016 1
89153 1
75137 1
82993 1
7006 49989
97404 1
67125 1
49989 36977
63635 1
55203 49989
24309 55203
59312 1
26526 1
55203 26403
9985 1
60387 1
24309 71230
79993 1
24309 83065
52071 1
24309 31224
86192 1
95661 1
55189 49989
78908 1
20955 49989
6350 9...

result:

ok AC

Test #60:

score: 0
Accepted
time: 258ms
memory: 56628kb

input:

100000
1 7264
7264 69649
85097 69649
29848 85097
29848 68683
68683 42523
15272 42523
97689 15272
97689 7996
30390 7996
54151 30390
22264 54151
22264 98123
98123 16751
27570 16751
9987 27570
9987 86950
86950 67445
67445 87275
8871 87275
8871 74967
74967 53362
53362 10217
10217 52404
45262 52404
45262...

output:

1 2
73476 85097
69649 1
48416 3030
42523 48416
15272 82779
39856 48416
39856 7996
97689 1
19235 39856
19235 22264
54151 1
18187 16751
98123 1
4906 3924
11195 3924
32338 11195
1841 32338
1841 8871
87275 1
1841 53362
74967 1
52404 1841
1841 58091
1841 16808
10292 16808
10292 18694
86772 1
6840 19158
6...

result:

ok AC

Test #61:

score: 0
Accepted
time: 284ms
memory: 56472kb

input:

100000
3518 47523
14887 83452
31336 87320
47772 87482
71420 24559
99732 17539
45904 20872
52728 70439
38581 75203
18345 49294
7385 74056
95971 72826
48547 37020
61306 27212
53241 59530
32550 2892
5369 8488
4000 50453
45119 41435
5899 77096
19235 37917
75044 40239
44198 79848
23637 99807
40855 52471
...

output:

20503 66509
90115 22793
87320 1
34576 32446
1208 77457
37528 63459
19316 68703
60109 32348
18792 8794
36337 99595
5465 46999
66023 83823
37020 1
61306 1
53241 1
35671 93693
26747 40248
50453 1
879 78813
65468 76390
37917 1
40239 1
79848 1
45432 56417
55341 33315
24560 1
59232 1
97918 1
19110 30747
2...

result:

ok AC

Test #62:

score: 0
Accepted
time: 258ms
memory: 56504kb

input:

100000
56405 1
56405 66063
66801 66063
66801 9845
9845 42911
42911 64818
67482 64818
35942 67482
35942 75546
75546 4505
4505 45628
45628 29159
29159 29378
83665 29378
83665 85205
85205 94326
78400 94326
91544 78400
92293 91544
95489 92293
20854 95489
20854 94810
91796 94810
91796 49331
49331 66242
9...

output:

25176 8284
25176 66801
66063 1
20553 25176
20553 64818
20553 84998
35942 20553
67482 1
20553 4505
20553 55195
20553 29159
45628 1
20553 83665
29378 1
42753 20553
42753 31874
91544 31874
78400 1
512 95489
92293 1
94810 512
20854 1
49331 512
91796 1
9479 512
512 77776
512 30274
14120 1
512 62981
512 7...

result:

ok AC

Test #63:

score: 0
Accepted
time: 306ms
memory: 56632kb

input:

100000
29993 41605
84963 10140
60237 62389
66780 93449
98439 1174
75487 87344
56945 1098
7281 10192
90231 22033
95031 94597
88728 56965
74791 64971
68584 15462
91264 43556
80943 25018
89575 23985
46970 91618
7237 89928
26433 7488
10258 93471
44420 34919
39007 60649
64537 14238
89107 56906
58805 7576...

output:

37500 853
84963 1
48640 55085
30104 44209
46311 39747
20244 4155
13980 25692
48425 52832
90231 1
2096 51954
68747 43143
3068 20908
18749 31757
9740 2018
6097 69240
2284 76686
46970 1
3454 90126
76879 66228
17190 13694
44420 1
60649 1
14238 1
56906 1
75769 1
10846 11752
47217 20797
65153 33085
61657 ...

result:

ok AC

Test #64:

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

input:

100000
87758 1
87758 8566
8566 53230
53230 68035
45464 68035
43933 45464
7611 43933
7611 72530
72530 97898
97898 68231
2236 84498
71861 63091
76814 62314
24969 43571
98738 76356
71858 14301
12495 4041
49101 10912
83218 63817
60387 86854
59093 27607
35192 6135
76119 58917
15976 50822
5377 60508
39902...

output:

1 2
87758 2
8566 1
53230 1
68035 1
45464 1
43933 1
7611 1
72530 1
97898 1
84498 1
71861 1
76814 1
43571 1
76356 1
14301 1
4041 1
49101 1
63817 1
86854 1
59093 1
35192 1
76119 1
50822 1
5377 1
39902 1
62754 1
47841 1
23602 1
65106 1
72292 1
97173 1
64193 1
46660 1
64231 1
74997 1
7293 1
53179 1
88977...

result:

ok AC

Test #65:

score: 0
Accepted
time: 318ms
memory: 56504kb

input:

100000
49400 1
1 55311
78355 1
58471 1
25325 1
8216 1
19123 1
47311 1
1 87302
68137 1
1 98931
11168 1
1 42489
44803 1
25464 1
34243 1
63702 1
29572 1
14941 1
1 46103
1 54830
43707 1
57172 1
1 17538
75154 1
67663 1
1 6784
14487 1
45840 1
1 82849
1 77260
1 18850
1 7003
1 76083
16640 1
54748 1
46731 1
...

output:

49400 2
55311 2
78355 2
58471 2
25325 2
8216 2
19123 2
47311 2
87302 2
68137 2
98931 2
11168 2
42489 2
44803 2
25464 2
34243 2
63702 2
29572 2
14941 2
46103 2
54830 2
43707 2
57172 2
17538 2
75154 2
67663 2
6784 2
14487 2
45840 2
82849 2
77260 2
18850 2
7003 2
76083 2
16640 2
54748 2
46731 2
43207 2...

result:

ok AC

Test #66:

score: 0
Accepted
time: 285ms
memory: 56592kb

input:

100000
59098 1
88393 1
10097 1
1 27732
12542 1
1 74984
63414 1
1 68750
1 38087
65706 38087
46675 927
57918 60950
11844 60891
1200 51250
17750 31241
12177 66972
57772 85920
49826 92407
3739 18636
15328 31458
47706 69254
95722 85793
92734 12473
72338 65624
66312 27618
47426 68757
39713 32969
50029 618...

output:

59098 2
88393 2
10097 2
27732 2
12542 2
74984 2
63414 2
68750 2
1 2
38087 2
46675 1
60950 1
60891 1
51250 1
17750 1
66972 1
57772 1
49826 1
3739 1
31458 1
47706 1
85793 1
12473 1
72338 1
27618 1
68757 1
39713 1
61891 1
54472 1
65357 1
68498 1
43879 1
12766 1
56491 1
65221 1
33848 1
32753 1
54306 1
4...

result:

ok AC

Test #67:

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

input:

5
2 1
1 3
4 1
5 4

output:

2 3
4 2
1 5
5 2

result:

ok AC

Test #68:

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

input:

5
4 1
3 1
5 1
5 2

output:

4 2
3 2
1 2
5 3

result:

ok AC

Test #69:

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

input:

5
5 1
3 1
1 2
2 4

output:

5 2
3 2
1 4
3 4

result:

ok AC