QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#937169#8185. Emerging TreeNatsuhi Kage (Qiyu Feng, Jianing Liu, Zemu Zhu) #AC ✓664ms189520kbC++233.4kb2025-03-16 11:59:122025-03-16 11:59:14

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 5ms
memory: 14192kb

input:

4
3 1
1 4
1 2

output:

Yes
2 4 1 3

result:

ok found a correct permutation

Test #2:

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

input:

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

output:

No

result:

ok desired permutation does not exist

Test #3:

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

input:

6
1 2
2 3
2 4
3 5
4 6

output:

No

result:

ok desired permutation does not exist

Test #4:

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

input:

6
2 3
2 5
2 1
2 6
5 4

output:

Yes
2 3 4 6 5 1

result:

ok found a correct permutation

Test #5:

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

input:

6
6 1
6 3
3 4
3 2
4 5

output:

No

result:

ok desired permutation does not exist

Test #6:

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

input:

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

output:

Yes
9 5 4 8 7 11 6 10 2 1 3

result:

ok found a correct permutation

Test #7:

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

input:

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

output:

Yes
1 3 4 5 6 9 7 8 2 10

result:

ok found a correct permutation

Test #8:

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

input:

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

output:

Yes
1 5 2 6 3 4 7

result:

ok found a correct permutation

Test #9:

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

input:

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

output:

Yes
1 2 3 4 6 8 5 9 7 10

result:

ok found a correct permutation

Test #10:

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

input:

134
27 60
41 112
41 117
86 97
40 41
99 107
41 47
124 130
37 124
40 54
75 121
67 75
40 99
76 86
50 56
40 63
18 40
16 67
50 73
18 43
93 131
79 105
13 69
53 98
71 79
67 74
13 16
26 28
27 31
69 71
13 66
46 118
29 46
31 123
50 53
66 110
19 58
3 18
38 95
115 132
26 50
55 126
3 13
31 115
93 101
14 26
37 52...

output:

Yes
6 7 102 15 24 74 25 23 5 41 8 63 119 42 58 118 76 103 28 85 87 64 91 92 93 43 51 44 13 3 53 99 66 126 22 84 67 130 21 104 105 77 113 35 100 12 108 14 59 45 1 70 48 109 26 46 101 29 78 52 133 9 112 96 90 124 117 132 120 36 121 81 47 114 116 30 134 86 122 79 34 57 73 80 71 31 20 97 16 10 50 75 127...

result:

ok found a correct permutation

Test #11:

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

input:

2
1 2

output:

Yes
1 2

result:

ok found a correct permutation

Test #12:

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

input:

2
2 1

output:

Yes
2 1

result:

ok found a correct permutation

Test #13:

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

input:

860
250 607
470 735
560 640
250 309
250 253
640 685
188 553
512 612
448 730
264 470
136 264
188 250
169 549
289 654
309 512
250 560
169 188
270 537
431 495
438 635
132 169
225 448
225 614
405 771
329 829
270 405
243 329
243 438
188 289
188 591
264 618
136 225
136 323
302 710
232 431
132 270
132 243
...

output:

Yes
5 642 19 20 450 272 404 6 21 640 22 508 23 24 287 126 271 180 392 721 359 132 308 134 621 159 250 131 742 509 504 516 648 294 408 128 507 40 649 650 41 666 794 601 68 639 696 181 517 154 419 607 183 777 539 440 260 643 7 296 550 796 579 750 620 239 145 588 186 469 503 38 635 452 759 305 364 501 ...

result:

ok found a correct permutation

Test #14:

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

input:

575
227 291
227 232
275 404
489 552
226 227
149 275
226 567
149 472
131 149
113 131
327 469
113 205
205 560
113 305
344 409
263 372
150 278
372 489
226 263
278 344
196 327
132 144
150 248
144 196
95 524
370 463
132 369
59 511
70 207
70 226
59 147
123 132
123 195
361 395
32 34
225 523
60 70
95 533
12...

output:

Yes
1 13 14 313 15 255 362 36 537 46 230 454 84 86 363 218 314 16 531 312 483 403 227 538 243 487 256 310 428 286 494 47 271 48 573 34 319 488 320 466 376 17 27 539 126 370 561 415 136 482 516 429 435 524 257 306 239 489 127 49 323 186 231 112 481 504 382 333 387 50 174 63 157 317 527 152 2 111 110 ...

result:

ok found a correct permutation

Test #15:

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

input:

69
34 43
34 48
28 34
41 59
39 47
28 33
39 54
17 18
17 69
39 41
28 39
17 28
8 17
6 19
6 16
21 46
21 60
6 14
17 21
8 58
32 38
8 44
38 40
25 66
4 8
10 61
10 49
23 32
12 31
15 25
20 23
8 20
12 64
4 12
27 51
15 27
29 65
4 15
37 45
30 37
29 30
14 29
6 10
22 56
22 68
4 22
36 50
50 55
2 36
6 42
1 2
13 35
13...

output:

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

result:

ok found a correct permutation

Test #16:

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

input:

338
169 334
302 324
226 249
186 302
136 169
59 63
76 158
63 205
169 186
67 136
67 230
46 76
63 199
28 67
46 59
77 336
184 267
85 258
184 221
77 127
182 239
184 210
239 300
46 283
211 226
155 184
267 301
35 211
85 114
155 182
39 245
35 185
39 77
39 46
26 85
28 35
160 268
155 331
140 162
140 155
49 17...

output:

Yes
1 252 293 113 255 139 258 111 104 140 259 237 120 261 286 143 266 243 4 319 5 299 262 294 144 173 75 145 303 209 56 6 9 213 154 71 190 208 177 55 61 100 314 226 60 182 278 253 195 97 207 326 330 218 23 7 306 321 185 133 48 24 186 171 260 192 146 121 233 68 327 315 10 88 137 183 179 334 96 234 47...

result:

ok found a correct permutation

Test #17:

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

input:

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

output:

Yes
4 3 11 13 2 8 6 9 7 10 1 12 5

result:

ok found a correct permutation

Test #18:

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

input:

4
2 4
3 1
3 2

output:

Yes
2 3 1 4

result:

ok found a correct permutation

Test #19:

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

input:

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

output:

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

result:

ok found a correct permutation

Test #20:

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

input:

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

output:

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

result:

ok found a correct permutation

Test #21:

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

input:

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

output:

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

result:

ok found a correct permutation

Test #22:

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

input:

90
34 29
7 34
10 7
10 53
31 73
88 83
64 41
37 71
26 22
78 55
89 72
33 16
77 80
24 26
24 31
1 37
33 64
10 38
12 81
78 75
1 78
89 1
62 89
13 14
65 88
84 13
44 10
44 45
77 23
30 56
77 49
8 30
85 12
51 46
79 77
50 47
50 44
25 2
8 25
90 85
8 58
79 90
70 3
65 50
35 84
35 27
66 51
9 62
63 11
63 40
33 24
65...

output:

Yes
35 61 85 64 73 75 48 57 31 47 68 13 79 80 30 19 76 83 2 87 29 24 9 22 60 23 81 28 50 58 25 86 18 49 77 74 36 52 82 69 21 88 5 46 53 56 45 3 10 44 55 65 51 15 39 59 63 62 90 72 71 32 67 20 41 54 1 89 4 84 37 34 26 16 40 27 7 38 6 8 14 70 43 78 12 66 17 42 33 11

result:

ok found a correct permutation

Test #23:

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

input:

204
106 103
106 160
106 99
131 30
162 131
162 174
106 87
96 51
163 150
26 161
163 26
96 54
94 96
116 81
115 176
2 46
163 105
65 90
94 133
35 115
106 175
62 2
68 140
68 162
68 116
35 68
201 21
15 28
36 139
58 49
58 110
84 106
8 88
35 62
58 170
102 109
191 69
53 58
84 94
16 19
16 102
182 191
124 79
5 ...

output:

Yes
185 55 191 140 11 93 190 75 86 15 157 23 107 121 151 67 168 71 68 119 74 98 142 100 115 63 94 152 130 50 96 154 172 179 43 164 143 116 201 102 175 183 166 186 109 56 114 182 5 158 40 153 3 41 82 131 173 4 90 81 187 54 103 72 59 110 87 46 21 138 14 124 122 25 163 99 160 189 13 84 53 184 192 31 11...

result:

ok found a correct permutation

Test #24:

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

input:

333
26 306
26 136
184 9
207 105
207 208
184 207
29 80
153 210
22 283
95 320
22 29
102 177
277 184
198 153
307 102
155 307
22 230
260 22
34 95
277 198
277 54
297 26
297 90
155 297
260 277
110 64
155 34
192 333
73 224
73 38
157 73
155 331
110 75
192 5
12 308
260 192
157 262
290 12
119 202
157 120
260 ...

output:

Yes
143 290 159 244 38 183 257 98 28 7 71 277 320 314 79 248 161 50 331 134 122 21 175 140 321 106 308 250 23 177 282 138 12 110 254 1 114 205 115 100 81 17 131 192 63 176 166 262 120 74 326 46 216 35 127 4 223 240 208 266 145 196 180 40 209 70 15 197 267 268 58 298 203 9 41 84 165 150 168 24 303 21...

result:

ok found a correct permutation

Test #25:

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

input:

946
290 383
295 450
835 295
290 222
835 290
835 410
770 835
812 339
548 645
80 594
557 632
333 576
405 282
231 333
770 231
80 546
936 405
142 207
398 142
557 936
548 770
616 662
557 123
616 398
72 721
160 807
548 616
225 742
731 225
658 635
80 269
233 67
522 80
459 812
233 459
72 786
548 557
364 522...

output:

Yes
777 556 647 504 482 607 152 578 314 583 678 85 153 821 419 406 81 285 445 459 159 662 54 661 516 8 544 824 407 248 36 92 881 284 233 3 799 243 523 513 236 576 405 29 107 862 301 945 784 232 1 574 40 420 798 734 246 417 800 842 427 191 526 836 135 603 370 532 540 74 901 391 283 297 900 569 942 23...

result:

ok found a correct permutation

Test #26:

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

input:

4902
1284 2577
1884 234
284 1884
3094 829
3094 1284
1982 3057
3800 1982
284 3094
4564 4124
273 2123
2420 3157
4750 1590
3795 4750
1763 3745
3858 4564
950 2579
950 1014
1639 431
75 1639
1763 2314
275 2420
3255 3858
273 4257
275 273
3543 2991
75 3543
399 75
616 1763
4414 3795
616 3255
3443 4414
2556 3...

output:

Yes
63 3124 2995 4244 1206 2599 4189 3407 978 1726 3911 3047 2162 3199 3359 3237 4459 3645 4698 4427 1943 2448 2507 808 416 1079 3855 2681 2554 4631 255 1032 1862 1243 1639 4518 3384 4691 875 2467 2978 623 2518 1433 4710 2794 4547 1690 209 3132 527 4874 2823 4627 452 4030 4767 2024 2010 4389 3998 44...

result:

ok found a correct permutation

Test #27:

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

input:

4806
1323 2121
2230 4186
788 3982
2642 788
2642 564
1873 2099
738 1328
1873 2191
2847 2309
2642 2847
1323 1873
1825 1774
4748 1802
258 2510
2021 4003
3049 4748
3137 3049
738 4002
1323 1912
1901 2203
922 1323
2642 258
531 2642
531 2021
3137 1901
3072 2230
3137 738
365 915
1825 2495
2339 2672
2339 112...

output:

Yes
2620 3558 3159 1894 2049 97 1452 516 3461 134 2972 1693 3242 737 2798 582 2245 2520 4132 4081 2634 2330 3820 2927 4267 3210 3805 2854 3668 753 949 2933 1502 2838 1407 4066 3314 1197 3827 64 4161 72 2662 52 1446 4393 4255 3414 895 2993 1873 4787 775 3333 406 3933 4254 4109 199 2200 2783 963 1412 ...

result:

ok found a correct permutation

Test #28:

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

input:

57478
25943 27109
25943 41788
44997 30807
19873 25943
5712 38654
35748 16656
19873 35748
37705 12786
11233 24996
24839 20138
12788 48829
24839 42771
44997 19873
45722 25672
1958 43781
5886 28038
44997 5712
46430 5886
57217 4440
12788 45722
14711 46430
37705 55027
6956 54641
20971 24827
56 48271
56 1...

output:

Yes
55620 33405 40791 49618 40778 38638 19057 38899 20389 41065 31766 40257 15663 16650 25063 26633 41706 56334 9580 47797 33871 49276 6148 6171 15369 42980 55808 30963 19142 31576 42473 822 20519 17693 41173 138 28467 26274 16573 53467 24015 51275 2913 40684 33291 43086 8157 35759 55871 29892 51000...

result:

ok found a correct permutation

Test #29:

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

input:

7395
7020 4856
7020 2696
1422 7020
1422 2091
4689 6210
4689 5356
5970 1422
5970 4689
5970 5031
6971 7038
6971 2030
6709 1960
6743 7392
4385 5970
7019 6747
6709 7019
6743 7334
7081 4479
6709 2291
427 826
22 6971
6554 4178
6762 352
61 819
6286 7081
4224 3580
7212 6286
22 6709
6987 22
4751 4086
5114 36...

output:

Yes
6199 393 4978 6053 1279 360 658 5342 803 2346 1018 6188 2268 3156 5663 1428 6364 6223 5907 3114 5237 1337 1176 3667 6818 6418 7032 2119 7170 6109 5619 3429 7225 80 5179 2231 5998 5480 2126 3833 3879 7301 6189 6678 26 4373 1290 391 7217 1407 2632 5671 3416 7175 2672 2436 6378 3771 2114 5445 4131 ...

result:

ok found a correct permutation

Test #30:

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

input:

9395
740 2477
4046 2958
814 3097
7831 740
814 4046
7940 4831
7831 7940
5537 2624
690 2288
5290 4927
5537 6283
6665 9103
3044 7992
7703 5763
2447 5392
3881 7129
5290 8526
2616 9008
7467 8998
3143 5290
1735 7467
7163 1735
8697 3881
8697 51
4129 3044
2527 6642
8697 1342
2125 3332
8841 8697
690 8841
716...

output:

Yes
8747 9266 1162 6621 8680 1518 1501 2279 29 1915 7790 7794 3684 7781 8573 5186 373 2296 1468 3918 5953 5945 7402 2010 5393 4269 2892 2384 47 309 2387 8647 2586 4782 8086 3697 8328 6952 4078 5178 4617 6955 5148 9179 5437 945 4756 6355 3252 8197 2217 1636 749 1668 544 683 3823 4409 8718 8212 82 613...

result:

ok found a correct permutation

Test #31:

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

input:

78246
43806 38136
61399 64372
72081 6749
43806 61399
13961 69078
18493 21377
13961 65420
14202 63014
44774 73623
71751 44774
60561 5881
78157 24782
59322 35844
13961 15113
58435 14202
58435 78157
71751 43806
12664 63633
62320 18493
36759 54596
59322 58435
60333 39059
72081 13961
12664 30563
17370 35...

output:

Yes
28582 2358 58843 71470 5234 22208 45909 26261 68850 23792 24123 36490 27109 56518 59279 18939 17638 6881 71699 68723 38700 9052 54580 36039 11516 78219 66630 12031 20890 38450 58373 1688 77417 40157 66150 49304 18646 22539 72457 62185 25580 24420 48597 34947 8844 70877 65086 58042 6534 62805 713...

result:

ok found a correct permutation

Test #32:

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

input:

49319
12653 24062
12653 3794
17553 41711
255 12653
15187 17553
44944 24149
255 27853
8554 15187
8554 255
8554 38796
19701 15450
16426 47166
8554 31081
5062 23406
10550 39856
29178 10550
47675 18049
20716 8554
43558 18987
31246 20716
43901 2432
17409 39935
47883 5062
41057 24360
12475 17892
43901 410...

output:

Yes
10579 31758 7755 22399 6036 25113 41259 26591 1487 25050 10018 2727 40667 29433 27725 44562 32890 16560 960 17126 37905 47974 34241 9495 35390 10399 27042 26027 39016 39457 29395 29567 13327 2907 31912 15464 34428 7070 11040 20978 46015 8767 42425 6601 11660 16902 15930 30374 27178 3719 18455 22...

result:

ok found a correct permutation

Test #33:

score: 0
Accepted
time: 256ms
memory: 88248kb

input:

551254
251911 71255
489827 251911
488662 34905
50106 442695
508256 488662
478660 415396
392947 434029
468919 80138
542236 405026
528977 98716
542236 521188
283749 288422
183762 392947
163173 50106
283749 542236
188267 402038
44375 442457
77084 317105
192296 99454
163006 204759
325131 461669
283749 3...

output:

Yes
344586 450814 450568 303665 13092 127090 453 294447 203944 175004 401719 514243 410898 116958 434518 413318 544590 427876 373367 97460 266206 549111 214809 349960 178563 410084 49225 73711 322191 405719 241571 241905 274822 121360 487067 113559 145592 367473 190540 121661 155647 329790 274361 12...

result:

ok found a correct permutation

Test #34:

score: 0
Accepted
time: 383ms
memory: 113236kb

input:

763206
367130 594014
431201 367130
301675 431201
6985 129584
252366 6985
252366 301675
696627 59251
745706 696627
611578 252366
745706 611578
278251 175831
660838 745706
371079 719587
190504 660838
278251 72839
129724 512428
201686 393546
278251 68023
190504 733918
202607 278251
371079 512913
369590...

output:

Yes
43517 762657 658238 356941 99523 347481 619365 157703 232037 683373 639937 329820 220114 363414 635609 278072 601483 316726 281728 108476 530184 569192 428551 436774 329826 115867 570736 692419 501321 383795 735976 39144 378027 345081 525611 390452 436494 466628 636082 151309 714503 263903 72252...

result:

ok found a correct permutation

Test #35:

score: 0
Accepted
time: 92ms
memory: 39624kb

input:

223154
62250 16305
172731 175564
138113 172731
62250 3441
46605 155902
46605 136243
125125 126803
46605 62250
60262 125125
60262 79994
196144 60894
186093 46605
186093 196144
82105 6263
186093 82105
25986 65697
27490 138113
64443 114028
129598 28490
64443 158694
25986 223073
51314 186093
152619 1295...

output:

Yes
167237 129799 214040 215302 161957 176338 169764 167106 141502 182698 175217 193194 220573 35996 109559 138759 176432 27442 205839 79217 143638 81012 139590 105262 209573 143928 23356 112775 194451 7579 43612 14145 10793 159492 72189 148986 29781 196017 128536 30966 205014 127888 49823 76033 134...

result:

ok found a correct permutation

Test #36:

score: 0
Accepted
time: 238ms
memory: 86364kb

input:

533539
248224 432211
364355 248224
365646 138082
365646 33997
365646 509315
3223 330716
365646 364355
211267 178616
523906 530242
296431 341244
468884 523906
35138 141513
85726 211267
62177 85726
518534 353727
17658 330633
296431 205093
24323 17658
403088 307387
180011 472310
248959 457324
217372 42...

output:

Yes
413740 222742 107636 331509 363422 472574 32834 92160 23415 381356 369451 419372 391551 308688 304532 97275 390969 54978 101137 239751 21882 422255 175956 422051 243621 174700 29187 498965 115953 514973 324276 255247 480158 487396 69127 152815 454266 366331 507966 36872 179220 384730 510130 2652...

result:

ok found a correct permutation

Test #37:

score: 0
Accepted
time: 413ms
memory: 121436kb

input:

836471
327553 543071
488737 662624
169438 471042
288914 96590
169438 488737
503661 169438
349745 288914
503661 700111
418098 805355
218207 681124
240513 418098
240513 105420
349745 218207
240513 256473
503661 240513
801364 558532
503661 751998
503661 383668
211625 503661
211625 801364
70073 211625
6...

output:

Yes
143610 658565 621508 585093 628417 489110 781264 32721 444693 303510 195971 678974 740438 560006 118475 10039 165012 125769 663701 269920 152481 617694 458746 387647 498313 656784 455274 414155 661120 235161 24153 419439 370176 153016 376457 501729 574051 698535 63803 441394 590920 657660 488457...

result:

ok found a correct permutation

Test #38:

score: 0
Accepted
time: 113ms
memory: 50500kb

input:

267630
249613 94106
244525 78739
260563 244525
89114 260563
249613 89114
261005 211565
167319 164639
151689 150374
5110 184014
98061 167319
193874 36890
193874 261005
166783 31162
249613 193874
5110 249613
224907 79590
132398 105611
151689 58298
235368 183496
5110 224907
5110 218094
101518 135158
15...

output:

Yes
110936 55200 54129 133469 31076 108383 189066 263041 40395 63359 55708 259879 21487 82944 198044 12242 186195 195677 100478 64976 119391 118099 189027 28238 103614 263007 60587 101960 141898 62311 144473 172366 181673 113546 232941 60430 262569 240054 198255 239558 140224 40190 6626 45927 225896...

result:

ok found a correct permutation

Test #39:

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

input:

2517
1185 1834
285 171
2267 2189
2267 1185
2132 909
2267 1694
466 2132
466 2267
2046 2341
171 2046
1127 850
466 1499
2516 1127
2516 466
2516 285
285 1234
344 2262
344 824
824 1069
959 712
2516 344
959 2516
959 1776
1776 664
664 1754
1255 538
1415 1255
1754 2136
1415 185
2231 829
829 2095
1415 2231
2...

output:

Yes
71 2329 522 2493 911 1306 2378 1481 2237 191 2174 1703 520 1836 2351 2067 2115 1697 51 2303 896 2487 1172 401 891 187 1987 664 1477 2454 673 1005 2144 1280 1268 1063 2233 1510 1150 1919 1644 2034 1017 1407 2404 983 296 776 455 893 122 1200 327 982 1680 941 43 1693 1866 487 324 1717 1363 476 2504...

result:

ok found a correct permutation

Test #40:

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

input:

3807
2320 2494
1207 2320
745 3635
2000 1207
2000 145
136 2503
778 3800
2711 1697
2711 745
720 2757
720 3285
136 720
1138 1906
2143 1138
2143 119
3381 1491
3731 136
2988 320
2283 2000
2819 546
174 63
238 2801
3794 2093
2711 1111
2625 650
3794 2625
960 95
238 3589
1491 3064
267 1220
922 2883
2745 1810...

output:

Yes
155 587 2499 2382 1159 1071 205 3246 1825 2491 2502 10 1070 3161 1209 3505 222 489 969 1948 1336 1059 2161 1693 2547 1229 2468 1664 78 2488 1312 2739 1019 2550 3675 1386 988 119 2059 2169 851 395 3349 2988 427 3087 650 2090 1660 413 955 3615 3044 1909 1904 2239 272 3511 2991 1476 470 1613 2590 3...

result:

ok found a correct permutation

Test #41:

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

input:

2580
452 2229
1336 2112
2229 1364
247 1767
247 452
452 39
1767 2301
247 2264
2112 1140
1336 1787
1142 2304
1787 1044
578 2194
2341 1142
115 1261
578 710
126 1615
1044 2242
1142 964
592 173
173 916
832 1336
710 2573
964 2434
832 632
509 2341
219 715
1615 465
1974 14
916 2165
715 469
254 166
632 1974
...

output:

Yes
1216 1602 1095 510 511 621 268 781 673 2313 351 618 1349 1003 1567 2394 2193 354 1971 759 2483 2097 1681 2376 226 13 1650 405 810 1473 2478 2272 2204 662 1868 1639 845 210 1041 684 1389 1892 264 2122 545 1169 842 459 619 639 645 1783 216 1436 2197 137 437 1471 917 198 937 1583 231 753 824 747 77...

result:

ok found a correct permutation

Test #42:

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

input:

2647
594 133
133 1538
1614 1754
2412 1614
1614 1567
594 1395
1631 1407
550 874
2357 1631
1631 1694
1567 2294
1657 5
2357 2600
549 2412
2392 1209
1209 2078
1331 550
2412 862
2182 1280
1634 1889
2589 1657
550 286
2392 1017
2589 594
1315 2589
286 2075
1077 1644
2182 2392
1315 2000
1907 1634
1077 2137
2...

output:

Yes
1647 1255 733 64 1486 1882 2304 854 1534 790 157 183 1237 2354 1052 1276 516 2406 2450 600 1267 1449 522 2461 2512 2253 1687 2182 279 433 2016 2460 543 1628 1031 2145 1868 20 1034 875 754 971 1380 357 1173 1344 1604 2183 256 1741 1793 2646 2566 986 1907 78 1660 2024 918 1125 818 1159 997 1777 11...

result:

ok found a correct permutation

Test #43:

score: 0
Accepted
time: 140ms
memory: 58416kb

input:

319695
125891 61698
125891 90478
125891 2356
58052 249292
181500 19707
269109 33986
145770 210425
181500 269109
76664 27729
145770 58052
313953 169825
269109 61629
145770 125891
299835 220112
299835 189720
145770 136812
228042 193220
76664 145770
228550 217430
52512 299835
46762 93121
138774 133962
...

output:

Yes
153153 160211 36337 23405 72414 52044 221698 270183 196291 149359 104904 55188 100031 226673 201833 295042 248189 236358 97460 256001 171879 200455 190800 153453 31425 113614 160673 16731 99788 164425 220314 238654 153912 141027 241073 117262 70785 113050 260080 42905 17617 146403 87737 274673 2...

result:

ok found a correct permutation

Test #44:

score: 0
Accepted
time: 365ms
memory: 118772kb

input:

738204
221026 255493
7831 392831
495573 227512
329782 659529
449990 97879
449990 543577
7831 528307
160833 329782
179227 449990
124013 495573
447206 160833
136233 659142
136233 712326
648442 287105
204426 333341
40533 667619
91564 476421
593905 170439
599834 246905
499407 514591
124013 121395
251032...

output:

Yes
144740 266943 18684 295820 477432 470892 363629 416089 231182 289151 181021 285892 481082 639550 127415 165525 311096 570986 433407 730666 96862 329889 491365 621366 507257 179449 152930 151523 315162 543025 607472 530377 32409 170603 643412 316998 578130 643075 260888 169171 593755 681313 65926...

result:

ok found a correct permutation

Test #45:

score: 0
Accepted
time: 126ms
memory: 50960kb

input:

271691
153818 100582
90158 153818
90158 10163
79985 180333
180333 124380
136840 79985
268401 35624
10163 117494
136840 268401
192815 209714
107527 101658
117494 109201
90158 104581
268401 90158
263316 27268
20454 107949
20454 28789
209714 176106
101658 256452
79985 76297
194597 136840
81334 179400
1...

output:

Yes
150448 61617 237893 257079 232519 1709 248994 8871 233730 175730 170517 58494 207692 24081 152288 120845 140182 115237 228284 217325 72492 222819 271387 249737 123591 37744 81908 112186 73787 228331 250700 169065 166155 165909 256359 28668 188662 203774 199430 135914 100255 3510 170678 252647 15...

result:

ok found a correct permutation

Test #46:

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

input:

476611
139570 394048
401631 333474
355735 139570
465305 155091
355735 465305
293945 184441
468895 118397
465305 401631
118397 147399
355735 110636
76257 293945
261191 86770
355735 443700
443700 121944
468895 428462
83309 219679
293945 455072
428462 76257
76257 354323
86770 83309
83309 452795
245694 ...

output:

Yes
58716 86429 111454 64637 435667 308783 222238 100322 373989 372163 432908 151296 318652 35754 413773 7723 1475 211254 288028 3058 112404 172778 142590 46501 302166 228448 89137 321510 168069 288405 29767 147212 37184 102282 370636 368880 439148 442993 275936 24544 309454 360290 336502 342538 190...

result:

ok found a correct permutation

Test #47:

score: 0
Accepted
time: 165ms
memory: 72848kb

input:

378505
350564 138810
138810 304727
241815 350564
350564 337137
350442 176322
241815 25827
344849 350442
366665 150347
350442 77467
206687 241815
48531 173129
241815 214965
150347 344849
344849 295270
206687 48531
126665 125426
366665 164086
48531 337692
125426 206687
70577 35480
206687 83434
217549 ...

output:

Yes
249518 305712 254069 153039 154808 261499 366371 253429 350219 38848 155632 352027 281725 341718 307406 146653 242014 129559 60132 249485 260713 43629 103740 17087 215542 372493 176483 243459 341658 6587 353538 310813 187887 277194 209832 263323 169365 332309 240312 32455 96852 274591 338980 795...

result:

ok found a correct permutation

Test #48:

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

input:

860
436 580
436 141
88 333
700 35
700 613
536 742
732 700
795 805
509 756
795 799
799 298
732 50
795 55
88 795
608 598
795 170
242 732
493 388
170 774
88 509
608 493
93 536
93 391
161 694
539 618
141 381
278 539
785 93
493 759
436 161
192 291
608 785
161 640
192 88
770 278
253 754
253 608
770 242
19...

output:

Yes
108 23 550 514 568 748 402 655 323 583 424 705 419 702 146 41 253 443 370 553 426 570 389 265 623 173 193 599 590 750 303 80 692 860 517 810 390 177 538 510 834 629 131 700 787 414 634 48 633 515 190 341 228 572 529 321 839 363 814 816 663 70 137 755 607 114 306 188 57 278 289 685 558 144 753 46...

result:

ok found a correct permutation

Test #49:

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

input:

616
455 89
497 154
56 288
17 497
121 229
383 401
609 599
193 438
56 609
592 10
335 6
193 487
138 298
121 138
455 335
286 7
17 193
555 362
243 56
549 367
107 17
7 290
362 530
121 217
367 286
56 435
24 107
551 409
455 121
96 455
387 442
435 230
528 555
178 22
301 275
555 475
448 291
378 103
551 234
16...

output:

Yes
541 607 157 100 88 174 24 482 381 183 162 87 106 522 79 373 28 430 150 93 605 52 413 26 46 608 384 366 415 156 521 552 2 439 453 221 468 535 437 207 471 313 345 308 609 203 489 597 585 389 612 404 134 216 411 461 554 72 611 286 490 92 306 47 90 566 58 226 526 371 397 246 353 507 312 563 572 232 ...

result:

ok found a correct permutation

Test #50:

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

input:

809
42 285
501 573
501 42
626 795
626 245
555 133
512 10
555 591
474 512
501 264
555 340
626 405
474 626
626 501
235 548
321 426
658 17
711 12
474 254
658 474
433 238
716 235
711 321
716 324
77 137
321 153
711 485
77 711
77 588
225 248
340 355
481 675
77 438
125 290
678 239
481 77
290 555
433 557
67...

output:

Yes
442 229 318 773 638 133 372 17 733 49 528 421 671 16 559 396 53 167 1 390 286 472 652 376 140 278 667 74 614 575 13 267 719 502 330 787 198 740 491 309 281 42 601 741 679 560 252 653 249 703 688 805 185 756 92 646 308 409 508 475 284 149 152 783 370 355 602 512 200 462 723 513 448 780 709 772 42...

result:

ok found a correct permutation

Test #51:

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

input:

128
27 76
118 120
11 34
95 11
51 121
113 88
39 32
88 51
96 39
95 24
76 113
27 19
95 102
13 99
25 123
101 29
1 79
120 41
117 28
46 7
79 107
117 3
59 45
27 95
46 84
96 46
74 109
72 78
75 42
126 73
97 26
101 91
40 101
59 37
3 85
13 14
85 68
93 117
25 125
73 122
126 59
1 13
27 66
2 100
115 63
44 115
128...

output:

Yes
72 11 40 43 117 100 105 122 124 121 62 89 76 75 10 88 26 83 60 128 92 52 118 64 107 87 54 39 15 2 70 103 3 63 112 85 32 78 102 17 18 23 94 44 31 104 119 68 35 93 58 4 97 67 51 24 125 71 30 1 127 6 46 96 53 66 13 42 79 49 21 90 28 47 22 55 126 91 73 95 114 113 69 106 41 98 111 57 82 34 14 99 37 8...

result:

ok found a correct permutation

Test #52:

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

input:

321
191 1
65 133
100 148
191 100
228 216
228 165
240 191
43 12
154 240
43 111
228 183
121 142
52 43
31 121
219 52
309 293
81 154
31 231
291 128
59 99
52 146
198 264
81 31
215 228
264 259
291 261
284 167
198 38
65 79
74 141
31 72
309 215
315 74
253 281
150 81
65 268
59 219
167 195
198 253
13 61
268 2...

output:

Yes
68 304 315 305 207 253 113 54 186 206 44 26 16 234 247 189 314 263 142 5 138 179 156 112 279 99 224 307 125 191 71 282 9 103 108 141 286 211 187 62 106 121 25 235 309 55 188 85 84 256 244 24 101 239 230 294 15 11 21 259 17 273 51 231 39 278 149 190 97 143 88 75 288 19 93 317 53 145 41 240 64 1 4...

result:

ok found a correct permutation

Test #53:

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

input:

77
2 28
61 6
72 61
71 58
68 72
72 13
30 46
58 68
46 31
2 77
77 23
2 29
39 4
30 27
68 25
19 63
29 40
27 7
71 47
37 18
33 2
55 14
19 8
33 71
62 21
44 62
22 9
44 37
71 39
59 24
53 56
22 55
55 17
33 19
75 35
15 33
26 10
22 26
7 59
37 36
30 20
33 67
5 53
53 69
44 22
44 30
41 45
30 65
35 60
76 75
41 76
76...

output:

Yes
59 7 69 23 1 18 52 26 42 47 58 66 19 44 5 73 45 39 24 55 37 41 10 54 20 46 51 8 11 48 50 63 6 67 32 40 38 72 22 12 28 75 70 35 29 49 21 57 64 61 60 71 2 62 43 3 74 14 53 33 17 36 25 68 56 77 27 15 4 34 13 16 76 65 31 30 9

result:

ok found a correct permutation

Test #54:

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

input:

270
93 184
72 57
30 72
126 229
224 152
91 178
72 258
258 224
65 246
108 1
70 126
199 91
158 168
26 65
158 40
70 98
172 58
98 52
27 257
46 60
219 197
26 47
77 158
115 93
214 22
1 154
50 200
110 50
220 232
145 115
80 29
140 113
80 70
172 44
80 21
115 206
199 80
10 30
241 226
254 165
140 86
139 175
46 ...

output:

Yes
60 50 169 91 152 77 94 156 173 137 200 150 18 212 38 172 67 131 151 75 34 23 37 92 251 80 241 266 28 138 214 101 102 220 19 73 154 155 106 8 168 180 58 240 185 87 83 270 254 85 253 33 221 76 132 9 140 239 130 88 52 54 51 105 81 104 223 265 247 29 21 139 35 236 207 74 5 181 252 27 269 216 36 210 ...

result:

ok found a correct permutation

Test #55:

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

input:

26
16 10
4 16
12 24
9 17
16 25
9 3
21 9
26 1
4 26
22 20
15 6
26 18
22 13
5 22
21 5
12 19
15 2
21 4
23 14
11 12
11 21
21 8
11 7
11 23
11 15

output:

Yes
18 26 8 13 9 25 21 20 6 15 1 2 12 23 24 14 7 19 4 11 5 10 22 3 16 17

result:

ok found a correct permutation

Test #56:

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

input:

782
360 773
773 239
360 657
206 677
657 573
573 508
360 206
231 616
231 360
19 520
576 19
231 576
576 676
741 61
432 551
279 432
279 341
173 225
231 279
741 466
509 258
289 741
279 617
217 396
468 509
231 217
462 173
347 419
308 570
347 409
690 608
41 619
509 223
728 231
741 680
690 347
570 39
289 7...

output:

Yes
73 202 614 298 334 68 10 32 507 435 458 281 273 399 109 180 213 296 93 404 440 292 366 223 421 627 583 516 9 238 182 124 396 304 707 678 539 53 418 655 417 237 515 205 325 386 305 524 333 543 625 75 342 294 214 729 731 502 632 120 78 311 191 42 405 438 429 709 415 133 774 755 593 554 150 622 217...

result:

ok found a correct permutation

Test #57:

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

input:

514
4 246
7 446
20 360
200 338
507 20
66 210
243 200
4 313
4 507
507 241
4 317
243 4
251 66
452 195
243 7
7 240
243 251
251 275
275 299
452 243
130 300
305 216
243 142
452 130
305 51
274 238
97 90
398 92
97 105
452 97
398 331
221 364
398 221
305 150
168 410
391 305
488 309
452 168
448 274
452 471
30...

output:

Yes
43 379 374 274 22 203 266 94 470 125 476 489 433 459 33 403 163 13 367 270 323 341 303 90 382 12 144 88 52 387 174 185 479 222 221 213 139 151 407 118 170 153 55 388 61 486 66 204 26 404 243 17 466 452 220 415 98 60 146 148 113 461 154 376 352 262 491 143 327 448 381 28 35 297 498 503 227 336 18...

result:

ok found a correct permutation

Test #58:

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

input:

405
243 143
243 283
388 28
388 271
243 388
26 340
352 243
340 351
82 26
403 349
25 45
146 6
381 260
73 27
26 50
249 73
349 35
25 249
92 392
324 103
393 167
392 115
260 265
6 181
393 25
370 108
243 120
262 82
265 308
25 367
215 383
324 352
215 235
38 223
223 177
394 92
262 278
92 180
394 215
393 213
...

output:

Yes
195 301 351 329 332 19 277 104 193 342 159 229 33 215 62 370 328 331 289 3 282 248 183 100 89 318 93 13 118 220 66 133 135 225 73 117 131 312 231 78 240 165 204 263 90 168 292 322 145 315 177 101 120 323 130 44 64 197 288 186 366 379 258 226 308 321 290 112 198 259 253 262 92 205 170 82 293 227 ...

result:

ok found a correct permutation

Test #59:

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

input:

161
14 31
76 85
14 130
76 51
14 76
14 79
126 37
60 56
12 20
66 14
66 155
12 96
56 73
126 160
96 146
52 12
155 161
73 125
110 135
160 114
110 2
60 42
69 18
12 47
126 1
2 21
35 41
88 104
75 126
60 113
140 44
126 100
50 88
17 69
140 145
18 159
89 62
23 75
112 70
145 142
121 3
110 112
89 50
50 5
52 105
...

output:

Yes
43 109 26 142 89 149 16 106 117 45 13 51 28 60 30 156 90 92 78 52 110 9 37 58 81 118 97 104 1 12 61 138 123 153 125 116 40 100 75 99 126 134 146 21 101 103 55 71 122 86 65 50 73 10 145 131 114 74 124 130 128 85 150 82 113 59 48 72 91 112 105 147 132 17 38 63 127 143 66 57 18 139 155 157 64 140 4...

result:

ok found a correct permutation

Test #60:

score: 0
Accepted
time: 218ms
memory: 81480kb

input:

446879
160841 122321
122321 432392
162815 381796
160841 162815
95209 29848
162815 148082
37038 150881
148082 124869
29848 180040
160841 149964
109655 95209
150881 336244
95209 442645
442645 372689
134402 109655
109655 360332
272389 37038
37038 311204
301370 411902
311204 436010
411902 134402
134402 ...

output:

Yes
404722 296912 428174 73388 137864 351616 114577 89128 375631 209253 94068 94730 53650 232444 17957 65221 411086 444551 156558 3629 255544 84122 300977 358648 5431 126215 285668 198380 138769 374199 190235 42638 422124 217714 173925 182969 88661 118633 34068 341925 238 178641 394117 224438 18868 ...

result:

ok found a correct permutation

Test #61:

score: 0
Accepted
time: 432ms
memory: 129852kb

input:

817799
231021 718849
718849 344451
231021 411507
231021 719698
616251 96448
415072 31418
231021 635237
616251 231021
415072 81599
494563 308791
236866 191180
373523 415072
236866 355896
355896 130678
584592 494563
537440 616251
584592 401123
791694 245625
316324 49756
263404 472935
316324 565191
191...

output:

Yes
241109 804848 244281 7878 208765 462188 482761 636081 128292 165732 276978 272254 622470 704668 541007 233822 312255 664042 591381 517513 300583 143548 152026 160815 623713 304720 216568 218945 225128 104094 304069 168819 124736 509102 462226 206023 693993 64067 378816 558237 267685 717085 35102...

result:

ok found a correct permutation

Test #62:

score: 0
Accepted
time: 467ms
memory: 135312kb

input:

863614
470842 66534
223522 470842
66487 223522
66487 538034
564165 66487
66487 711143
564165 52273
726172 713833
564165 726172
515686 541614
417716 564165
564165 245157
515686 417716
457942 515686
136535 567037
244833 256720
515686 225517
213255 376438
457942 344119
457942 410678
441083 153182
15318...

output:

Yes
49008 151952 548026 782802 680097 257434 117330 446816 851789 559162 216004 462080 704186 374071 261039 205178 169093 454544 272738 403095 177816 779679 644951 307016 183708 855989 197981 557934 178964 73604 300382 111490 192081 756160 208580 264230 500816 160274 435497 797244 27879 761852 31100...

result:

ok found a correct permutation

Test #63:

score: 0
Accepted
time: 148ms
memory: 69100kb

input:

337720
108891 157620
215207 108891
291346 4670
125488 291346
215207 101263
302235 125488
110942 241400
181343 141958
215207 234455
319962 144685
23068 215207
319962 276470
259911 207221
262913 19637
262913 175606
259911 110942
17151 95742
181891 18429
211809 17151
276470 23068
64787 163402
178863 20...

output:

Yes
255888 308268 255083 241492 8246 296599 124617 174662 247923 154354 337216 113826 133407 48259 286497 249589 194880 52081 23170 237305 333153 211372 74823 305908 94861 210000 233518 131358 312176 283280 167295 282416 6669 213170 207407 140492 13154 59429 334257 194808 253837 228970 135125 10776 ...

result:

ok found a correct permutation

Test #64:

score: 0
Accepted
time: 29ms
memory: 23360kb

input:

71995
60293 8944
20861 68502
52158 48587
60293 40238
15296 11288
40238 52158
23160 25001
20861 35551
56630 67478
46815 17855
15425 23160
67478 38959
35551 8067
56630 15296
52861 15192
60293 47720
52861 22286
52701 37078
22286 50677
23160 3337
50677 34831
17855 49333
54645 60057
54645 20861
60993 615...

output:

Yes
39041 54503 22289 45790 13487 21637 421 57480 55748 27778 33781 16652 40737 56800 20222 25586 57696 46701 53545 27389 33907 42489 48368 38525 36423 53417 26229 61861 9319 800 6481 42895 20329 30061 70765 64469 15134 48809 7818 33935 47428 65757 20737 44602 10445 69652 2603 38010 31041 13269 1563...

result:

ok found a correct permutation

Test #65:

score: 0
Accepted
time: 145ms
memory: 64276kb

input:

321798
37942 217686
211660 30542
217686 216902
211660 230042
201961 21617
203412 211660
1007 37942
115459 183727
241201 169716
307498 261347
169716 301094
183727 304196
241201 177122
261347 129855
307498 201961
286171 140508
15414 307498
15414 278098
133610 242623
23295 115459
226987 235511
223736 1...

output:

Yes
208197 116949 112447 274010 313287 205396 261544 16739 277245 206485 184496 109689 95228 218539 304785 137873 50714 35538 197766 108338 50839 141782 231616 40524 91495 131808 85128 215395 298192 213824 43228 42443 209077 67608 104645 255980 132152 58518 153092 284032 264738 182183 216122 79176 1...

result:

ok found a correct permutation

Test #66:

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

input:

716
61 447
35 370
521 141
193 521
711 507
193 711
222 609
157 598
17 222
193 17
157 561
153 73
281 213
153 83
35 538
415 281
243 86
583 193
35 157
21 583
273 464
226 484
21 153
329 210
520 329
361 415
128 332
616 265
660 128
616 21
273 522
307 514
434 549
474 226
25 474
267 407
361 267
455 683
361 3...

output:

No

result:

ok desired permutation does not exist

Test #67:

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

input:

552
43 495
94 360
231 254
107 537
42 107
140 207
146 191
390 94
177 386
84 428
43 274
43 291
227 518
230 390
140 308
501 127
176 231
282 140
176 43
372 502
71 84
71 116
372 148
85 450
449 372
282 449
71 85
230 176
98 424
533 206
177 500
533 256
238 430
225 371
238 230
282 357
223 128
71 438
518 182
...

output:

No

result:

ok desired permutation does not exist

Test #68:

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

input:

745
579 484
578 304
579 578
102 732
79 102
579 537
629 688
447 79
618 741
514 387
629 514
657 629
618 447
25 579
657 655
603 31
19 25
728 710
728 19
657 618
657 562
190 259
728 534
162 469
679 603
565 396
679 565
162 728
679 657
398 190
162 679
162 717
585 297
45 515
162 424
149 667
310 300
241 398
...

output:

No

result:

ok desired permutation does not exist

Test #69:

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

input:

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

output:

No

result:

ok desired permutation does not exist

Test #70:

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

input:

257
106 151
114 245
32 226
122 143
218 63
218 242
43 211
178 1
114 32
193 91
215 202
81 197
253 126
16 239
107 193
209 257
256 172
128 16
16 104
122 256
176 223
167 24
167 212
45 221
80 106
49 233
112 87
196 17
112 15
49 114
185 215
16 85
89 240
97 140
132 100
243 34
65 96
166 236
243 121
49 205
14 ...

output:

No

result:

ok desired permutation does not exist

Test #71:

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

input:

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

output:

No

result:

ok desired permutation does not exist

Test #72:

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

input:

768
697 123
74 111
345 697
620 552
489 521
620 345
198 489
755 620
681 510
193 227
217 681
416 258
416 264
333 375
74 616
586 584
448 416
586 217
760 118
533 74
133 448
198 411
378 425
333 198
193 581
193 567
378 329
333 340
533 358
312 143
586 133
483 312
322 478
755 322
691 193
586 749
518 760
50 ...

output:

No

result:

ok desired permutation does not exist

Test #73:

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

input:

874
465 294
454 465
265 387
251 454
351 829
265 43
431 369
251 431
556 377
130 88
556 265
156 665
309 130
339 507
759 334
276 183
309 711
156 251
309 760
309 291
6 669
759 471
6 430
339 309
276 427
58 15
189 646
759 469
156 276
485 39
158 275
766 208
389 277
433 8
556 58
704 525
490 556
487 433
692 ...

output:

No

result:

ok desired permutation does not exist

Test #74:

score: 0
Accepted
time: 183ms
memory: 99648kb

input:

791931
177992 218821
769862 520846
84832 769862
769862 177992
123064 153113
123064 84832
84832 84169
612341 791831
123064 790094
139048 123064
493913 334254
144069 409067
712034 732310
168808 557087
493387 83337
612341 139048
712034 788986
83337 688179
144069 712034
559412 280241
493913 168808
13904...

output:

No

result:

ok desired permutation does not exist

Test #75:

score: 0
Accepted
time: 197ms
memory: 112192kb

input:

830098
245387 810510
111057 245387
245387 756545
301253 111057
178758 737021
320596 260245
301253 320596
138071 178758
178758 132752
301253 138071
483070 224770
483070 301253
483070 156252
287527 668650
197855 66008
287527 283230
402134 483070
402134 197855
402134 287527
285438 689367
419969 690621
...

output:

No

result:

ok desired permutation does not exist

Test #76:

score: 0
Accepted
time: 187ms
memory: 105088kb

input:

745901
47755 278584
54165 640361
313416 259093
313416 54165
278584 620467
313416 47755
15913 515243
636192 465819
693965 84629
259598 308141
693965 510215
313416 250713
435863 694189
633455 522360
693965 489881
288387 487508
633455 435863
703901 165599
685839 259598
288387 665590
43126 693965
636192...

output:

No

result:

ok desired permutation does not exist

Test #77:

score: 0
Accepted
time: 150ms
memory: 91688kb

input:

663957
355271 582623
64303 355271
348954 608175
633568 350813
608175 633568
348954 272129
64303 348954
490891 130974
490891 64303
348753 498258
527394 348753
64303 527394
495835 516691
516691 340232
581585 494622
20399 478031
443074 90187
598320 404286
227261 536841
450736 387276
527394 231403
47839...

output:

No

result:

ok desired permutation does not exist

Test #78:

score: 0
Accepted
time: 149ms
memory: 93672kb

input:

637671
610578 77040
569780 238702
468537 569780
146914 125725
205333 468537
610578 479367
146914 502744
205333 610578
205333 155482
522593 146914
510050 451837
534158 193956
487418 534158
222112 406017
368292 632512
487418 368292
419382 222112
244108 510050
155294 487418
406093 101972
522593 58109
4...

output:

No

result:

ok desired permutation does not exist

Test #79:

score: 0
Accepted
time: 134ms
memory: 86472kb

input:

553475
373931 212673
485882 252353
544712 305552
438839 418113
321884 515552
120900 438839
273147 322013
132161 386754
544712 132161
250207 544712
547992 544534
374096 370283
529176 254776
484275 302156
440293 118962
327820 250207
50451 76516
116353 430485
136093 547807
108538 36095
158309 309982
12...

output:

No

result:

ok desired permutation does not exist

Test #80:

score: 0
Accepted
time: 283ms
memory: 123588kb

input:

984357
924815 938360
86749 608299
86749 305688
587534 924815
953942 86749
342283 529993
223077 342283
587534 223077
19966 151794
825714 880970
686892 334288
765499 275762
236268 474007
266417 600572
368732 292301
145649 854681
934642 961912
587534 268625
587534 599130
184763 145649
266417 625831
544...

output:

No

result:

ok desired permutation does not exist

Test #81:

score: 0
Accepted
time: 369ms
memory: 132112kb

input:

958071
417772 102131
192158 311558
434195 682295
417772 192158
15876 944576
417772 73405
541503 434195
622894 939990
492571 15876
492571 545762
23462 624529
153591 182728
289779 23462
541503 153591
192621 10626
569464 33490
622894 231515
174904 114718
417772 393738
713997 569464
174904 492571
372223...

output:

No

result:

ok desired permutation does not exist

Test #82:

score: 0
Accepted
time: 243ms
memory: 114796kb

input:

902284
305697 858763
305697 506818
750037 784433
115646 242968
301124 305697
757009 115646
748320 391557
33355 748320
497536 33355
497536 301124
757009 497536
399786 757009
403137 530691
126137 306311
600849 217860
692434 750037
538543 771678
628202 284816
692434 615222
680970 515961
882699 111084
5...

output:

No

result:

ok desired permutation does not exist

Test #83:

score: 0
Accepted
time: 524ms
memory: 139456kb

input:

1000000
872229 675834
298023 674143
170947 887187
75567 73998
881721 382388
881721 858671
75567 881721
213001 302704
75567 872229
32643 213001
269011 365018
515196 170947
515196 269011
795240 17657
32643 393427
32643 238230
407288 798596
795240 214427
655103 515196
249622 75567
298023 655103
233297 ...

output:

Yes
888563 346545 584998 849006 47134 803815 257462 958874 969199 176657 259303 891380 649832 391052 608677 48163 535457 654267 53120 999195 311920 907214 743580 712205 771405 893575 288054 848105 173805 785973 294833 901167 667169 490097 532167 800786 946461 24081 445918 414684 62766 653891 775918 ...

result:

ok found a correct permutation

Test #84:

score: 0
Accepted
time: 229ms
memory: 79136kb

input:

1000000
233122 861569
286399 506005
233122 309361
309361 417912
905695 437003
245633 905695
244012 239418
759461 632838
245633 759461
214611 244012
759461 214611
222938 363425
388547 286399
417912 755221
222938 461212
461212 764719
245633 400423
589457 964902
654950 128351
388547 245633
233122 22079...

output:

No

result:

ok desired permutation does not exist

Test #85:

score: 0
Accepted
time: 283ms
memory: 136672kb

input:

1000000
468716 435228
771394 408026
702488 771394
344165 644891
468716 702488
344165 529942
468716 20510
543038 954767
964641 907063
529942 556211
468716 679620
765715 257516
964641 383180
29470 564871
765715 964641
710280 583543
345021 710280
883565 29470
460171 543038
765715 688145
324703 344165
7...

output:

No

result:

ok desired permutation does not exist

Test #86:

score: 0
Accepted
time: 308ms
memory: 125848kb

input:

1000000
519264 752578
904801 345364
6735 724155
904801 989893
725163 697957
194375 519264
6735 194375
782162 705716
478688 782162
904801 478688
238543 997413
238543 404218
323364 860568
339775 725163
502826 271789
339775 904801
502826 339775
690167 891367
543543 637017
673885 950446
68778 976090
809...

output:

No

result:

ok desired permutation does not exist

Test #87:

score: 0
Accepted
time: 528ms
memory: 139200kb

input:

1000000
371794 866634
371794 888658
517421 371794
528322 517421
524470 653839
558549 258577
903420 638365
985448 558549
985448 524470
114851 985448
229026 75230
229026 114851
903420 528322
128362 126035
917575 216876
793830 252372
155102 128499
945250 793830
353093 775777
903420 418401
470199 932785...

output:

Yes
645654 976220 175294 252793 306703 337372 884433 999351 880688 154618 557397 247079 992120 434690 738888 74114 57366 222072 451823 218562 691295 943984 491868 975316 708726 537196 982218 310188 481400 110694 160536 295494 976108 47108 787901 587144 383098 590625 989373 590621 349712 887542 75426...

result:

ok found a correct permutation

Test #88:

score: 0
Accepted
time: 502ms
memory: 139240kb

input:

1000000
797587 474572
797587 173975
683983 113528
302077 650139
797587 683983
130484 31289
274845 49730
304676 385983
196917 695293
274845 352751
302077 256560
159899 282593
797587 989496
639672 302077
975365 779664
390742 177607
209382 434909
159899 675189
653923 845139
274845 975365
633439 196917
...

output:

Yes
952417 145236 527708 982360 828383 999177 268297 842544 633144 744093 464027 558438 160082 547723 668304 478122 19350 528931 104625 91324 933374 413370 657855 351856 669026 165417 148959 349646 765655 429799 800126 849288 903901 105690 864282 553500 345235 340327 543712 594802 213996 554936 3842...

result:

ok found a correct permutation

Test #89:

score: 0
Accepted
time: 509ms
memory: 138664kb

input:

1000000
142486 406027
804304 965617
116018 631033
116018 459379
695833 400130
827509 892677
221395 671414
767573 221395
379389 691133
426321 141363
692659 146067
364142 168712
232113 364142
742650 767573
356123 150488
936933 504354
232113 440710
962025 936933
387808 718461
507862 718064
896725 37268...

output:

Yes
48544 511912 25048 781051 277169 342337 285838 774101 922680 225044 40948 918362 789933 705032 733263 777623 325483 337580 923017 477095 219976 200837 395078 429151 594049 856783 455469 158553 836707 326950 13808 84673 123454 334522 620302 636484 170541 665684 461087 758867 609513 768250 576879 ...

result:

ok found a correct permutation

Test #90:

score: 0
Accepted
time: 573ms
memory: 151656kb

input:

1000000
569407 58608
102664 591290
102664 948686
569407 30921
115354 417555
696638 614005
30921 401301
634142 124400
590238 172698
58608 124982
634142 696638
652436 621878
669284 166608
634142 963575
652436 234154
401301 590238
102664 569407
228518 669284
228518 210380
634142 342457
102664 321320
31...

output:

Yes
657100 949559 513549 985358 233960 128536 820586 532771 203101 984256 904782 185864 999660 283830 305710 840421 690476 811452 980583 8422 178972 217153 178117 236328 136005 814500 114743 313627 672699 663293 533027 389048 920385 886396 333743 386508 380037 397088 344371 475366 697785 322050 9830...

result:

ok found a correct permutation

Test #91:

score: 0
Accepted
time: 558ms
memory: 151732kb

input:

1000000
849136 905989
275800 977550
849136 320119
647508 160133
438714 275800
926939 489165
871054 655994
655994 712422
438714 871054
385636 849136
647508 891948
489165 744635
926939 385636
926939 647508
926939 340069
438714 569260
100863 926939
674171 233890
484709 100863
795655 153831
581569 43871...

output:

Yes
539301 471299 309854 497822 919675 29937 879437 885376 429353 398875 989635 768233 757238 456927 750406 902712 147932 600406 310632 807415 230230 545574 683437 342336 228443 604440 435421 520874 996534 27328 232167 980917 52311 199832 749178 227996 271178 71644 843738 646746 348970 817314 20599 ...

result:

ok found a correct permutation

Test #92:

score: 0
Accepted
time: 519ms
memory: 138600kb

input:

999999
769572 399893
680136 99085
402299 528008
415483 98068
402299 680136
607054 465230
72361 866626
607054 126410
8843 274955
101142 405098
458232 761264
101142 415483
2299 645624
479896 2299
443228 226485
725492 896718
72361 550410
266319 725492
234676 404313
973142 458232
908921 517041
541121 98...

output:

Yes
572356 39396 95820 958395 354361 2494 202547 642575 453689 578308 747913 802807 968664 3409 601650 7428 25340 343229 277896 853194 913009 498678 708714 606822 242785 792167 759488 937832 227870 527190 988197 102566 749650 958829 836636 986498 558486 306244 753905 603909 552943 638603 67095 7618 ...

result:

ok found a correct permutation

Test #93:

score: 0
Accepted
time: 572ms
memory: 151268kb

input:

999999
638764 653179
653179 423135
19297 628528
96478 638764
628528 319781
723301 700762
19297 899827
795914 96478
505962 965991
723301 19297
795914 723301
740027 166861
15519 916528
908396 619878
318470 740027
131100 425361
195676 280479
195676 131832
15519 131100
795914 231599
15519 681367
102069 ...

output:

Yes
556926 664111 300308 401876 416912 38561 156810 450248 78918 462939 696959 870247 723751 741708 655059 778627 449393 840323 144859 710126 237114 225024 93581 123547 816972 263321 950885 253607 866754 640456 927655 993197 11364 977551 477116 5903 848450 615121 758664 43664 938796 462290 408688 89...

result:

ok found a correct permutation

Test #94:

score: 0
Accepted
time: 558ms
memory: 151080kb

input:

999999
58226 297705
241457 629502
241457 607249
225639 454693
634200 388942
202231 225639
596265 882234
141649 791786
141649 319859
202231 241457
110592 941990
124094 634200
721068 182574
517242 141649
710018 188330
202231 596265
472786 202231
824788 721068
540055 110592
824788 597259
279202 546778
...

output:

Yes
881784 964254 532403 624399 223233 71105 968802 867091 581614 296130 331015 765239 664280 671915 310870 309710 204280 192802 940790 731393 700668 384328 71649 191190 395341 514243 520690 593301 92829 211402 88224 704512 430748 207547 503898 919537 122929 421948 27634 820711 892321 813531 555052 ...

result:

ok found a correct permutation

Test #95:

score: 0
Accepted
time: 558ms
memory: 163276kb

input:

998998
762149 295186
970596 762149
143097 970596
143097 579823
571154 962399
944817 571154
576926 944817
237302 608217
449546 237302
187663 449546
187663 143097
527747 200182
187663 527747
450963 187663
55217 768683
55217 219432
855651 576926
450963 55217
450963 855651
506441 450963
598098 772197
10...

output:

Yes
797163 143644 631027 380715 827152 320536 367702 957497 470050 951768 951179 550821 513938 214873 146138 695685 764142 329882 177081 259754 416591 507132 366418 370723 618107 719964 33889 255354 923481 923312 763211 10953 338137 304998 326222 531110 322349 53293 955709 882597 729210 911858 93233...

result:

ok found a correct permutation

Test #96:

score: 0
Accepted
time: 579ms
memory: 175556kb

input:

999190
522030 214315
612788 851571
522030 654950
851571 931631
284983 612788
284983 431803
180960 522030
431803 616213
787471 54622
853893 16344
607236 284983
522030 149512
531677 180960
607236 806849
853893 787471
411564 607236
54751 531346
692901 716096
692901 381856
607236 692901
692901 853893
34...

output:

Yes
703081 545090 390966 888579 297031 843298 963707 825334 536341 555964 328958 689339 265877 600586 575805 762434 526908 210636 364472 305225 749898 37424 612771 647502 408794 714402 807008 546008 254658 258881 671667 679097 308047 229719 956869 953582 107764 119633 682049 964534 899057 378293 318...

result:

ok found a correct permutation

Test #97:

score: 0
Accepted
time: 605ms
memory: 176552kb

input:

1000000
286478 355449
558276 319764
651488 863486
286478 737818
566894 286478
566894 558276
327038 951042
973417 566894
951042 122209
192230 973417
327038 959527
381815 192230
192230 327038
327038 651488
762957 159917
69269 762957
69269 976049
381815 69269
998752 381815
962739 180461
274865 978603
9...

output:

Yes
509067 756493 570788 391587 852528 978637 827295 114124 796301 38127 891127 366685 681443 812081 802836 189075 990265 358685 919197 92222 316177 658333 828452 392463 112104 293220 104409 5829 492342 883880 906275 704493 849213 338568 146193 406521 231634 859692 369423 490427 930037 325748 16187 ...

result:

ok found a correct permutation

Test #98:

score: 0
Accepted
time: 572ms
memory: 177088kb

input:

998987
835152 162173
308365 835152
528848 308365
528848 970987
539929 685918
813371 539929
670631 113615
23716 528848
400904 670631
679671 910434
448892 629007
245433 734500
539754 679671
23716 371817
539754 245433
539754 314285
105436 621312
892387 23716
223544 578157
223544 400904
223544 997889
37...

output:

Yes
680958 429837 759910 667681 795281 329371 159220 675951 325066 503789 960328 257843 682715 844690 691291 829668 984384 50526 118790 371044 488957 643125 926156 881891 785634 401134 306274 858424 184450 842670 14438 525450 46396 318734 320307 95794 961030 791811 908151 549377 14467 680267 551884 ...

result:

ok found a correct permutation

Test #99:

score: 0
Accepted
time: 664ms
memory: 189332kb

input:

999380
788146 62425
585006 182272
987502 44561
579265 440667
757798 585006
440667 754302
855588 788146
579265 757798
754302 814009
579265 987502
855588 845800
788146 322441
855588 982735
579265 152951
845800 88994
952670 579265
952670 429865
429865 768236
952670 855588
952670 618051
922591 952670
34...

output:

Yes
163438 371101 775496 101030 913269 17566 203729 416109 850414 721348 405141 99633 376740 729338 312532 324123 868637 323402 110656 799250 381558 792387 350814 313878 147732 292291 914119 99759 55621 726378 163847 821722 577293 776201 4419 153037 696749 690492 917 37169 103485 198827 78970 419344...

result:

ok found a correct permutation

Test #100:

score: 0
Accepted
time: 599ms
memory: 189520kb

input:

1000000
99661 626515
430345 99661
157540 430345
555340 289128
555340 253870
141383 555340
157540 199583
37879 788290
199583 426765
141383 639857
681865 117459
404145 157540
910114 138676
672147 141383
718890 458936
138676 37879
404145 381292
141383 193710
117459 79216
628540 151128
458936 864419
190...

output:

Yes
181473 624574 251067 663998 89987 588774 900312 102900 975445 440304 534376 21348 663970 849110 238654 131584 532366 591098 821009 101431 353622 652228 512447 808057 706802 175810 76848 770604 543712 767687 971679 76519 497462 584 661071 203062 710502 139881 713941 921909 851759 791792 756936 74...

result:

ok found a correct permutation