QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#152097#4989. Berry BattleZhangYiDeAC ✓126ms47660kbC++232.0kb2023-08-27 16:42:062023-08-27 16:42:07

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3580kb

input:

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

output:

YES
2 1 8 5 6 3 4 9 7 10 

result:

ok 

Test #2:

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

input:

3
1 2
2 3

output:

NO

result:

ok 

Test #3:

score: 0
Accepted
time: 1ms
memory: 3512kb

input:

3
1 3
3 2

output:

NO

result:

ok 

Test #4:

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

input:

4
2 4
4 1
3 4

output:

NO

result:

ok 

Test #5:

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

input:

5
5 3
2 1
4 5
3 1

output:

YES
3 1 2 5 4 

result:

ok 

Test #6:

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

input:

6
1 2
6 5
5 2
3 4
4 2

output:

YES
2 1 4 3 5 6 

result:

ok 

Test #7:

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

input:

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

output:

YES
10 1 9 7 5 3 6 4 2 8 

result:

ok 

Test #8:

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

input:

100
42 8
32 6
92 57
47 76
69 34
24 20
61 57
22 10
18 26
89 64
13 76
38 34
23 34
54 69
88 26
66 95
34 2
93 80
77 56
96 10
44 91
86 1
90 26
19 56
30 10
4 30
45 6
8 34
17 37
97 73
67 19
58 65
75 74
39 20
57 71
53 45
25 90
51 1
79 22
55 54
15 76
74 11
70 2
95 34
60 25
91 34
48 58
16 57
64 76
37 11
40 9
...

output:

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

result:

ok 

Test #9:

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

input:

200
16 122
183 100
132 29
72 90
127 78
31 151
133 8
161 93
49 103
131 113
121 59
60 15
44 183
130 105
155 170
192 191
156 167
95 85
163 77
154 41
199 101
103 158
20 68
54 2
114 50
167 128
149 166
21 141
119 110
170 73
63 19
33 154
120 124
151 113
26 187
15 112
91 83
70 194
51 197
116 6
176 158
175 1...

output:

YES
124 120 132 29 28 168 184 190 125 64 52 104 162 7 94 13 200 57 38 186 195 123 76 127 3 138 55 78 183 44 107 100 61 6 116 46 74 117 198 69 193 175 84 37 126 30 151 31 137 75 148 113 131 156 159 167 171 128 9 39 152 5 115 14 101 199 33 32 35 154 41 68 20 146 97 34 134 48 111 77 163 192 191 150 105...

result:

ok 

Test #10:

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

input:

200
56 198
56 128
56 76
56 90
56 155
56 32
56 55
56 1
56 83
56 59
56 133
56 115
56 30
56 131
56 40
56 177
56 166
56 63
56 104
56 13
56 164
56 152
56 47
56 38
56 127
56 199
56 145
56 20
56 36
56 46
56 137
56 190
56 146
56 183
56 187
56 6
56 194
56 77
56 160
56 138
56 149
56 64
56 100
56 117
56 27
56 ...

output:

NO

result:

ok 

Test #11:

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

input:

200
3 138
3 187
3 13
3 36
3 26
3 59
3 69
3 54
3 27
3 154
3 82
3 132
3 161
3 101
3 198
3 6
3 193
3 169
3 60
3 85
3 166
3 57
3 28
3 163
3 89
3 93
3 135
3 16
3 125
3 62
3 71
3 150
3 2
3 21
3 127
3 121
3 95
3 39
3 179
3 90
3 98
3 104
3 182
3 103
3 177
3 174
3 172
3 49
3 88
3 178
3 51
3 200
3 159
3 48
3 ...

output:

YES
3 1 2 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 39 40 42 44 46 47 49 50 51 52 54 57 59 60 62 63 64 65 66 68 69 71 72 73 74 76 77 78 79 80 81 82 84 85 87 88 89 90 91 92 93 94 95 96 97 98 100 102 103 104 106 108 109 111 113 114 115 116 117 119 120...

result:

ok 

Test #12:

score: 0
Accepted
time: 122ms
memory: 40916kb

input:

300000
114853 264153
298031 43573
189277 96893
68911 129144
83395 244009
1019 185588
39660 143053
246340 144880
244223 132708
152084 27057
230030 57377
141813 235567
64190 230887
105772 151822
258236 227531
184923 92096
66128 16467
199270 173492
78538 249107
232394 197343
268822 246960
281154 197354...

output:

YES
8604 28520 187761 54100 19703 179246 17109 240337 154671 238837 267206 114482 118992 158716 95523 219621 225124 112027 218647 48083 38016 176888 26810 100070 90344 136181 102026 47406 138697 148403 278617 88875 174 162237 60772 101962 283201 224315 41524 268396 60997 204857 27042 260767 292498 1...

result:

ok 

Test #13:

score: 0
Accepted
time: 112ms
memory: 39292kb

input:

300000
37117 223947
199643 280354
274799 172294
226464 27333
43649 32485
130021 84630
70467 44592
112478 126488
133072 64293
271409 15857
288456 210421
139805 140
162685 49229
14096 273871
55693 11924
137750 93654
255246 78666
132904 163741
50059 8408
121274 230817
269075 125691
270537 260948
277126...

output:

YES
273370 108492 26915 77938 87545 207814 97045 207385 269678 24191 282747 48111 141840 249374 18606 190931 25320 218634 169345 186700 143362 258387 101797 77638 118238 17716 5113 144940 572 91548 207439 188746 176091 275976 94109 177060 261752 120423 79550 200495 79629 102389 298494 235601 178407 ...

result:

ok 

Test #14:

score: 0
Accepted
time: 119ms
memory: 40940kb

input:

300000
268783 101895
27590 114760
14864 171076
137533 59382
133722 236003
277744 187278
189110 80196
260321 229396
293370 59604
66690 46811
188856 113279
158853 279087
234008 145840
62098 148819
90304 135703
264489 61055
1527 291426
228720 253339
128391 282367
230693 36857
134937 283157
178978 28302...

output:

YES
296827 261927 255352 148220 189147 203290 287669 58926 180268 200798 279930 15424 28572 52448 216630 252324 181983 269950 240855 246300 51024 19040 211794 113237 254431 132768 223234 114561 70752 276964 29848 134221 293834 181259 252738 118519 249796 254670 196064 45118 47767 268249 71862 117394...

result:

ok 

Test #15:

score: 0
Accepted
time: 114ms
memory: 38816kb

input:

300000
150950 267369
289017 3183
121065 253781
250699 196624
166248 1258
62584 164129
74238 205040
69940 242240
206512 45807
237009 152011
106234 113446
262178 6360
11915 293426
240715 210047
155609 91195
5698 108687
52572 64202
259254 131021
23340 3637
101657 75893
50362 114481
46841 259603
92022 2...

output:

YES
30093 276772 140089 144884 142730 102189 46253 123526 287850 99951 287852 181390 118183 286295 125072 242660 174719 252321 58680 279133 87740 206410 254475 157801 214030 76169 203379 198606 130896 117104 38126 223094 81997 264725 2956 117202 233262 89431 263077 23571 92530 271639 67710 147372 31...

result:

ok 

Test #16:

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

input:

300000
49709 89567
116527 61741
285831 50661
101522 82524
53092 66068
86222 189736
218043 73160
13162 26534
168441 105087
11975 25881
90532 14377
232905 194513
267892 122922
272020 12435
149258 264534
123074 211569
169040 7735
137914 80789
257276 127051
35078 31990
179149 44365
178698 23293
114696 1...

output:

YES
161492 7982 298711 277747 241810 32574 291515 240159 284618 223942 90618 186980 104634 39652 268503 203021 76941 71552 79660 81065 270682 260416 141528 162013 13875 98997 230221 189187 53966 45997 61042 263972 155680 180178 153754 299145 281951 86711 32912 219906 73265 252500 93889 7081 292064 1...

result:

ok 

Test #17:

score: 0
Accepted
time: 114ms
memory: 46128kb

input:

300000
11520 95384
25302 98828
47757 177418
33783 201064
249009 132959
160957 223098
69371 147959
297586 265064
111848 112
54402 243987
221427 176478
78297 103877
283871 164241
278667 280291
165910 63063
263388 174421
236875 249121
49837 32872
185947 118645
298053 206918
282114 120453
169448 108351
...

output:

YES
158788 221810 277639 60480 287959 15913 92351 268861 1322 154078 168412 149453 201514 108092 157312 240768 199307 284053 155878 233607 251718 276784 191608 4544 66009 164978 174093 37099 32521 176702 203387 199662 17830 50788 63407 119050 231577 210909 109768 294419 48210 185697 287024 57379 646...

result:

ok 

Test #18:

score: 0
Accepted
time: 123ms
memory: 47660kb

input:

300000
266316 130154
271618 232285
202160 263507
132088 15648
107605 189613
287651 88616
182956 80933
93644 64472
151741 159119
156651 146038
95404 292422
197240 139293
193081 296605
286792 1138
90636 95542
221620 185379
21658 170349
261710 33666
32379 29518
47764 23367
137414 92197
292446 226026
28...

output:

YES
285467 142253 60305 186780 213737 277770 82565 92336 64231 209630 275056 226513 187846 282442 120694 118479 283778 97971 198942 12918 12898 256768 260698 247039 131913 238076 269868 280577 228614 116334 60303 218542 215769 181301 213325 111867 33160 161827 134706 214607 180500 14157 76639 133829...

result:

ok 

Test #19:

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

input:

300000
12780 264648
12780 121374
12780 42008
12780 95697
12780 976
12780 177512
12780 106434
12780 278098
12780 140080
12780 110499
12780 295006
12780 235728
12780 299674
12780 116423
12780 279890
12780 244785
12780 180340
12780 197080
12780 103638
12780 7503
12780 151147
12780 87425
12780 247699
12...

output:

NO

result:

ok 

Test #20:

score: 0
Accepted
time: 107ms
memory: 38224kb

input:

300000
299736 96862
299736 241034
299736 200539
299736 117184
299736 262455
299736 285421
299736 289066
299736 110126
299736 121907
299736 159583
299736 35052
299736 225040
299736 83339
299736 44763
299736 139926
299736 1418
299736 131518
299736 166271
299736 274471
299736 296220
299736 146978
29973...

output:

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

result:

ok 

Test #21:

score: 0
Accepted
time: 101ms
memory: 40580kb

input:

300000
279101 105712
279101 249105
279101 112302
279101 17133
279101 30550
279101 152384
279101 275247
279101 159978
279101 40600
279101 248027
279101 133490
279101 130020
279101 127010
279101 111540
279101 121005
279101 150446
279101 107171
279101 215779
279101 13025
279101 132710
279101 39038
2791...

output:

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

result:

ok 

Test #22:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

200
107 93
93 144
107 70
93 23
107 162
93 3
107 174
93 26
107 195
93 101
107 126
93 55
107 183
93 74
107 59
93 76
107 118
93 38
107 54
93 29
107 61
93 152
107 125
93 122
107 192
93 85
107 77
93 25
107 133
93 123
107 87
93 172
107 71
93 167
107 60
93 120
107 184
93 68
107 104
93 80
107 95
93 96
107 1...

output:

YES
107 4 7 9 13 14 16 17 19 22 24 28 33 36 43 50 53 54 56 57 58 59 60 61 62 63 64 66 67 69 70 71 72 77 78 79 81 82 84 87 88 89 90 92 95 98 100 103 104 105 106 108 110 111 118 119 124 125 126 127 128 129 133 134 135 136 137 138 140 141 142 143 145 147 151 153 156 157 158 159 162 164 170 171 173 174 ...

result:

ok 

Test #23:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

200
12 102
102 116
12 105
102 174
12 133
102 144
12 108
102 13
12 151
102 110
12 91
102 162
12 98
102 38
12 149
102 74
12 47
102 190
12 10
102 175
12 186
102 153
12 85
102 199
12 36
102 29
12 147
102 1
12 152
102 45
12 11
102 84
12 146
102 119
12 179
102 7
12 32
102 53
12 9
102 118
12 141
102 177
12...

output:

YES
102 1 3 6 7 13 16 17 18 19 20 21 24 27 29 33 34 37 38 44 45 49 53 57 59 63 64 65 68 70 74 75 78 79 80 83 84 87 93 100 101 107 110 111 112 113 116 117 119 120 122 123 124 125 126 138 139 142 143 144 148 150 156 158 159 160 162 166 168 173 174 175 176 177 180 181 182 183 185 187 188 190 193 195 19...

result:

ok 

Test #24:

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

input:

300000
90531 114135
114135 178759
90531 123121
114135 161955
90531 120679
114135 205637
90531 97753
114135 97745
90531 46366
114135 13177
90531 232931
114135 139366
90531 180616
114135 72520
90531 287031
114135 14029
90531 45741
114135 288828
90531 111901
114135 63091
90531 83073
114135 77690
90531 ...

output:

YES
90531 1 3 8 16 17 20 22 30 34 35 38 40 41 42 45 46 47 50 51 54 56 58 59 61 62 63 65 66 68 72 74 75 78 81 82 84 87 88 90 93 97 98 99 102 104 109 112 113 115 119 120 124 125 127 131 132 133 136 139 140 143 145 146 147 149 151 152 155 158 161 162 166 170 172 174 175 179 181 182 183 184 189 190 191 ...

result:

ok 

Test #25:

score: 0
Accepted
time: 103ms
memory: 38592kb

input:

300000
141727 171472
171472 62588
141727 30250
171472 267034
141727 37741
171472 141522
141727 159683
171472 256922
141727 241118
171472 153803
141727 18425
171472 172334
141727 124007
171472 13772
141727 10366
171472 213390
141727 173862
171472 77299
141727 218798
171472 122799
141727 34360
171472 ...

output:

YES
141727 2 5 6 8 9 12 14 18 19 20 22 23 25 27 28 29 30 32 33 34 39 40 41 42 45 46 49 50 51 52 55 61 62 63 65 66 67 68 69 70 71 72 74 79 80 81 82 86 87 88 89 90 93 95 96 97 99 100 101 102 104 106 111 112 113 115 118 119 121 122 123 126 127 129 130 133 134 138 139 142 145 146 147 148 150 151 152 153...

result:

ok 

Test #26:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

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

output:

YES
8 7 9 1 10 3 5 4 6 2 

result:

ok 

Test #27:

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

input:

100000
4758 24995
70871 48101
57182 14922
78150 88326
5931 79858
4301 85469
17851 58413
60571 32187
75364 94152
24329 33975
99469 3833
26334 70008
78549 7447
9947 73063
18450 61713
24760 56646
9992 98945
34938 175
81746 41108
46227 77863
94891 10911
39706 67754
73219 55460
81410 3578
43031 14828
380...

output:

YES
8190 18051 46384 78120 93076 2082 34010 431 54380 40584 70656 70737 15836 33052 69112 60173 45402 65798 74837 8326 63785 25383 24020 32551 46246 41648 73714 31152 12236 69607 68768 97724 33122 81255 27259 82928 21162 60984 35702 73023 92107 54751 56406 95114 75295 17662 82114 71472 46606 32184 4...

result:

ok 

Test #28:

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

input:

6
5 3
3 6
5 2
3 4
5 1

output:

YES
3 4 6 5 1 2 

result:

ok 

Test #29:

score: 0
Accepted
time: 1ms
memory: 3792kb

input:

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

output:

YES
3 2 6 8 5 1 4 7 

result:

ok 

Test #30:

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

input:

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

output:

YES
2 5 7 8 1 3 4 6 

result:

ok 

Test #31:

score: 0
Accepted
time: 1ms
memory: 3756kb

input:

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

output:

YES
5 1 4 7 8 2 3 6 

result:

ok 

Test #32:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

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

output:

YES
2 1 5 8 4 3 6 7 

result:

ok 

Test #33:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

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

output:

YES
7 2 3 8 6 1 4 5 

result:

ok 

Test #34:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

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

output:

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

result:

ok 

Test #35:

score: 0
Accepted
time: 1ms
memory: 3528kb

input:

128
53 111
111 61
53 48
111 121
53 32
111 93
53 97
111 19
53 35
111 105
53 8
111 101
53 44
111 94
53 58
111 80
53 16
111 79
53 96
111 88
53 90
111 98
53 55
111 17
53 69
111 40
53 84
111 59
53 126
111 71
53 36
111 47
53 14
111 49
53 77
111 128
53 22
111 20
53 10
111 54
53 95
111 119
53 12
111 64
53 2...

output:

YES
111 3 4 6 9 13 15 17 18 19 20 26 29 33 34 38 39 40 42 46 47 49 51 54 56 59 60 61 63 64 66 68 70 71 72 78 79 80 83 85 88 92 93 94 98 101 104 105 107 108 109 113 114 115 116 117 118 119 120 121 122 123 127 128 53 1 2 5 7 8 10 11 12 14 16 21 22 23 24 25 27 28 30 31 32 35 36 37 41 43 44 45 48 50 52 ...

result:

ok 

Test #36:

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

input:

300000
250443 449
250443 22884
250443 144955
250443 124134
250443 166560
250443 196513
250443 53759
250443 191771
250443 152495
250443 146696
250443 33720
250443 74643
250443 148572
250443 259831
250443 152960
250443 28807
250443 274820
250443 105639
250443 159610
250443 147117
250443 117152
250443 ...

output:

YES
250443 3 4 5 11 16 17 18 23 24 27 28 33 35 36 37 40 43 44 45 46 47 48 50 51 53 54 59 60 63 64 65 66 67 68 71 72 75 77 79 80 82 85 86 88 91 92 93 97 100 101 103 104 105 107 108 109 110 111 112 114 117 118 121 123 125 127 134 136 137 139 142 146 148 149 150 154 155 156 158 160 161 167 169 173 174 ...

result:

ok 

Test #37:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

4
1 2
3 4
1 4

output:

YES
4 3 1 2 

result:

ok 

Test #38:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

4
1 3
1 4
3 2

output:

YES
1 4 3 2 

result:

ok 

Test #39:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

4
1 4
2 3
2 4

output:

YES
2 3 4 1 

result:

ok 

Test #40:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

4
2 4
1 2
4 3

output:

YES
4 3 2 1 

result:

ok 

Test #41:

score: 0
Accepted
time: 1ms
memory: 3792kb

input:

4
4 3
4 2
1 2

output:

YES
4 3 2 1 

result:

ok 

Test #42:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

4
2 3
4 2
3 1

output:

YES
2 4 3 1 

result:

ok 

Test #43:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

4
1 3
2 1
4 2

output:

YES
2 4 1 3 

result:

ok 

Test #44:

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

input:

4
3 2
1 3
4 2

output:

YES
2 4 3 1 

result:

ok 

Test #45:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

4
4 1
4 3
1 2

output:

YES
4 3 1 2 

result:

ok 

Test #46:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

5
2 3
5 1
2 4
5 3

output:

YES
3 5 1 2 4 

result:

ok 

Test #47:

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

input:

6
2 5
5 1
3 6
4 6
3 1

output:

YES
3 6 4 1 5 2 

result:

ok 

Test #48:

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

input:

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

output:

YES
2 6 4 1 5 7 3 

result:

ok 

Test #49:

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

input:

4
4 2
2 3
4 1

output:

YES
2 3 4 1 

result:

ok 

Test #50:

score: 0
Accepted
time: 1ms
memory: 3528kb

input:

4
1 4
1 2
3 2

output:

YES
1 4 2 3 

result:

ok 

Test #51:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

4
1 2
1 4
2 3

output:

YES
1 4 2 3 

result:

ok 

Test #52:

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

input:

4
1 3
1 4
3 2

output:

YES
1 4 3 2 

result:

ok 

Test #53:

score: 0
Accepted
time: 1ms
memory: 3512kb

input:

6
1 2
1 3
1 4
2 5
2 6

output:

YES
2 5 6 1 3 4 

result:

ok 

Test #54:

score: 0
Accepted
time: 1ms
memory: 3512kb

input:

6
1 6
6 5
5 3
4 5
2 6

output:

YES
5 3 4 6 1 2 

result:

ok 

Test #55:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

6
2 4
4 6
1 3
5 3
4 1

output:

YES
1 3 5 4 2 6 

result:

ok 

Test #56:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

6
3 4
4 1
2 4
6 3
3 5

output:

YES
3 5 6 4 1 2 

result:

ok 

Test #57:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

6
1 2
1 3
5 6
5 4
5 1

output:

YES
5 4 6 1 2 3 

result:

ok 

Test #58:

score: 0
Accepted
time: 1ms
memory: 3500kb

input:

6
6 1
6 2
3 4
5 3
6 3

output:

YES
3 4 5 6 1 2 

result:

ok