QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#186976#5545. Contingency PlanMaMengQiAC ✓225ms109624kbC++203.6kb2023-09-24 13:38:272023-09-24 13:38:28

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 19ms
memory: 82756kb

input:

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

output:

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

result:

ok AC

Test #2:

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

input:

3
1 2
2 3

output:

-1

result:

ok AC

Test #3:

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

input:

2
2 1

output:

-1

result:

ok AC

Test #4:

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

input:

5
2 1
2 3
2 4
4 5

output:

4 1
4 3
5 2
1 5

result:

ok AC

Test #5:

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

input:

5
1 4
3 4
4 5
2 5

output:

5 1
5 3
2 4
1 2

result:

ok AC

Test #6:

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

input:

5
5 2
1 2
4 2
3 4

output:

4 5
4 1
3 2
5 3

result:

ok AC

Test #7:

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

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:

19999 2
19999 3
19999 4
19999 5
19999 6
19999 7
19999 8
19999 9
19999 10
19999 11
19999 12
19999 13
19999 14
19999 15
19999 16
19999 17
19999 18
19999 19
19999 20
19999 21
19999 22
19999 23
19999 24
19999 25
19999 26
19999 27
19999 28
19999 29
19999 30
19999 31
19999 32
19999 33
19999 34
19999 35
19...

result:

ok AC

Test #8:

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

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:

11055 7662
11055 9205
11055 5971
11055 9886
11055 18853
11055 14108
11055 998
11055 14958
11055 7100
11055 2670
11055 18493
11055 13838
11055 4644
11055 2139
11055 18540
11055 14081
11055 16836
11055 9357
11055 245
11055 242
11055 13472
11055 1471
11055 3792
11055 17875
11055 13976
11055 15085
11055...

result:

ok AC

Test #9:

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

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:

17288 8854
17288 15635
17288 8088
17288 12138
17288 12367
17288 15051
17288 6392
17288 15564
17288 17334
17288 10164
17288 8704
17288 13795
17288 10292
17288 12108
17288 50
17288 4
17288 18364
17288 13341
17288 19203
17288 3017
17288 5133
17288 3499
17288 19202
17288 10304
17288 12975
17288 17220
17...

result:

ok AC

Test #10:

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

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:

19999 1
19999 3
19999 4
19999 5
19999 6
19999 7
19999 8
19999 9
19999 10
19999 11
19999 12
19999 13
19999 14
19999 15
19999 16
19999 17
19999 18
19999 19
19999 20
19999 21
19999 22
19999 23
19999 24
19999 25
19999 26
19999 27
19999 28
19999 29
19999 30
19999 31
19999 32
19999 33
19999 34
19999 35
19...

result:

ok AC

Test #11:

score: 0
Accepted
time: 26ms
memory: 86864kb

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:

1064 1
1064 19998
1064 3314
1064 3339
1064 10237
1064 13244
1064 3392
1064 4459
1064 17335
1064 10356
1064 6124
1064 4470
1064 12896
1064 12094
1064 3309
1064 13319
1064 15658
1064 2305
1064 13710
1064 16520
1064 16234
1064 6697
1064 6686
1064 9187
1064 43
1064 2764
1064 9061
1064 8113
1064 8449
106...

result:

ok AC

Test #12:

score: 0
Accepted
time: 30ms
memory: 88108kb

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:

14227 4030
14227 1206
14227 8947
14227 4887
14227 14605
14227 2947
14227 9038
14227 5326
14227 9021
14227 11087
14227 19562
14227 895
14227 14653
14227 10803
14227 9750
14227 16331
14227 4689
14227 14307
14227 11631
14227 13244
14227 10554
14227 8112
14227 9394
14227 5945
14227 15279
14227 15512
142...

result:

ok AC

Test #13:

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

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:

99999 2
99999 3
99999 4
99999 5
99999 6
99999 7
99999 8
99999 9
99999 10
99999 11
99999 12
99999 13
99999 14
99999 15
99999 16
99999 17
99999 18
99999 19
99999 20
99999 21
99999 22
99999 23
99999 24
99999 25
99999 26
99999 27
99999 28
99999 29
99999 30
99999 31
99999 32
99999 33
99999 34
99999 35
99...

result:

ok AC

Test #14:

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

input:

5
2 1
3 2
4 3
5 4

output:

3 1
4 2
1 4
3 5

result:

ok AC

Test #15:

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

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:

63055 21871
63055 13678
63055 27196
63055 70437
63055 35891
63055 43010
63055 28018
63055 64489
63055 61157
63055 35572
63055 41613
63055 73049
63055 93865
63055 83507
63055 92127
63055 86278
63055 15004
63055 44154
63055 2005
63055 94210
63055 41410
63055 5886
63055 69836
63055 24120
63055 80802
63...

result:

ok AC

Test #16:

score: 0
Accepted
time: 80ms
memory: 107296kb

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:

49349 12976
49349 28108
49349 87682
49349 79359
49349 16128
49349 90652
49349 55874
49349 27276
49349 66899
49349 10296
49349 37870
49349 78978
49349 26221
49349 28589
49349 46430
49349 32252
49349 22407
49349 68230
49349 64944
49349 53457
49349 31023
49349 57101
49349 82578
49349 33273
49349 69683
...

result:

ok AC

Test #17:

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

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:

99999 1
99999 3
99999 4
99999 5
99999 6
99999 7
99999 8
99999 9
99999 10
99999 11
99999 12
99999 13
99999 14
99999 15
99999 16
99999 17
99999 18
99999 19
99999 20
99999 21
99999 22
99999 23
99999 24
99999 25
99999 26
99999 27
99999 28
99999 29
99999 30
99999 31
99999 32
99999 33
99999 34
99999 35
99...

result:

ok AC

Test #18:

score: 0
Accepted
time: 91ms
memory: 109084kb

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:

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

result:

ok AC

Test #19:

score: 0
Accepted
time: 73ms
memory: 108244kb

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:

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

result:

ok AC

Test #20:

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

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:

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

result:

ok AC

Test #21:

score: 0
Accepted
time: 24ms
memory: 87308kb

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:

11073 14400
11073 16805
11073 11979
11073 5949
11073 9916
11073 2445
11073 15141
11073 16655
11073 16186
11073 1523
11073 1443
11073 10091
11073 9218
11073 16617
11073 16466
11073 1217
11073 19150
11073 2830
11073 7234
11073 11460
11073 8101
11073 6331
11073 14871
11073 10725
11073 12241
11073 8902
...

result:

ok AC

Test #22:

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

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:

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

result:

ok AC

Test #23:

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

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:

10008 1
10008 7210
10008 2389
10008 18377
10008 4410
10008 7905
10008 14849
10008 12441
10008 9005
10008 17807
10008 6619
10008 6604
10008 6913
10008 5811
10008 7249
10008 1582
10008 8857
10008 4507
10008 10077
10008 4687
10008 8607
10008 16870
10008 3298
10008 2376
10008 9009
10008 10729
10008 1987...

result:

ok AC

Test #24:

score: 0
Accepted
time: 26ms
memory: 87740kb

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:

15430 19213
15430 12395
15430 12980
15430 7848
15430 11920
15430 6906
15430 3923
15430 4837
15430 11135
15430 2457
15430 9770
15430 10251
15430 6770
15430 12079
15430 7559
15430 15051
15430 1146
15430 17621
15430 8041
15430 19973
15430 11112
15430 3176
15430 957
15430 830
15430 3194
15430 11400
1543...

result:

ok AC

Test #25:

score: 0
Accepted
time: 23ms
memory: 82600kb

input:

5
2 1
3 1
4 1
1 5

output:

-1

result:

ok AC

Test #26:

score: 0
Accepted
time: 27ms
memory: 87836kb

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:

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

result:

ok AC

Test #27:

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

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:

14555 17253
14555 5390
14555 10221
14555 16259
14555 8902
14555 10509
14555 16551
14555 13314
14555 12754
14555 11707
14555 7781
14555 2105
14555 18132
14555 12907
14555 5609
14555 15234
14555 18609
14555 13919
14555 13882
14555 15621
14555 1997
14555 14002
14555 18056
14555 7498
14555 13534
14555 1...

result:

ok AC

Test #28:

score: 0
Accepted
time: 27ms
memory: 88640kb

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:

6405 5445
6405 12966
6405 8179
6405 5779
6405 9123
6405 5079
6405 5478
6405 13748
6405 7203
6405 7645
6405 14929
6405 4717
6405 4564
6405 14318
6405 7348
6405 17915
6405 15109
6405 3853
6405 15246
6405 8228
6405 7726
6405 16617
6405 16607
6405 6228
6405 1615
6405 11897
6405 14499
6405 19530
6405 154...

result:

ok AC

Test #29:

score: 0
Accepted
time: 25ms
memory: 86836kb

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:

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

result:

ok AC

Test #30:

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

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:

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

result:

ok AC

Test #31:

score: 0
Accepted
time: 26ms
memory: 87424kb

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:

13331 18166
13331 17313
13331 12716
13331 11207
13331 831
13331 7420
13331 1161
13331 575
13331 3052
13331 7101
13331 18976
13331 18772
13331 18805
13331 866
13331 8160
13331 15062
13331 19241
13331 11876
13331 613
13331 15035
13331 16531
13331 11665
13331 15722
13331 14843
13331 3123
13331 14519
13...

result:

ok AC

Test #32:

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

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: 46ms
memory: 86748kb

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: 27ms
memory: 87628kb

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:

5376 12144
5376 8713
5376 10266
5376 6116
5376 5943
5376 10496
5376 9193
5376 4497
5376 5480
5376 6858
5376 3003
5376 1958
5376 5579
5376 12167
5376 16648
5376 18876
5376 10656
5376 6918
5376 5632
5376 10135
5376 11253
5376 10068
5376 3833
5376 16257
5376 6924
5376 9806
5376 8077
5376 8650
5376 9461...

result:

ok AC

Test #35:

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

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:

1131 1284
1131 1436
1131 17852
1131 13068
1131 19730
1131 15453
1131 3888
1131 5853
1131 18440
1131 5242
1131 12315
1131 12021
1131 19105
1131 1977
1131 11095
1131 4122
1131 4873
1131 10548
1131 11649
1131 1199
1131 228
1131 4006
1131 10763
1131 1980
1131 9649
1131 11446
1131 14111
1131 14896
1131 6...

result:

ok AC

Test #36:

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

input:

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

output:

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

result:

ok AC

Test #37:

score: 0
Accepted
time: 27ms
memory: 87396kb

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:

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

result:

ok AC

Test #38:

score: 0
Accepted
time: 16ms
memory: 87008kb

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:

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

result:

ok AC

Test #39:

score: 0
Accepted
time: 22ms
memory: 87276kb

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:

2411 3828
2411 5873
2411 17224
2411 7554
2411 6507
2411 17619
2411 1012
2411 18616
2411 19398
2411 16411
2411 578
2411 9621
2411 9684
2411 16733
2411 19501
2411 3217
2411 11111
2411 6539
2411 12001
2411 2251
2411 13411
2411 9228
2411 15833
2411 4315
2411 19092
2411 8033
2411 1103
2411 12722
2411 526...

result:

ok AC

Test #40:

score: 0
Accepted
time: 25ms
memory: 88280kb

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:

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

result:

ok AC

Test #41:

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

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:

18755 11751
18755 1300
18755 9597
18755 11201
18755 6089
18755 10054
18755 17666
18755 14050
18755 6286
18755 10070
18755 10053
18755 8076
18755 13628
18755 17144
18755 16159
18755 10414
18755 4857
18755 15396
18755 6623
18755 3946
18755 17484
18755 4063
18755 7551
18755 3439
18755 6076
18755 1678
1...

result:

ok AC

Test #42:

score: 0
Accepted
time: 90ms
memory: 105788kb

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:

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

result:

ok AC

Test #43:

score: 0
Accepted
time: 99ms
memory: 107024kb

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:

55339 37174
55339 26356
55339 70911
55339 20298
55339 89704
55339 74497
55339 14492
55339 10546
55339 71677
55339 28838
55339 23003
55339 41920
55339 95159
55339 34895
55339 74794
55339 10195
55339 54295
55339 21621
55339 70922
55339 56725
55339 67745
55339 30390
55339 31050
55339 78533
55339 8591
5...

result:

ok AC

Test #44:

score: 0
Accepted
time: 79ms
memory: 105328kb

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:

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

result:

ok AC

Test #45:

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

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:

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

result:

ok AC

Test #46:

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

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:

67765 82182
67765 74187
67765 83434
67765 30609
67765 97443
67765 93951
67765 57868
67765 24839
67765 91314
67765 9148
67765 817
67765 56692
67765 67828
67765 79432
67765 64090
67765 44758
67765 26481
67765 70283
67765 76180
67765 2183
67765 17086
67765 38661
67765 69441
67765 50770
67765 13969
6776...

result:

ok AC

Test #47:

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

input:

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

output:

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

result:

ok AC

Test #48:

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

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:

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

result:

ok AC

Test #49:

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

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:

67497 70720
67497 71027
67497 48338
67497 61809
67497 79963
67497 39740
67497 86644
67497 14939
67497 39918
67497 41470
67497 23364
67497 54664
67497 96370
67497 53835
67497 67313
67497 33696
67497 44243
67497 50423
67497 70539
67497 73776
67497 560
67497 98363
67497 71623
67497 72365
67497 73548
67...

result:

ok AC

Test #50:

score: 0
Accepted
time: 100ms
memory: 107116kb

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:

28954 55448
28954 4084
28954 22193
28954 13008
28954 82824
28954 91893
28954 72105
28954 5791
28954 44950
28954 11997
28954 42216
28954 41770
28954 20892
28954 68055
28954 22893
28954 47065
28954 54015
28954 91519
28954 80483
28954 1399
28954 23550
28954 46619
28954 47878
28954 85576
28954 37319
289...

result:

ok AC

Test #51:

score: 0
Accepted
time: 79ms
memory: 107292kb

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:

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

result:

ok AC

Test #52:

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

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:

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

result:

ok AC

Test #53:

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

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:

66663 5616
66663 70847
66663 13256
66663 87054
66663 65173
66663 24104
66663 29759
66663 62107
66663 58386
66663 68628
66663 41963
66663 93835
66663 68599
66663 40426
66663 52295
66663 84045
66663 22218
66663 24089
66663 64952
66663 21273
66663 21618
66663 76924
66663 27278
66663 6790
66663 82355
66...

result:

ok AC

Test #54:

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

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: 225ms
memory: 107668kb

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: 79ms
memory: 106228kb

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:

10319 85431
10319 81079
10319 48778
10319 215
10319 51131
10319 16823
10319 72931
10319 30930
10319 78098
10319 13344
10319 13621
10319 69157
10319 79903
10319 24145
10319 13234
10319 15217
10319 7671
10319 73029
10319 90324
10319 3767
10319 18015
10319 665
10319 49080
10319 24022
10319 13182
10319 ...

result:

ok AC

Test #57:

score: 0
Accepted
time: 82ms
memory: 106924kb

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:

85080 12509
85080 42872
85080 34657
85080 37054
85080 53410
85080 28730
85080 77047
85080 7187
85080 94140
85080 47384
85080 60892
85080 35186
85080 98865
85080 46037
85080 96465
85080 245
85080 86644
85080 96730
85080 3613
85080 97616
85080 41294
85080 22776
85080 74308
85080 81735
85080 93048
8508...

result:

ok AC

Test #58:

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

input:

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

output:

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

result:

ok AC

Test #59:

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

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:

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

result:

ok AC

Test #60:

score: 0
Accepted
time: 82ms
memory: 106748kb

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:

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

result:

ok AC

Test #61:

score: 0
Accepted
time: 80ms
memory: 105996kb

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:

83288 3518
83288 14887
83288 87320
83288 87482
83288 71420
83288 99732
83288 20872
83288 70439
83288 38581
83288 49294
83288 7385
83288 95971
83288 37020
83288 61306
83288 53241
83288 2892
83288 8488
83288 50453
83288 45119
83288 77096
83288 37917
83288 40239
83288 79848
83288 99807
83288 52471
8328...

result:

ok AC

Test #62:

score: 0
Accepted
time: 54ms
memory: 107780kb

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:

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

result:

ok AC

Test #63:

score: 0
Accepted
time: 94ms
memory: 106740kb

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:

6728 29993
6728 84963
6728 62389
6728 66780
6728 1174
6728 87344
6728 1098
6728 7281
6728 90231
6728 95031
6728 88728
6728 74791
6728 15462
6728 91264
6728 80943
6728 89575
6728 46970
6728 7237
6728 26433
6728 93471
6728 44420
6728 60649
6728 14238
6728 56906
6728 75769
6728 48637
6728 58272
6728 42...

result:

ok AC

Test #64:

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

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:

35750 1
35750 87758
35750 8566
35750 53230
35750 68035
35750 45464
35750 43933
35750 7611
35750 72530
35750 97898
35750 84498
35750 71861
35750 76814
35750 43571
35750 76356
35750 14301
35750 4041
35750 49101
35750 63817
35750 86854
35750 59093
35750 35192
35750 76119
35750 50822
35750 5377
35750 39...

result:

ok AC

Test #65:

score: 0
Accepted
time: 83ms
memory: 109624kb

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:

50614 49400
50614 55311
50614 78355
50614 58471
50614 25325
50614 8216
50614 19123
50614 47311
50614 87302
50614 68137
50614 98931
50614 11168
50614 42489
50614 44803
50614 25464
50614 34243
50614 63702
50614 29572
50614 14941
50614 46103
50614 54830
50614 43707
50614 57172
50614 17538
50614 75154
5...

result:

ok AC

Test #66:

score: 0
Accepted
time: 80ms
memory: 105148kb

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:

8943 59098
8943 88393
8943 10097
8943 27732
8943 12542
8943 74984
8943 63414
8943 68750
8943 1
8943 38087
8943 46675
8943 60950
8943 60891
8943 51250
8943 17750
8943 66972
8943 57772
8943 49826
8943 3739
8943 31458
8943 47706
8943 85793
8943 12473
8943 72338
8943 27618
8943 68757
8943 39713
8943 618...

result:

ok AC

Test #67:

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

input:

5
2 1
1 3
4 1
5 4

output:

4 2
4 3
5 1
2 5

result:

ok AC

Test #68:

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

input:

5
4 1
3 1
5 1
5 2

output:

5 4
5 3
2 1
4 2

result:

ok AC

Test #69:

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

input:

5
5 1
3 1
1 2
2 4

output:

2 5
2 3
4 1
5 4

result:

ok AC