QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#534887#4927. Bounded Spanning Treeegypt_ioi2024_05#64 925ms111220kbC++202.0kb2024-08-27 17:12:072024-08-27 17:12:08

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 4
Accepted
time: 339ms
memory: 69376kb

input:

1
500001 500000
254401 281557 349855 349855
181158 183050 7695 7695
168649 393239 182447 182447
275491 426002 407013 407013
412840 430191 81351 81351
180729 474744 468590 468590
167128 233022 352396 352396
56562 410078 411755 411755
28611 28934 27783 27783
250615 303207 495889 495889
348947 377767 2...

output:

YES
349855 7695 182447 407013 81351 468590 352396 411755 27783 495889 279148 126532 371490 46443 75037 440945 17872 376183 227217 256463 268704 93994 142674 221161 313215 423148 348655 110097 61558 138416 182869 460629 101134 233433 485321 293910 161637 31401 388370 43691 103888 258050 186588 285649...

result:

ok all is ok (1 test case)

Test #2:

score: 0
Time Limit Exceeded

input:

1
300001 500000
146540 236321 23350 23350
110737 197257 49315 49315
87807 244200 2878 2878
27529 179675 90834 90834
39761 204225 209751 209751
175226 239307 945 945
25136 248902 243667 243667
215811 229229 48401 48401
152882 243088 63537 63537
136220 210273 244339 244339
31127 43815 196573 196573
31...

output:


result:


Subtask #2:

score: 6
Accepted

Test #22:

score: 6
Accepted
time: 1ms
memory: 5676kb

input:

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

output:

YES
3 8 5 2 1 6 10 9 7 4 

result:

ok all is ok (1 test case)

Test #23:

score: 6
Accepted
time: 1ms
memory: 5884kb

input:

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

output:

YES
1 7 6 2 3 5 4 8 9 

result:

ok all is ok (1 test case)

Test #24:

score: 6
Accepted
time: 1ms
memory: 5924kb

input:

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

output:

YES
9 1 6 3 4 2 8 5 10 7 

result:

ok all is ok (1 test case)

Test #25:

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

input:

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

output:

YES
8 4 5 2 1 3 9 7 6 

result:

ok all is ok (1 test case)

Test #26:

score: 6
Accepted
time: 1ms
memory: 5848kb

input:

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

output:

YES
2 9 3 5 1 6 10 7 8 4 

result:

ok all is ok (1 test case)

Test #27:

score: 6
Accepted
time: 1ms
memory: 5676kb

input:

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

output:

YES
8 5 1 4 2 9 3 6 7 

result:

ok all is ok (1 test case)

Test #28:

score: 6
Accepted
time: 1ms
memory: 5676kb

input:

2
4 5
2 3 1 1
2 4 2 3
1 2 5 5
2 3 3 3
2 4 4 5
4 5
2 3 1 2
1 2 1 2
1 4 3 3
3 4 4 4
1 3 5 5

output:

YES
1 2 5 3 4 
YES
1 2 3 4 5 

result:

ok all is ok (2 test cases)

Test #29:

score: 6
Accepted
time: 1ms
memory: 5620kb

input:

3
3 3
1 3 1 2
1 2 3 3
1 2 1 2
3 3
1 2 1 1
1 3 2 3
2 3 3 3
3 3
2 3 3 3
1 2 2 3
2 3 1 1

output:

NO
YES
1 2 3 
NO

result:

ok all is ok (3 test cases)

Test #30:

score: 6
Accepted
time: 1ms
memory: 5624kb

input:

1
4 4
1 2 1 3
2 3 1 4
3 4 4 4
2 3 2 2

output:

YES
3 1 4 2 

result:

ok all is ok (1 test case)

Test #31:

score: 6
Accepted
time: 1ms
memory: 5564kb

input:

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

output:

YES
10 3 2 1 8 6 4 9 5 7 

result:

ok all is ok (1 test case)

Test #32:

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

input:

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

output:

YES
7 1 3 5 10 4 2 9 8 6 

result:

ok all is ok (1 test case)

Subtask #3:

score: 10
Accepted

Dependency #2:

100%
Accepted

Test #33:

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

input:

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

output:

YES
3 2 1 5 4 6 
NO
YES
1 2 3 6 4 5 

result:

ok all is ok (3 test cases)

Test #34:

score: 10
Accepted
time: 1ms
memory: 5560kb

input:

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

output:

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

result:

ok all is ok (1 test case)

Test #35:

score: 10
Accepted
time: 1ms
memory: 5852kb

input:

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

output:

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

result:

ok all is ok (1 test case)

Test #36:

score: 10
Accepted
time: 1ms
memory: 5620kb

input:

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

output:

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

result:

ok all is ok (1 test case)

Test #37:

score: 10
Accepted
time: 1ms
memory: 5872kb

input:

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

output:

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

result:

ok all is ok (1 test case)

Test #38:

score: 10
Accepted
time: 1ms
memory: 5852kb

input:

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

output:

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

result:

ok all is ok (1 test case)

Test #39:

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

input:

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

output:

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

result:

ok all is ok (1 test case)

Test #40:

score: 10
Accepted
time: 1ms
memory: 5620kb

input:

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

output:

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

result:

ok all is ok (2 test cases)

Test #41:

score: 10
Accepted
time: 1ms
memory: 5652kb

input:

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

output:

NO
YES
6 2 3 1 5 4 
NO

result:

ok all is ok (3 test cases)

Test #42:

score: 10
Accepted
time: 1ms
memory: 5720kb

input:

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

output:

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

result:

ok all is ok (1 test case)

Test #43:

score: 10
Accepted
time: 1ms
memory: 5620kb

input:

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

output:

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

result:

ok all is ok (1 test case)

Test #44:

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

input:

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

output:

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

result:

ok all is ok (1 test case)

Subtask #4:

score: 10
Accepted

Test #45:

score: 10
Accepted
time: 1ms
memory: 5972kb

input:

1
501 500
127 170 433 434
26 98 284 285
179 379 82 82
136 270 253 254
100 391 474 476
175 393 170 171
247 311 223 225
32 318 270 270
87 434 294 294
335 417 308 310
249 356 292 294
327 331 42 44
325 498 334 336
73 133 260 262
276 394 493 495
74 289 330 331
29 83 244 245
7 486 482 483
115 368 90 90
22...

output:

YES
433 285 82 254 476 170 225 270 294 309 293 44 336 262 494 331 244 483 90 277 32 115 416 106 240 386 479 444 125 500 489 306 399 86 474 408 455 458 15 88 43 141 24 129 33 383 29 342 333 381 448 216 346 365 2 25 397 14 499 357 326 310 391 139 366 487 449 361 498 284 436 153 481 413 83 328 84 187 3...

result:

ok all is ok (1 test case)

Test #46:

score: 10
Accepted
time: 1ms
memory: 5676kb

input:

1
501 500
129 176 247 250
72 179 289 289
170 435 422 422
135 320 255 256
126 397 150 150
25 112 29 29
341 422 112 112
68 176 419 421
83 208 266 267
111 470 144 149
212 488 163 165
109 261 468 468
457 478 500 500
298 426 427 432
61 408 459 464
235 440 297 302
114 117 307 307
132 448 37 38
128 380 219...

output:

YES
248 289 422 255 150 29 112 420 266 146 163 468 500 431 462 300 307 37 220 428 358 167 11 123 66 265 416 413 435 484 13 319 83 406 454 242 52 94 397 202 195 4 56 62 291 458 135 310 143 252 264 487 54 363 118 367 256 467 286 244 1 22 73 180 196 229 386 473 477 384 250 238 153 51 104 233 486 414 23...

result:

ok all is ok (1 test case)

Test #47:

score: 10
Accepted
time: 1ms
memory: 5732kb

input:

1
501 500
277 399 197 204
33 426 390 390
202 417 268 272
223 466 15 23
195 379 85 94
100 203 16 22
184 245 142 144
188 474 117 122
195 353 139 143
62 373 412 416
383 390 319 327
40 108 143 153
67 366 53 56
18 325 172 182
272 314 135 137
51 86 237 247
77 313 399 408
22 199 29 36
18 132 422 423
97 345...

output:

YES
201 390 270 21 91 16 142 121 139 414 325 151 53 176 135 242 407 31 422 355 12 313 41 470 293 120 99 493 211 289 88 169 437 32 497 371 205 314 4 19 180 129 296 2 331 421 101 225 360 241 488 144 67 212 476 118 367 258 158 387 286 484 219 349 483 369 344 474 480 271 244 339 405 441 264 226 332 403 ...

result:

ok all is ok (1 test case)

Test #48:

score: 10
Accepted
time: 1ms
memory: 5712kb

input:

1
501 500
212 481 169 188
28 427 404 420
339 466 43 62
229 281 111 126
89 143 234 238
333 444 160 168
288 484 431 451
177 432 441 453
384 407 418 427
146 340 118 118
92 249 467 479
53 469 396 398
63 70 174 180
54 367 8 19
285 360 153 164
67 389 286 291
91 442 99 104
1 455 58 67
207 309 453 472
286 4...

output:

YES
182 413 59 117 235 166 442 445 420 118 472 396 175 13 159 288 99 62 467 24 82 44 494 432 167 153 7 401 25 473 362 119 146 202 270 490 203 220 302 200 223 477 247 71 395 199 116 398 114 227 234 368 157 83 106 284 440 245 400 485 340 410 164 342 4 470 226 46 156 322 304 232 177 421 361 389 334 438...

result:

ok all is ok (1 test case)

Test #49:

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

input:

1
501 500
183 475 152 172
6 264 94 97
102 116 454 461
332 436 250 258
275 339 11 23
109 383 491 500
12 251 156 165
409 496 253 282
319 386 465 469
130 292 121 123
30 333 21 23
40 194 254 255
86 345 338 348
73 434 99 118
119 450 221 228
246 350 35 51
186 255 99 102
182 279 392 413
206 332 247 250
128...

output:

YES
166 94 454 251 13 492 156 278 465 121 21 254 339 108 224 40 99 405 247 197 478 249 404 199 161 269 148 363 412 371 453 444 481 426 296 285 73 316 189 297 244 354 169 246 341 488 439 245 448 280 179 220 500 68 6 7 298 358 227 407 343 119 437 39 392 51 411 255 143 88 475 62 382 346 267 291 83 309 ...

result:

ok all is ok (1 test case)

Test #50:

score: 10
Accepted
time: 1ms
memory: 5768kb

input:

1
501 500
56 261 38 63
139 152 248 251
173 435 92 131
254 445 21 36
74 246 202 208
52 442 422 447
328 340 434 466
179 434 92 126
200 241 127 132
48 294 183 203
72 271 147 172
42 382 245 265
330 466 349 368
59 216 120 125
279 443 359 381
469 478 292 309
51 100 21 39
186 475 275 299
94 495 420 429
323...

output:

YES
45 248 121 26 202 437 452 110 127 195 164 253 355 120 366 300 28 287 421 319 179 462 445 394 220 350 27 302 465 244 83 12 61 443 95 59 433 257 395 138 488 43 429 477 372 13 328 76 406 224 460 499 104 133 500 316 209 193 19 277 55 428 208 472 474 486 11 223 390 270 377 410 156 21 461 311 409 301 ...

result:

ok all is ok (1 test case)

Test #51:

score: 10
Accepted
time: 1ms
memory: 5704kb

input:

1
501 500
317 393 166 174
219 415 120 143
11 28 409 436
197 470 35 76
401 460 189 236
201 230 45 94
211 461 319 359
211 220 246 255
283 343 81 125
211 258 121 162
261 270 350 376
210 226 405 411
449 477 131 167
360 464 161 204
35 416 237 247
85 408 272 306
105 437 163 194
110 267 167 196
17 237 482 ...

output:

YES
168 132 420 62 218 73 339 247 111 145 360 405 149 191 237 289 179 180 482 495 165 318 319 399 223 269 306 457 398 453 81 232 365 195 203 477 108 197 300 352 340 299 33 2 162 254 463 288 258 454 38 302 234 341 268 78 206 396 293 170 204 235 192 322 353 154 414 455 439 409 45 256 21 312 25 236 323...

result:

ok all is ok (1 test case)

Test #52:

score: 10
Accepted
time: 1ms
memory: 5672kb

input:

1
501 500
66 362 223 231
19 173 108 146
267 468 15 84
269 309 295 302
438 462 348 415
132 187 474 498
91 416 92 191
141 161 71 169
142 309 153 177
59 390 139 220
57 203 359 449
172 362 463 466
226 463 444 495
344 369 1 68
122 266 320 336
293 326 316 358
108 207 34 114
14 140 153 182
339 383 363 383
...

output:

YES
223 120 49 295 378 475 166 144 154 184 413 463 474 30 320 329 84 156 363 123 159 261 437 121 125 423 28 218 58 443 336 272 398 224 415 394 448 306 359 165 347 425 314 337 67 17 18 7 39 104 95 436 352 382 309 197 105 270 477 318 93 353 366 350 418 285 262 36 483 133 402 449 362 220 432 215 471 46...

result:

ok all is ok (1 test case)

Test #53:

score: 10
Accepted
time: 1ms
memory: 5668kb

input:

1
501 500
419 457 238 270
52 410 93 141
101 172 97 163
146 274 112 149
277 448 127 325
435 440 46 195
375 380 159 299
107 306 326 359
31 441 188 346
6 55 174 197
74 340 16 123
38 437 1 72
265 366 178 255
203 442 1 105
42 119 215 281
54 65 1 85
72 213 14 208
358 392 301 302
210 359 125 197
142 293 27...

output:

YES
238 93 102 112 275 140 247 326 293 174 61 25 205 50 230 39 151 301 141 272 211 390 145 66 382 249 319 75 148 375 4 135 448 434 1 481 294 18 317 256 497 27 69 321 420 265 234 49 439 158 198 131 417 397 430 70 362 307 337 412 414 92 366 282 324 427 128 170 173 74 331 30 479 342 437 407 178 308 445...

result:

ok all is ok (1 test case)

Test #54:

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

input:

1
501 500
153 365 163 163
123 153 196 196
123 282 30 33
282 361 105 110
85 361 466 471
85 126 290 290
43 126 8 9
43 273 423 425
273 357 101 101
142 357 62 63
142 499 336 341
22 499 493 495
22 408 125 127
54 408 124 129
54 355 85 88
315 355 113 116
60 315 198 200
60 309 37 42
309 369 53 57
95 369 144...

output:

YES
163 196 31 107 470 290 8 424 101 62 341 494 125 128 85 115 199 40 55 144 130 71 222 489 221 202 388 246 218 339 20 467 10 5 299 72 429 360 166 44 183 56 334 328 172 82 335 309 407 317 495 219 230 291 376 463 46 161 54 274 105 347 297 91 226 310 304 158 9 243 466 180 208 439 106 302 98 455 440 16...

result:

ok all is ok (1 test case)

Test #55:

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

input:

1
501 500
23 115 137 146
23 68 233 249
53 68 53 59
53 342 321 335
11 342 342 356
11 279 281 295
76 279 401 414
76 236 441 448
236 454 468 484
325 454 240 253
287 325 418 423
287 351 423 435
14 351 318 331
14 141 206 208
141 404 309 312
166 404 53 64
84 166 270 283
84 311 42 57
205 311 347 357
161 20...

output:

YES
138 243 53 329 351 291 411 441 477 248 418 428 322 206 309 59 278 48 352 263 37 249 220 54 448 75 376 24 333 358 454 389 74 393 303 456 88 117 253 449 161 420 87 149 104 193 30 498 306 458 266 8 165 423 414 73 26 183 124 392 148 388 315 287 135 284 493 367 401 179 349 96 455 408 412 254 386 182 ...

result:

ok all is ok (1 test case)

Test #56:

score: 10
Accepted
time: 1ms
memory: 5688kb

input:

1
501 500
106 202 458 492
36 202 180 230
36 327 245 293
133 327 448 463
133 174 211 216
174 256 73 89
256 278 82 113
111 278 242 292
111 194 15 42
194 480 188 211
432 480 473 500
161 432 191 193
55 161 290 320
7 55 347 390
7 28 17 25
28 418 188 197
408 418 48 91
389 408 52 69
297 389 459 486
268 297...

output:

YES
476 217 281 454 211 73 100 279 26 200 495 191 302 378 17 189 78 57 469 223 321 85 322 234 341 422 418 59 479 61 213 376 282 269 260 480 203 63 287 214 144 10 490 113 481 129 65 242 19 492 165 146 298 69 470 97 464 58 290 123 429 283 397 437 198 122 207 119 136 153 304 333 68 225 317 491 252 190 ...

result:

ok all is ok (1 test case)

Test #57:

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

input:

1
501 500
128 431 134 232
62 431 214 243
118 431 68 159
194 431 157 213
422 431 297 355
226 431 377 461
208 431 112 196
179 431 202 288
46 431 1 72
302 431 68 110
353 431 313 313
197 431 1 17
233 431 111 162
12 431 443 500
234 431 167 234
387 431 466 500
35 431 244 332
397 431 487 500
204 431 430 49...

output:

YES
206 215 134 179 328 440 168 261 42 88 313 5 137 490 207 480 301 488 465 18 254 384 7 122 339 63 422 77 35 494 36 52 198 43 438 31 167 495 60 255 275 25 131 446 442 473 341 175 124 111 352 475 8 194 62 399 346 375 49 57 222 314 400 53 187 265 484 219 434 409 83 39 345 269 276 372 320 333 308 85 2...

result:

ok all is ok (1 test case)

Test #58:

score: 10
Accepted
time: 1ms
memory: 5976kb

input:

1
501 500
22 209 135 163
22 127 290 314
22 45 167 197
22 333 178 195
22 275 131 163
22 346 137 139
22 382 177 202
22 48 126 154
22 253 405 440
22 415 466 492
22 168 112 119
22 252 445 465
22 337 46 68
22 98 170 192
22 87 314 338
22 448 473 488
22 93 276 287
22 259 459 488
22 77 194 222
22 277 208 21...

output:

YES
153 303 184 183 156 137 191 142 430 482 112 456 58 177 328 473 276 476 207 208 104 455 431 475 122 253 500 219 436 203 14 165 29 463 192 170 140 260 283 348 452 443 313 74 99 123 205 82 354 263 393 467 265 241 146 83 49 368 366 167 129 327 323 480 388 185 148 408 68 319 35 491 378 468 432 239 23...

result:

ok all is ok (1 test case)

Test #59:

score: 10
Accepted
time: 1ms
memory: 5740kb

input:

1
501 500
124 342 261 323
7 124 103 106
124 439 303 341
124 443 316 342
81 124 456 458
124 429 24 53
124 413 205 262
75 124 54 91
124 336 348 382
124 433 412 452
124 147 349 401
124 180 91 150
124 501 385 434
124 133 191 247
124 447 152 220
18 124 469 493
124 271 67 76
124 316 395 457
124 279 260 29...

output:

YES
302 103 318 319 456 41 241 71 363 435 386 125 415 227 201 469 67 439 276 346 374 54 314 179 376 440 215 483 143 457 265 486 280 354 122 36 89 322 30 190 82 335 408 152 373 453 222 131 205 377 309 239 114 433 345 133 81 406 204 198 470 161 353 398 142 170 177 64 146 323 69 21 359 365 337 20 186 1...

result:

ok all is ok (1 test case)

Test #60:

score: 10
Accepted
time: 1ms
memory: 5972kb

input:

1
501 500
233 402 267 276
144 233 313 315
156 233 23 33
233 266 9 15
19 233 297 310
233 324 106 116
233 493 402 402
233 323 357 372
16 233 142 147
134 233 448 455
171 233 164 164
37 233 150 159
233 245 387 397
233 432 229 230
233 272 275 276
145 233 188 201
109 233 166 172
233 482 476 477
233 464 24...

output:

YES
273 313 27 13 307 113 402 368 144 450 164 156 392 229 275 193 167 476 256 152 231 135 173 468 276 338 48 14 247 428 195 46 272 496 29 15 370 471 441 344 107 291 495 66 406 354 125 124 49 20 429 308 158 497 192 378 321 102 139 91 360 318 2 279 440 405 367 334 252 100 138 479 204 6 24 242 359 36 2...

result:

ok all is ok (1 test case)

Test #61:

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

input:

1
501 500
156 217 398 408
56 217 92 93
145 217 57 62
217 399 350 355
82 217 470 474
217 308 311 321
31 217 227 227
217 476 314 324
217 289 386 398
122 217 289 296
217 501 217 229
217 398 328 329
217 458 462 472
217 357 192 199
132 217 266 271
131 217 136 137
152 217 365 374
121 217 375 386
217 358 2...

output:

YES
403 92 58 352 470 318 227 321 395 289 225 328 466 197 268 136 369 380 270 263 350 112 341 88 100 416 46 137 196 338 35 300 459 161 479 81 434 312 49 219 9 311 256 340 119 218 52 111 461 22 314 362 417 386 375 351 398 221 293 418 258 142 247 309 149 273 406 327 354 93 378 373 27 175 66 107 332 43...

result:

ok all is ok (1 test case)

Test #62:

score: 10
Accepted
time: 1ms
memory: 5924kb

input:

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

output:

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

result:

ok all is ok (20 test cases)

Test #63:

score: 10
Accepted
time: 1ms
memory: 5924kb

input:

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

output:

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

result:

ok all is ok (20 test cases)

Test #64:

score: 10
Accepted
time: 1ms
memory: 5700kb

input:

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

output:

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

result:

ok all is ok (20 test cases)

Test #65:

score: 10
Accepted
time: 1ms
memory: 5612kb

input:

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

output:

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

result:

ok all is ok (50 test cases)

Test #66:

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

input:

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

output:

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

result:

ok all is ok (50 test cases)

Test #67:

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

input:

10
51 50
13 32 47 48
3 32 46 50
3 35 13 22
32 40 8 8
22 35 42 50
3 16 31 42
15 22 1 11
22 25 37 50
16 41 5 10
17 22 8 15
34 41 36 37
3 51 10 13
4 16 1 6
35 48 44 50
28 40 26 33
24 32 49 50
4 20 24 24
27 40 20 25
8 25 16 26
40 46 30 41
8 36 4 17
17 18 3 3
19 28 29 37
6 48 5 16
6 7 1 12
20 47 43 49
17...

output:

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

result:

ok all is ok (10 test cases)

Subtask #5:

score: 7
Accepted

Dependency #4:

100%
Accepted

Test #68:

score: 7
Accepted
time: 156ms
memory: 6760kb

input:

1000
501 500
95 327 464 470
95 380 339 349
95 427 301 306
95 188 258 269
95 498 142 151
95 436 484 485
95 171 166 167
95 388 230 237
95 293 258 269
95 247 131 142
95 445 38 44
95 334 329 330
95 238 120 131
95 196 20 23
95 100 406 406
47 95 167 174
35 95 329 333
95 452 122 129
95 492 217 226
95 237 2...

output:

YES
465 346 303 264 148 484 166 235 259 140 40 329 129 20 406 169 330 125 221 257 366 210 123 66 70 441 193 347 268 473 363 47 430 298 374 372 478 208 131 85 4 292 488 356 389 300 150 160 9 269 243 323 494 127 108 217 174 16 139 17 176 137 77 251 74 395 349 328 52 413 274 308 486 225 98 37 164 337 3...

result:

ok all is ok (1000 test cases)

Test #69:

score: 7
Accepted
time: 161ms
memory: 6696kb

input:

1000
501 500
100 384 388 403
100 437 92 107
100 212 128 140
40 100 327 337
100 228 233 236
83 100 382 414
100 288 54 83
100 133 374 377
100 442 6 25
59 100 142 144
100 198 215 220
100 244 476 500
100 416 293 319
100 161 126 147
100 185 249 265
100 433 496 499
31 100 148 177
55 100 384 415
81 100 178...

output:

YES
390 92 129 330 233 402 73 374 12 142 215 499 311 137 255 496 168 405 199 204 491 473 261 275 74 65 363 180 9 302 161 114 494 7 298 319 144 131 140 291 123 214 288 15 32 426 193 357 187 118 35 28 3 66 317 205 231 448 220 306 207 174 446 376 349 380 234 477 465 47 34 403 186 226 95 456 447 110 84 ...

result:

ok all is ok (1000 test cases)

Test #70:

score: 7
Accepted
time: 187ms
memory: 10652kb

input:

100
5001 5000
857 2162 3424 3425
2162 2880 449 452
654 2162 2394 2396
2162 4443 2899 2901
2162 3819 2732 2733
336 2162 233 235
183 2162 584 587
139 2162 1104 1107
2162 3643 1965 1966
1176 2162 4797 4799
1757 2162 4360 4360
964 2162 4232 4234
2162 4678 2201 2203
2162 3881 4540 4542
2162 2901 300 300
...

output:

YES
3424 451 2395 2901 2732 234 586 1105 1965 4798 4360 4234 2202 4541 300 4874 3608 2465 2131 3891 3015 136 3122 2077 3014 495 4207 1372 4050 4895 3097 3970 2664 1076 1125 1961 2102 4432 3027 3554 4753 3190 2257 4403 598 1792 4052 2884 219 1568 215 1469 536 890 904 3636 1303 196 2083 1142 1985 3357...

result:

ok all is ok (100 test cases)

Test #71:

score: 7
Accepted
time: 182ms
memory: 8100kb

input:

100
5001 5000
964 1256 4929 4936
964 1455 4664 4664
964 2385 4455 4459
964 1474 78 83
964 4718 4355 4355
103 964 1617 1620
964 3523 2304 2304
964 1666 1688 1691
964 4453 1781 1782
964 2448 294 296
964 1756 4024 4024
964 4810 4179 4180
964 1792 833 835
964 3503 3019 3024
964 1470 2055 2060
964 3358 6...

output:

YES
4933 4664 4457 80 4355 1618 2304 1689 1781 294 4024 4179 833 3024 2057 672 1488 152 2874 457 673 1386 1738 613 2666 4294 2034 3714 344 2815 3448 4510 3761 3953 3297 4173 2558 1681 3914 1599 3494 2392 1143 1522 1431 1978 4603 802 4174 4814 2804 2328 4285 4256 2521 1678 4005 610 2311 3007 435 2709...

result:

ok all is ok (100 test cases)

Test #72:

score: 7
Accepted
time: 226ms
memory: 14836kb

input:

10
50001 50000
1154 48388 35247 35648
45341 48388 12824 13438
28145 45341 18659 19160
25974 48388 3217 3750
45341 46173 14017 14320
44329 46173 8235 8655
42820 44329 2448 2942
22189 46173 15142 15403
31950 42820 43233 43620
18156 42820 6194 6332
20390 25974 1771 2128
10676 25974 25939 26176
31950 40...

output:

NO
YES
27985 25561 36715 34089 26460 20653 5789 36362 44710 5422 25144 5800 25302 48761 39782 33867 2569 30367 35649 27884 19279 37286 1033 20548 9135 16057 25395 49991 35422 47018 3289 38417 11401 24688 4521 10726 34435 28696 21434 22740 46807 10027 8728 18846 44112 35859 2259 39784 49778 33891 130...

result:

ok all is ok (10 test cases)

Test #73:

score: 7
Accepted
time: 213ms
memory: 12784kb

input:

10
50001 50000
4837 30873 29041 29431
16397 30873 24695 25634
30092 30873 6416 6922
16397 47323 41530 41702
8858 16397 35887 37030
8858 39510 16729 17222
16397 21744 20160 21035
4305 30873 6420 7103
13535 39510 28430 28745
4837 26229 39796 40518
16391 30092 10621 11223
4305 7761 23734 24170
26229 49...

output:

YES
29141 25420 6671 41530 36837 17030 20833 6853 28460 40311 11009 24019 43870 23411 21958 33631 25282 13054 41441 27520 25635 49005 29367 11452 29693 19003 29913 2666 40052 36888 15889 37287 45459 15445 34865 38738 12250 15710 43793 8472 6382 6999 13035 28759 34871 4916 15642 6717 21157 42932 2748...

result:

ok all is ok (10 test cases)

Test #74:

score: 7
Accepted
time: 220ms
memory: 13088kb

input:

10
50001 50000
3297 10597 21893 23332
10597 14002 45779 45913
14002 39203 44537 45776
16230 39203 47133 48076
10597 42719 930 1677
27482 39203 25479 25545
17683 39203 14245 15097
17002 39203 23779 24026
3297 28360 30177 31073
32663 42719 48225 49151
16179 42719 3150 3564
16230 38538 38741 39326
3355...

output:

YES
22961 45779 45379 47586 1241 25479 14764 23779 30632 48696 3150 38891 40474 16360 49428 16719 45075 13243 440 6033 27020 15960 25059 28349 42279 5891 11006 195 14716 44247 1071 28990 33425 33527 3485 36034 5994 23486 30743 18898 39247 5136 10090 8134 33990 17525 28207 36359 39337 21200 3155 1182...

result:

ok all is ok (10 test cases)

Test #75:

score: 7
Accepted
time: 236ms
memory: 12820kb

input:

10
50001 50000
676 21941 9187 9196
5164 22451 39703 39707
14121 18666 48315 48317
29302 34823 46461 46461
46158 48608 42983 42989
7091 22742 7767 7771
5393 43291 46598 46618
37247 42533 10499 10499
9235 14150 27205 27211
28282 45763 4305 4307
26410 41510 23403 23422
2421 29679 23400 23417
33002 3936...

output:

YES
9188 39703 48315 46461 42984 7767 46609 10499 27205 4305 23417 23412 9519 27225 5932 14222 49408 37724 29038 42851 37600 28758 16403 20832 31203 48405 10308 49084 21322 18005 46393 2764 3451 30923 27079 44586 16528 30461 5509 9697 4936 45112 1343 30079 48158 35018 32290 27305 12477 25433 18260 4...

result:

ok all is ok (10 test cases)

Test #76:

score: 7
Accepted
time: 209ms
memory: 10996kb

input:

10
50001 50000
18413 27371 39587 39588
27371 40518 25360 25381
6402 40518 29494 29502
6402 33421 3101 3103
6010 33421 13895 13912
6010 32352 26177 26177
32352 37952 36532 36542
24289 37952 47391 47393
5629 24289 1881 1889
5629 31675 25557 25576
14342 31675 41916 41935
14342 41114 47605 47616
14268 4...

output:

YES
39587 25376 29495 3101 13907 26177 36536 47391 1884 25572 41927 47610 16523 33044 18079 34582 6844 32869 23187 1340 8326 21862 42829 31388 22524 21066 33463 41377 18053 12445 34287 41521 1461 46963 15024 44322 10499 48115 5150 38118 37605 37741 4573 32270 30695 6644 2129 34309 23056 12025 33009 ...

result:

ok all is ok (10 test cases)

Test #77:

score: 7
Accepted
time: 229ms
memory: 14856kb

input:

10
50001 50000
9087 36392 42873 42878
15648 36392 5819 5823
21908 36392 31077 31082
8943 36392 33248 33249
3937 36392 28385 28390
36392 48498 3385 3387
36392 36494 6099 6103
16052 36392 6045 6047
16765 36392 25333 25333
3956 36392 9094 9099
34406 36392 22056 22056
787 36392 6105 6107
35261 36392 326...

output:

YES
42878 5820 31079 33248 28389 3385 6101 6047 25333 9097 22056 6105 32613 35863 10894 18421 37676 14584 12831 13929 15364 11952 7993 2848 5857 24618 10350 4935 19739 845 10079 26643 22266 19656 33382 5968 9457 49782 49028 16542 20838 32950 37500 22147 996 23817 9687 14755 29763 33669 19939 16915 1...

result:

ok all is ok (10 test cases)

Test #78:

score: 7
Accepted
time: 304ms
memory: 69616kb

input:

1
500001 500000
118916 452858 193791 194006
118916 214886 169820 169940
118916 453088 258405 258577
115232 118916 224429 224575
118916 339797 425033 425198
118916 215758 340944 341181
20755 118916 356647 356736
18816 118916 193247 193281
118916 149513 480519 480693
118916 177466 278710 278887
118916...

output:

YES
193938 169859 258491 224498 425116 341115 356676 193247 480608 278815 115104 314693 228351 324010 102505 41486 460352 354574 77597 103140 35652 284471 120138 282484 252248 128531 77702 371686 469230 52796 366569 383022 468809 152897 480323 138097 163228 354081 220987 392378 497065 162033 291695 ...

result:

ok all is ok (1 test case)

Test #79:

score: 7
Accepted
time: 217ms
memory: 12292kb

input:

10
50001 50000
11870 17755 15289 15289
17755 42502 6324 6342
11870 39868 3536 3572
11870 36314 25375 25411
15316 42502 40982 40983
23122 42502 25381 25423
37236 39868 15055 15074
24171 39868 7290 7326
11060 36314 45514 45539
21827 36314 3787 3817
15316 22461 9813 9831
15316 21587 47188 47192
23122 3...

output:

YES
15289 6325 3558 25399 40982 25410 15062 7319 45520 3806 9821 47188 40755 47401 20147 9164 807 1736 24497 21218 17135 48469 12603 26004 45130 14296 13944 1945 12957 18693 38917 34523 4619 14377 42405 9768 4594 43288 19605 44554 14588 22575 6346 32661 15733 28254 9957 48840 9403 16783 44217 15937 ...

result:

ok all is ok (10 test cases)

Test #80:

score: 7
Accepted
time: 341ms
memory: 69972kb

input:

1
500001 500000
420546 473370 406473 406887
373350 420546 414436 414788
20162 473370 172901 173182
386642 473370 60925 61259
355933 373350 143559 143673
373350 478524 178737 179055
20162 348095 396273 396420
20162 429570 113525 113634
386642 493606 112863 113113
326885 386642 495616 495665
95674 355...

output:

YES
406738 414642 173054 61115 143564 178911 396279 113525 112969 495616 457543 88890 91747 50826 99296 431848 421550 492990 227661 128591 460528 433641 180334 233590 29070 231964 411270 302307 78564 472875 377739 192057 466797 294601 446811 91745 411092 370219 117536 466216 26812 456381 260981 2357...

result:

ok all is ok (1 test case)

Test #81:

score: 7
Accepted
time: 312ms
memory: 66300kb

input:

1
500001 500000
32051 443456 87155 87155
32051 227284 94635 94642
131458 227284 247135 247140
131458 276639 497744 497750
148113 276639 231831 231831
36537 148113 372998 372998
36537 272219 107683 107689
272219 454443 242470 242477
96493 454443 39099 39101
96493 333930 380111 380117
86872 333930 465...

output:

YES
87155 94640 247137 497748 231831 372998 107687 242475 39099 380114 465782 176425 194556 158425 35472 148002 339254 185775 339163 241702 79300 352306 413511 102457 128115 461372 406865 455561 341349 243728 316158 371088 301914 424420 257035 148790 45942 224209 156827 35983 117039 24872 8030 27821...

result:

ok all is ok (1 test case)

Test #82:

score: 7
Accepted
time: 319ms
memory: 66064kb

input:

1
500001 500000
52433 271496 254941 255441
271496 476894 21933 22327
146194 476894 492370 493076
94840 146194 456216 456423
94840 353664 225771 226156
353664 375652 180688 181059
65818 375652 17077 17179
65818 472642 456743 456949
140962 472642 489152 489633
140962 240361 243536 243744
139848 240361...

output:

YES
255162 22045 492789 456217 225871 180789 17077 456743 489340 243537 395291 323298 400705 195277 141864 146115 121011 462954 166338 415498 369411 458624 290873 480747 175534 256301 124454 188934 330021 106224 191655 355209 335735 145128 68642 17846 339574 12817 467593 271623 16390 441662 226698 1...

result:

ok all is ok (1 test case)

Test #83:

score: 7
Accepted
time: 344ms
memory: 66300kb

input:

1
500001 500000
146950 440941 1 19125
24890 440941 120891 135140
24890 488472 433959 465370
383624 488472 477673 493484
192216 383624 213095 224631
97227 192216 160095 197328
97227 137207 426447 445459
84671 137207 60484 63159
84671 349161 265981 292949
349161 420309 309196 323908
401480 420309 1 27...

output:

YES
8699 122659 452924 481129 213095 184821 432947 60484 280439 311420 15513 294571 384127 60007 304754 364827 402905 35343 422930 12139 36401 116809 240986 220803 62011 352460 15931 466747 435447 196762 316834 243558 104826 53473 177440 145887 436857 217848 301827 41205 12261 454445 450993 94630 33...

result:

ok all is ok (1 test case)

Test #84:

score: 7
Accepted
time: 365ms
memory: 66136kb

input:

1
500001 500000
21540 444803 185057 202403
21540 424261 409107 439951
135576 424261 460604 500000
94285 135576 285462 300795
94285 393074 101141 118259
18973 393074 54562 61877
18973 258344 27641 32764
92283 258344 18933 35361
92283 146811 276185 295668
18912 146811 289783 298378
18912 180250 299070...

output:

YES
188875 426296 499491 287233 104522 54563 27641 21615 282095 289783 309668 412347 422228 148104 185806 375893 128656 120600 87657 86794 255398 486450 336531 442545 436116 286399 126705 399537 383370 398612 430189 187939 474966 370386 254266 202073 239953 258327 455485 89950 401780 433534 382099 2...

result:

ok all is ok (1 test case)

Test #85:

score: 7
Accepted
time: 347ms
memory: 66140kb

input:

1
500001 500000
20912 293408 166781 257842
56297 293408 46037 65241
33731 56297 21029 126811
362 33731 269535 316898
362 486565 306044 414383
307381 486565 1 11378
307381 471626 105176 173122
41868 471626 248946 333524
10945 41868 378431 406060
10945 269984 345834 464791
269984 337094 305713 385610
...

output:

YES
204430 46037 74417 269535 360786 1287 119665 280028 378431 411220 331775 470037 412633 338200 389982 194172 449155 239705 486843 80913 422014 121331 153252 55749 217637 494744 18420 66329 149748 247733 436635 295155 305312 278146 22625 267077 343280 143865 390852 305949 68183 388050 136270 31962...

result:

ok all is ok (1 test case)

Test #86:

score: 7
Accepted
time: 349ms
memory: 66324kb

input:

1
500001 500000
244291 496843 343588 500000
47608 244291 381805 448396
47608 95618 362896 421036
95618 390077 293345 312639
58548 390077 98025 104146
2760 58548 144695 393561
2760 395557 261040 500000
263743 395557 299971 337535
110181 263743 422021 500000
110181 496019 408371 500000
284051 496019 1...

output:

YES
469369 381805 362897 293345 98025 309504 496094 299971 422021 423825 141063 8397 371794 481158 352096 274267 479002 188895 228924 195394 362313 67109 33422 144095 124308 374 51646 217524 13582 134349 13652 326298 242322 72405 129506 142400 344673 3155 236055 41371 247896 428531 320899 34348 4416...

result:

ok all is ok (1 test case)

Test #87:

score: 7
Accepted
time: 318ms
memory: 66356kb

input:

1
500001 500000
81197 236616 280680 303606
8014 236616 464661 488221
8014 40028 355067 393281
40028 379891 109030 141075
279068 379891 372225 418240
193286 279068 387153 422464
193286 453196 105903 125214
327927 453196 208036 217413
327927 348454 417993 435276
348454 439755 224417 236368
242177 4397...

output:

YES
289543 474135 379299 127074 404248 408410 111380 208036 421203 224417 488635 24775 115704 24117 27207 451548 117217 444519 312873 255423 265196 491724 210781 249120 312044 235225 226096 188431 479397 493640 432414 200177 281756 409851 68127 429720 173162 301659 395977 131497 457831 205465 461367...

result:

ok all is ok (1 test case)

Test #88:

score: 7
Accepted
time: 349ms
memory: 66168kb

input:

1
500001 500000
221621 403521 1 88398
46566 403521 219309 323306
46566 294467 321221 332295
168132 294467 331151 441918
168132 373121 412416 500000
234812 373121 111991 217863
29516 234812 156951 162055
23295 29516 321901 367007
23295 286148 107733 111081
89210 286148 299203 393354
89210 404370 4465...

output:

YES
53920 288478 321221 407172 496012 182895 156951 332197 107733 358651 457589 138672 99360 445701 384050 465003 4076 128053 371826 225387 24844 41245 154765 344020 249132 12647 447036 430978 68408 344912 86971 145338 205684 262145 140842 6275 401585 184498 384922 406428 498826 151331 12988 133542 ...

result:

ok all is ok (1 test case)

Test #89:

score: 7
Accepted
time: 324ms
memory: 66060kb

input:

1
500001 500000
123315 445247 1 500000
57060 123315 1 500000
57060 239270 1 348025
153497 239270 1 500000
153497 213034 1 322451
48215 213034 2436 203971
48215 286985 145548 500000
152586 286985 1 432138
152586 325206 1 370283
269227 325206 1 500000
269227 321453 1 500000
237514 321453 1 500000
1289...

output:

YES
403615 354011 38366 354010 33503 15068 145548 56148 42723 354008 354007 354006 354005 354387 354004 48495 354003 86197 16823 354000 353999 60450 353998 353982 353996 353995 353994 353993 353992 183381 353991 22217 353990 353988 353987 353986 353985 353984 353997 354038 90878 354037 354036 354035...

result:

ok all is ok (1 test case)

Test #90:

score: 7
Accepted
time: 305ms
memory: 66124kb

input:

1
500001 500000
1 2 466694 466695
2 3 1637 1808
3 4 184615 184644
4 5 78967 79047
5 6 34877 35065
6 7 392451 392505
7 8 274081 274222
8 9 119059 119119
9 10 263211 263388
10 11 60265 60398
11 12 393482 393583
12 13 468331 468503
13 14 437516 437674
14 15 159516 159543
15 16 93772 93785
16 17 20360 2...

output:

YES
466694 1751 184615 78990 35007 392455 274160 119059 263331 60344 393525 468440 437620 159516 93772 20416 393707 43221 79391 21582 77598 65590 149341 162672 418079 331100 292339 69657 206506 468446 499279 195261 144799 23246 46214 67122 58118 188154 181430 258539 194940 360324 146990 284022 36608...

result:

ok all is ok (1 test case)

Test #91:

score: 7
Accepted
time: 53ms
memory: 18224kb

input:

1
100001 100000
1 2 70403 73927
2 3 52279 57814
3 4 83648 90033
4 5 22568 25872
5 6 35193 36728
6 7 1588 3784
7 8 1709 2933
8 9 68744 71771
9 10 48370 54763
10 11 65340 71193
11 12 35846 41455
12 13 68343 73641
13 14 40388 45955
14 15 61700 63835
15 16 6195 12572
16 17 34087 34252
17 18 2974 7257
18...

output:

YES
71884 55771 88032 23840 35193 1937 1709 69772 52751 69171 39542 71612 43931 61823 10651 34087 5264 48286 33334 28972 50216 15583 22500 70472 8943 39757 35234 32638 91556 77120 88420 35779 47958 95116 39296 52631 42154 11106 18078 74850 87332 38562 54326 85959 48935 93795 88985 65479 20177 69691 ...

result:

ok all is ok (1 test case)

Test #92:

score: 7
Accepted
time: 345ms
memory: 66136kb

input:

1
500001 500000
86404 353992 378207 390984
86404 486369 291277 307603
184694 486369 400607 426153
184694 214923 34927 54161
214923 486280 248634 255088
288242 486280 175738 202130
288242 384442 377461 395784
384442 406025 487830 489314
59332 406025 249162 275330
59332 72339 360942 383395
72339 41045...

output:

YES
383132 299648 418277 46253 248635 194134 388020 487830 267450 375480 181366 19597 350410 206777 276652 177404 235752 9969 289849 281320 98789 242959 361496 10739 356638 441670 197189 206889 369534 132324 263530 451006 67423 276499 154714 493741 463541 406280 241330 168274 494830 264720 110370 98...

result:

ok all is ok (1 test case)

Subtask #6:

score: 20
Accepted

Test #93:

score: 20
Accepted
time: 154ms
memory: 6244kb

input:

1000
500 500
100 331 2 8
162 182 272 276
133 415 393 397
144 176 499 500
64 273 47 55
37 463 424 428
96 481 127 127
115 341 333 336
79 95 246 248
266 473 473 476
117 140 113 120
112 309 323 330
251 438 39 45
22 339 275 285
83 474 264 266
185 212 282 291
377 425 25 31
42 436 351 357
35 69 173 182
159...

output:

YES
6 272 394 499 51 424 127 333 246 474 116 327 40 279 266 283 28 357 177 485 151 12 16 350 359 267 18 81 343 375 200 480 461 408 221 86 482 112 277 192 153 497 129 224 159 268 356 372 315 393 34 103 444 396 284 95 208 342 189 243 387 199 303 362 214 94 371 21 304 114 373 346 165 399 88 316 43 369 ...

result:

ok all is ok (1000 test cases)

Test #94:

score: 20
Accepted
time: 155ms
memory: 6288kb

input:

1000
500 500
263 445 23 34
78 313 146 154
230 479 442 449
30 422 402 413
203 491 298 313
211 353 266 276
336 449 412 428
39 200 291 315
333 344 15 30
77 227 472 475
166 435 90 115
338 471 223 236
237 287 203 213
226 457 17 32
7 179 441 454
130 447 344 359
5 302 376 383
75 329 423 424
76 386 172 190
...

output:

YES
29 146 442 407 309 267 419 311 25 472 105 223 204 28 441 351 376 423 181 487 164 185 375 302 239 111 345 70 432 322 372 149 143 184 316 464 395 415 341 236 335 209 461 268 80 373 3 82 431 466 142 495 289 290 251 9 292 85 416 333 16 328 300 94 77 119 394 458 213 398 40 320 340 387 113 253 457 444...

result:

ok all is ok (1000 test cases)

Test #95:

score: 20
Accepted
time: 190ms
memory: 8916kb

input:

100
5000 5000
1050 3257 3679 3683
1611 2666 4834 4845
452 3180 4411 4415
1500 4067 2424 2437
989 3394 3014 3023
3098 4437 4722 4727
1309 3218 1175 1177
4456 4719 3394 3404
3064 4235 533 549
2422 3362 1097 1104
3526 4419 4206 4219
1349 3646 4192 4200
889 3142 3836 3852
1429 2797 180 194
941 971 2333 ...

output:

YES
3679 4840 4411 2425 3021 4724 1175 3394 545 1102 4215 4196 3844 187 2341 3681 11 3939 4881 731 1638 4778 1180 4621 4902 4339 471 3648 2920 2227 3584 2029 2816 1005 1766 449 2921 1977 1046 3898 1378 2209 1274 650 1230 1989 3837 3936 255 3472 2070 3572 1573 141 4731 1795 1419 2382 4288 909 1505 20...

result:

ok all is ok (100 test cases)

Test #96:

score: 20
Accepted
time: 189ms
memory: 8980kb

input:

100
5000 5000
896 1568 2762 2764
896 3943 4810 4813
896 4703 1309 1311
698 896 3724 3727
896 4466 145 146
896 1510 3366 3367
896 3907 787 791
412 896 1161 1163
896 1144 2699 2702
896 4397 2012 2014
896 1197 486 487
896 1959 3032 3040
896 3782 4002 4010
896 4120 2053 2061
896 2848 1007 1016
29 896 29...

output:

YES
2762 4811 1310 3726 146 3366 788 1161 2701 2012 486 3036 4009 2058 1010 2919 695 512 2323 47 4535 1723 2994 4505 1153 4795 1203 3628 595 2286 238 3357 997 412 1970 1244 4320 1535 147 1317 167 1581 1743 2039 543 3811 1850 840 3110 1255 2270 4635 3835 4592 4782 4641 3535 265 1542 2805 2905 4904 25...

result:

ok all is ok (100 test cases)

Test #97:

score: 20
Accepted
time: 210ms
memory: 12848kb

input:

10
50000 50000
16923 41334 36220 36274
3707 16923 25007 25485
16923 43183 18327 19460
3707 36130 39723 39849
3236 43183 43590 44645
33673 36130 25151 25263
40317 43183 17958 18364
9548 40317 5313 5322
29972 33673 38913 40387
16923 46964 13196 14120
16660 43183 40309 40886
3690 3707 18129 19025
40317...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok all is ok (10 test cases)

Test #98:

score: 20
Accepted
time: 206ms
memory: 12780kb

input:

10
50000 50000
19424 19639 22452 23092
17278 19424 13463 13527
19639 38736 24509 24517
35080 38736 37348 37649
17278 40728 2919 3352
17278 35971 19193 19722
36585 40728 8570 9388
17278 38949 40307 40923
10426 40728 24206 24940
19639 26173 5971 6142
15699 19639 38641 38923
40728 43932 48259 48361
104...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok all is ok (10 test cases)

Test #99:

score: 20
Accepted
time: 222ms
memory: 12860kb

input:

10
50000 50000
1192 40512 19190 19355
1192 16647 1596 2390
40512 48981 30014 31493
1192 9477 8494 9679
9477 22370 44252 44582
1192 49956 12853 14527
9477 19578 690 971
22370 28423 49462 49885
9477 11391 7432 8311
11129 28423 47638 48233
11129 36670 35712 36687
11391 43704 27626 27746
9210 16647 4193...

output:

NO
NO
YES
10919 4286 22556 18192 12664 45720 37073 15894 23836 16863 12179 49629 3210 19964 42189 30492 4530 28004 34461 38913 15570 22859 9379 33781 1410 22250 40436 17383 11607 4830 43921 27454 44301 2282 12161 1606 2751 13376 41181 48811 14989 33619 8631 15318 48582 24709 26478 45345 39472 1246 3...

result:

ok all is ok (10 test cases)

Test #100:

score: 20
Accepted
time: 261ms
memory: 12708kb

input:

10
50000 50000
8304 12932 23665 23670
31403 41968 33812 33813
887 47837 30167 30169
4286 33182 16863 16864
15786 46808 1393 1398
25570 41476 25789 25793
19043 25829 6368 6373
7945 23399 36512 36516
23197 41637 7759 7764
5884 20309 42710 42712
29776 33891 8302 8303
303 13274 23488 23488
11277 42596 2...

output:

YES
23666 33812 30169 16863 1396 25790 6372 36514 7760 42711 8302 23488 23450 15391 7985 5569 32205 39712 44705 22122 31531 39199 36174 28644 49333 18168 21380 25399 15387 23008 9200 33699 15470 16102 8140 29491 35104 37063 19440 46764 9962 22767 47858 1385 45028 32840 49399 36840 33726 1559 19859 5...

result:

ok all is ok (10 test cases)

Test #101:

score: 20
Accepted
time: 251ms
memory: 15512kb

input:

10
50000 50000
41913 47632 6512 6531
42921 47632 29876 29880
8920 42921 6329 6347
8920 39871 34643 34650
3075 39871 13399 13410
3075 6883 4479 4519
6883 30250 17021 17029
30250 39228 31042 31060
25475 39228 26931 26965
2053 25475 27846 27888
2053 48494 16104 16127
18975 48494 38780 38788
10606 18975...

output:

YES
6520 29876 6335 34643 13400 4503 17022 31042 26943 27874 16114 38780 46693 6232 47659 39203 9643 31594 20261 1664 24298 2183 33459 5508 33752 30094 35436 1761 46636 39962 17184 47456 37670 14814 18119 23661 14429 10821 37973 9676 3173 32746 7819 45168 42233 35999 16648 42648 23098 7417 12097 117...

result:

ok all is ok (10 test cases)

Test #102:

score: 20
Accepted
time: 235ms
memory: 16736kb

input:

10
50000 50000
10553 28226 10181 10228
28220 28226 32714 32718
28226 33586 32521 32567
9269 28226 24833 24857
28226 36323 982 1018
28226 40190 9044 9090
28226 35742 31493 31529
16603 28226 28112 28118
28226 39725 40404 40445
28226 49320 39524 39541
28226 46425 12829 12875
5045 28226 9623 9661
28226 ...

output:

YES
10214 32714 32550 24843 1003 9076 31520 28112 40431 39530 12866 9643 35501 31645 17123 31247 19322 15982 42328 4449 13842 17004 11881 39195 15940 9285 2807 41320 28451 9709 43143 21566 45475 11976 16246 19822 32553 25526 1649 27661 20447 5902 29152 45763 47968 36316 13042 13348 39670 39540 27 45...

result:

ok all is ok (10 test cases)

Test #103:

score: 20
Accepted
time: 312ms
memory: 69580kb

input:

1
500000 500000
27666 296099 287454 287528
296099 415922 259068 259374
296099 301662 57883 58173
28795 296099 309225 309359
296099 355135 22964 23140
191694 296099 414455 414547
160041 296099 234036 234134
296099 353155 398700 398868
296099 298124 442893 443032
240081 296099 171054 171138
296099 358...

output:

YES
287455 259281 58078 309264 23049 414463 234036 398778 442928 171055 365327 311066 188970 488697 486462 400081 362957 71239 130249 17821 429928 340627 359318 351227 153741 1459 384749 228822 192485 23256 329131 277406 348018 474016 474277 492009 96160 361873 264949 283780 387947 260976 267887 231...

result:

ok all is ok (1 test case)

Test #104:

score: 20
Accepted
time: 222ms
memory: 14288kb

input:

10
50000 50000
2715 37650 11708 11709
2715 7532 46196 46197
4084 37650 16713 16714
30801 37650 1701 1701
7532 31471 26778 26778
7532 34624 16332 16333
4084 43204 26048 26049
4084 32302 32591 32591
30801 36788 22361 22362
4089 30801 45840 45841
31471 43181 9452 9452
15650 31471 579 579
14765 34624 35...

output:

YES
11709 46196 16713 1701 26778 16333 26049 32591 22362 45840 9452 579 3550 10696 29167 25804 15820 15196 24279 7215 25924 36931 43147 4990 23823 20887 1095 41396 4017 24589 8829 43375 47414 48351 446 35535 47421 23561 11919 41243 5689 28158 37269 9099 6226 18014 5364 46581 6565 32141 43683 30843 3...

result:

ok all is ok (10 test cases)

Test #105:

score: 20
Accepted
time: 345ms
memory: 69916kb

input:

1
500000 500000
350978 384616 431612 431835
183860 384616 144521 144592
189058 350978 112130 112217
350978 421982 421775 421905
166742 183860 325651 325730
62982 183860 114103 114341
186049 189058 291937 291966
189058 418793 430553 430555
279130 421982 65908 65962
421982 464192 301183 301325
166742 ...

output:

YES
431743 144521 112131 421806 325651 114230 291937 430553 65908 301219 488297 187132 347259 3004 274919 305050 188408 451992 388542 167227 266681 172844 29182 76302 359991 199040 3149 61194 385675 443319 39994 424388 257013 74819 45130 366306 279531 52200 291544 323046 495135 221397 150572 114554 ...

result:

ok all is ok (1 test case)

Test #106:

score: 20
Accepted
time: 356ms
memory: 105460kb

input:

1
500000 500000
215604 482720 9336 9336
187347 482720 339886 339888
127935 187347 56645 56645
95810 127935 167534 167536
95810 106925 464539 464540
106925 478623 69726 69727
381224 478623 124767 124773
345415 381224 312846 312846
345415 358809 353961 353961
212260 358809 334239 334240
212260 448751 ...

output:

YES
9336 339886 56645 167534 464539 69726 124772 312846 353961 334239 291070 498775 416183 450083 449445 334967 394624 239688 494138 300572 228466 294881 439585 233830 57832 161980 390982 118668 333697 319695 472166 311997 72746 80566 461295 362602 202296 186250 41816 144861 236031 70844 199238 3055...

result:

ok all is ok (1 test case)

Test #107:

score: 20
Accepted
time: 354ms
memory: 102936kb

input:

1
500000 500000
215308 293000 367250 368060
35529 215308 284644 285572
35529 210118 63073 63315
210118 306690 131612 131786
306690 381648 235581 235735
126047 381648 298060 298580
126047 364413 269204 270075
204485 364413 376275 377262
178874 204485 474702 475038
82671 178874 77500 78183
82671 35422...

output:

YES
367787 285302 63073 131615 235581 298315 269777 376974 474750 77913 195863 140328 12955 95407 11299 31205 345818 269615 485256 205267 440081 369989 494862 483179 267434 381857 303204 141647 185531 383783 376565 368230 239946 367950 487827 271062 121692 305657 282892 166614 160516 285502 55433 28...

result:

ok all is ok (1 test case)

Test #108:

score: 20
Accepted
time: 415ms
memory: 94852kb

input:

1
500000 500000
172091 389900 27256 28457
172091 414155 373461 374077
404244 414155 452626 453468
187718 404244 19899 20264
16984 187718 352185 354628
16984 295130 427098 429377
108258 295130 163767 164461
108258 398510 228318 228525
398510 403200 77965 78842
195873 403200 462094 462963
195873 45981...

output:

YES
27724 373461 452747 19899 353900 428653 163767 228319 78096 462186 346685 162297 46299 418161 64334 313793 15599 273722 68120 182486 274573 247605 446826 275988 69003 408852 91159 494103 317251 342296 207359 338991 491202 455991 375463 327913 498741 421361 482293 442436 431862 437351 486654 3761...

result:

ok all is ok (1 test case)

Test #109:

score: 20
Accepted
time: 341ms
memory: 98824kb

input:

1
500000 500000
259214 291911 390684 390743
259214 322337 211259 211382
322337 461511 401096 401230
461511 464732 219531 219776
219473 464732 6740 6899
213993 219473 13536 13682
159931 213993 333656 333753
159931 482231 111461 111488
266344 482231 306012 306300
236983 266344 307800 307838
236983 317...

output:

YES
390684 211300 401143 219686 6818 13610 333656 111462 306223 307800 344675 497498 318796 67359 435671 151707 353835 70289 70264 200874 333557 14913 290902 379182 241984 427471 442316 451877 365167 435173 46243 91205 369046 464059 234784 271949 258404 4684 230367 248564 255985 492767 423448 298366...

result:

ok all is ok (1 test case)

Test #110:

score: 20
Accepted
time: 369ms
memory: 111220kb

input:

1
500000 500000
330795 392574 203480 203694
392574 423123 383760 383767
28684 423123 60917 61538
28684 273674 335604 336392
273674 275630 3002 3378
96288 275630 95317 96382
96288 203576 297246 297270
61790 203576 306939 307694
61790 325062 471295 471508
292782 325062 344917 345630
157134 292782 4150...

output:

YES
203480 383760 61227 336100 3060 96068 297246 307382 471295 345316 415543 108607 3073 154186 116103 45715 276049 417073 462318 441498 448480 236319 244141 314497 57996 125816 470306 56640 368678 453897 141560 461413 119990 211213 82760 38559 283843 349430 137694 382197 417038 94911 434808 308898 ...

result:

ok all is ok (1 test case)

Test #111:

score: 20
Accepted
time: 384ms
memory: 105160kb

input:

1
500000 500000
39491 299185 30782 30812
39491 259353 352840 352861
259353 309986 67425 67473
83919 309986 146968 146975
83919 451788 208822 208827
290913 451788 415298 415370
211766 290913 490586 490586
211766 480666 87152 87224
399866 480666 396990 397040
114518 399866 416966 416991
114518 300894 ...

output:

YES
30790 352842 67447 146968 208822 415349 490586 87205 397020 416971 465026 111519 153696 399543 197545 483128 150215 396057 84350 8879 244841 388301 482549 389486 371363 216775 219928 309490 100623 138195 386754 342763 65577 396136 376389 306399 13543 457574 426645 380863 355678 37810 494150 9730...

result:

ok all is ok (1 test case)

Test #112:

score: 20
Accepted
time: 376ms
memory: 98944kb

input:

1
500000 500000
46754 452678 187210 198104
46754 52740 267995 281250
52740 203135 456552 466128
203135 325773 300828 306314
260560 325773 182631 196201
187766 260560 36270 45197
187766 431045 354969 356331
195199 431045 178056 187365
195199 300882 215021 226238
280096 300882 318941 337636
214694 280...

output:

YES
192051 275045 459897 300828 190124 38888 354969 181156 220100 331435 87134 330131 179120 282416 93423 387542 120335 259160 128118 109221 244290 157559 10356 185748 277953 239662 224128 307920 34265 204455 178106 267300 183028 317899 471271 202513 486799 184763 7505 424467 209177 39188 62511 3241...

result:

ok all is ok (1 test case)

Test #113:

score: 20
Accepted
time: 368ms
memory: 106460kb

input:

1
500000 500000
53242 159837 143382 165897
159837 178075 463092 467188
178075 376948 109964 120038
317015 376948 46105 50064
218707 317015 365093 385513
218707 401056 109454 110280
67695 401056 177350 188475
67695 238732 477719 479372
200407 238732 2173 10807
98168 200407 399100 404322
76728 98168 3...

output:

YES
158966 463092 113159 46105 378620 109454 181692 477719 4901 399100 346565 205490 222795 51103 337059 235985 132536 397228 351162 368 188731 95760 76143 328736 94208 290686 85668 368738 432829 329299 377353 409200 394862 426253 263339 197526 381077 425879 106824 248156 52156 24128 272188 165889 3...

result:

ok all is ok (1 test case)

Test #114:

score: 20
Accepted
time: 392ms
memory: 93600kb

input:

1
500000 500000
30447 392104 328309 341822
324482 392104 288339 415393
324482 489567 148351 175123
209566 489567 390045 500000
209566 454111 263808 265043
174167 454111 1 70691
174167 482851 19761 127055
256337 482851 62004 184861
241343 256337 226890 306358
133127 241343 124234 242562
133127 448511...

output:

YES
328309 377963 148352 499279 263808 36184 89939 147667 269026 205321 495069 275503 423666 369132 92609 437824 330654 102374 277235 307414 75926 398396 17002 236940 350163 300940 377984 29688 343863 306103 477874 154254 167015 75550 87878 482529 232999 210471 300316 319466 233673 303810 107716 987...

result:

ok all is ok (1 test case)

Test #115:

score: 20
Accepted
time: 398ms
memory: 105296kb

input:

1
500000 500000
67846 259403 74455 144057
67846 158710 36496 48157
158710 312920 90296 135809
312920 456455 129093 170164
274089 456455 252193 318771
274089 477473 319023 372332
73790 477473 324544 380438
73790 249305 188384 234755
5339 249305 452449 500000
5339 131597 373648 500000
131597 389121 31...

output:

YES
96139 36496 90297 129093 271223 324469 332442 188384 479913 497813 344822 138858 291543 155300 136708 412153 331282 69730 406495 365715 228742 4337 312207 333383 480336 161798 406654 426685 294617 115989 16790 58726 141925 97325 188 424228 143296 480806 149039 191236 482318 476161 317057 343943 ...

result:

ok all is ok (1 test case)

Test #116:

score: 20
Accepted
time: 384ms
memory: 110480kb

input:

1
500000 500000
173238 218038 1 204189
138674 173238 461175 500000
138674 140818 182274 188110
140818 251738 274707 450965
145722 251738 252282 500000
145722 219492 4555 18640
196427 219492 249106 315295
104805 196427 1 286655
93782 104805 288839 474951
93782 123242 401034 500000
123242 405402 63940...

output:

YES
100773 461175 182274 336385 484511 4555 249107 173699 360450 436488 263328 119427 343734 434553 448634 431341 470532 191150 70261 111314 29991 336482 71406 109849 453798 83309 169281 305150 197043 322896 475410 380008 480894 197718 169438 117038 9461 111542 243577 262536 67875 299272 311886 1416...

result:

ok all is ok (1 test case)

Test #117:

score: 20
Accepted
time: 402ms
memory: 95912kb

input:

1
500000 500000
262797 287497 266004 500000
74071 287497 111845 189535
72024 74071 56694 334218
72024 407057 304263 500000
368670 407057 15423 143366
292638 368670 238985 441703
289963 292638 297047 438044
289963 301094 15853 206514
301094 336492 312942 401505
182881 336492 14591 319500
182881 48961...

output:

YES
494129 111846 238508 488535 63133 345806 342137 115065 312942 223891 471462 453716 381166 323727 480678 347619 60248 110933 428710 278229 134745 465656 209275 117998 174679 457438 475431 16869 275116 292104 498558 215397 358911 479981 498829 205491 487612 269372 233316 239061 132009 345429 43959...

result:

ok all is ok (1 test case)

Test #118:

score: 20
Accepted
time: 327ms
memory: 108132kb

input:

1
500000 500000
2924 134417 1 500000
134417 432445 1 500000
432445 464203 1 500000
383628 464203 1 500000
383628 398462 1 500000
398462 444300 1 500000
159908 444300 1 500000
159908 384395 1 500000
296118 384395 1 373314
193297 296118 1 500000
156479 193297 1 500000
156479 459696 19285 500000
253458...

output:

YES
388353 411006 411019 411027 410972 410986 411001 411085 32490 411095 411102 371341 4099 411045 411050 411057 410873 410875 410886 410840 410846 410849 38566 410853 410838 410856 410858 34863 410864 410944 410945 410946 410948 410957 410920 410907 54597 410922 410924 410931 410934 411090 411273 4...

result:

ok all is ok (1 test case)

Subtask #7:

score: 11
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #119:

score: 11
Accepted
time: 3ms
memory: 5704kb

input:

100
26 50
9 15 7 10
10 26 11 14
18 26 9 13
4 19 8 9
11 20 17 21
12 15 27 27
14 20 22 27
19 24 9 11
7 10 1 3
1 6 9 14
19 20 3 4
15 26 4 5
16 23 19 24
1 19 17 17
2 19 35 39
21 23 39 39
6 26 6 6
7 25 11 11
5 24 4 6
9 16 11 15
8 19 31 33
3 5 21 22
13 23 35 37
6 22 41 43
5 17 1 3
13 26 38 38
4 5 16 18
18...

output:

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

result:

ok all is ok (100 test cases)

Test #120:

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

input:

100
26 50
11 18 17 18
16 20 13 14
7 9 23 23
21 22 3 4
4 20 7 8
11 23 19 19
1 20 24 25
12 15 15 15
7 21 9 9
15 24 1 2
17 18 11 11
8 22 22 22
5 18 7 7
5 26 20 21
3 12 5 6
13 23 33 33
1 18 32 33
14 25 10 10
12 19 29 29
10 21 1 2
5 21 6 6
14 22 30 30
2 5 16 16
3 6 12 12
2 3 4 4
2 20 46 47
3 6 49 49
11 2...

output:

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

result:

ok all is ok (100 test cases)

Test #121:

score: 11
Accepted
time: 6ms
memory: 5700kb

input:

10
251 500
28 246 256 275
16 246 304 304
71 246 163 169
34 246 389 407
115 246 298 299
73 246 259 279
225 246 33 35
56 246 442 448
76 246 10 10
30 246 151 166
18 246 55 55
55 246 185 195
15 246 211 212
239 246 360 366
177 246 201 215
4 246 368 385
104 246 158 161
9 246 90 102
93 246 285 288
2 246 16...

output:

YES
269 304 166 393 298 262 33 442 10 161 55 185 211 360 207 375 158 96 286 170 64 491 37 339 163 101 446 274 253 2 67 199 280 441 450 82 361 79 235 498 215 28 435 5 128 89 373 69 354 436 347 238 102 487 29 175 63 172 252 328 460 222 136 478 105 315 141 113 75 260 499 459 480 311 225 7 27 44 110 355...

result:

ok all is ok (10 test cases)

Test #122:

score: 11
Accepted
time: 3ms
memory: 5704kb

input:

10
251 500
31 58 98 116
31 148 319 325
31 37 71 80
31 169 486 500
31 221 385 390
13 31 389 390
31 247 332 339
31 239 61 65
31 64 144 151
31 88 238 248
31 202 381 389
31 68 461 481
31 108 194 213
31 179 465 484
31 53 340 356
31 131 444 449
22 31 313 322
26 31 1 4
25 31 278 279
31 113 407 408
31 233 4...

output:

YES
98 319 76 499 386 389 336 61 145 238 381 477 210 480 352 445 316 2 278 407 493 432 494 324 101 21 375 28 410 84 370 25 56 363 113 34 95 248 462 276 384 213 218 174 128 307 288 257 467 170 184 157 142 89 182 473 33 283 498 343 365 187 198 6 43 285 226 244 378 488 385 485 470 205 85 249 275 224 35...

result:

ok all is ok (10 test cases)

Test #123:

score: 11
Accepted
time: 38ms
memory: 6072kb

input:

1
2501 5000
2212 2301 1 5000
173 2301 1 4955
781 2301 800 5000
781 1932 2455 4096
1500 1932 1 5000
173 182 896 2532
182 1962 208 5000
867 2212 61 5000
264 1962 1 536
264 1591 1 5000
173 219 1 5000
1500 2435 1 2260
814 1962 1 5000
867 1568 2830 5000
173 950 1 5000
620 950 697 3292
264 613 3459 3551
7...

output:

NO

result:

ok all is ok (1 test case)

Test #124:

score: 11
Accepted
time: 40ms
memory: 6300kb

input:

1
3501 5000
2323 3344 1 759
1433 2323 461 5000
141 3344 724 4315
1556 2323 1 1735
1085 2323 1 3173
2112 2323 817 4396
1085 1332 4625 5000
1433 2526 735 5000
602 1085 1 2174
1541 3344 2108 5000
1332 2325 385 5000
110 3344 2947 4502
1213 1433 3823 4903
846 3344 1 2161
602 1237 1031 5000
1855 2112 4521...

output:

NO

result:

ok all is ok (1 test case)

Test #125:

score: 11
Accepted
time: 6ms
memory: 5980kb

input:

10
251 500
63 213 223 224
91 96 216 216
52 88 47 52
75 125 290 297
199 244 122 123
35 49 107 110
7 34 125 131
35 80 134 134
183 244 11 16
93 173 490 497
45 114 75 75
80 237 168 174
102 191 10 16
148 192 55 60
117 191 225 228
13 140 121 122
13 146 51 56
85 221 296 300
121 251 218 218
16 97 146 149
13...

output:

YES
223 216 48 294 123 107 125 134 12 492 75 171 14 56 225 121 54 300 218 147 277 40 36 76 249 64 109 226 61 16 65 368 43 94 35 99 20 153 2 6 333 42 66 49 28 267 192 78 50 34 184 283 213 53 73 261 175 13 88 21 144 86 32 120 18 58 95 293 69 127 55 349 15 51 133 224 101 151 195 103 74 90 118 468 22 3 ...

result:

ok all is ok (10 test cases)

Test #126:

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

input:

10
251 500
84 174 362 370
84 99 364 366
44 99 303 307
8 44 247 253
8 249 159 169
162 249 247 256
162 231 14 19
171 231 254 254
144 171 95 97
144 223 124 127
222 223 2 11
209 222 227 237
209 211 69 70
187 211 132 144
32 187 209 219
32 206 102 113
133 206 169 169
73 133 215 227
73 83 95 102
83 177 163...

output:

YES
366 364 303 251 165 255 14 254 95 124 6 235 69 141 215 110 169 225 98 168 240 201 127 142 179 22 128 208 51 99 116 220 38 212 229 149 39 59 218 102 151 35 1 111 133 52 16 181 222 154 146 109 177 129 36 186 90 101 148 200 44 103 156 88 85 191 144 173 97 125 232 198 106 135 20 122 82 204 178 139 6...

result:

ok all is ok (10 test cases)

Test #127:

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

input:

10
251 500
92 228 179 181
92 163 197 202
82 92 67 71
92 186 279 285
92 184 297 300
1 92 58 61
92 143 99 106
92 211 101 101
92 145 227 227
92 206 495 500
92 146 208 208
92 157 218 221
66 92 54 58
92 141 4 8
76 92 376 382
75 92 237 243
4 92 196 202
92 197 157 158
92 242 291 295
92 227 451 453
79 92 24...

output:

YES
180 199 67 283 297 58 104 101 227 497 208 218 54 8 381 237 200 157 293 451 249 84 205 16 85 304 319 189 138 50 102 422 95 136 256 69 352 404 37 382 274 131 148 23 207 93 371 420 219 47 435 66 289 65 377 285 173 126 331 18 19 431 10 105 429 120 318 52 59 3 241 123 465 438 82 397 305 436 472 160 3...

result:

ok all is ok (10 test cases)

Test #128:

score: 11
Accepted
time: 28ms
memory: 6100kb

input:

1
2501 5000
1920 2314 3823 3834
1250 2314 117 130
1387 2314 4074 4090
2314 2353 4741 4751
2278 2314 2244 2259
697 2314 126 142
2105 2314 3413 3440
2310 2314 277 304
1794 2314 292 309
1195 2314 3742 3783
867 2314 2941 2950
1207 2314 1203 1235
491 2314 4421 4427
1991 2314 1556 1573
664 2314 873 888
10...

output:

YES
3824 117 4077 4741 2246 128 3421 286 295 3742 2941 1218 4421 1561 873 1412 4721 4269 2725 2004 328 1831 2126 4100 4188 569 1889 3486 1334 1761 494 96 3777 4857 2267 3122 596 4946 72 3185 123 1344 641 26 4489 1767 3946 4052 1897 3603 2691 2592 3153 4572 3091 422 2155 3984 543 1938 3360 4384 1943 ...

result:

ok all is ok (1 test case)

Test #129:

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

input:

10
251 500
38 225 90 103
99 225 21 36
23 38 80 90
38 91 32 36
19 99 96 105
99 147 73 80
23 195 26 34
23 157 11 17
91 189 96 106
91 95 1 2
19 232 59 64
19 200 64 64
81 147 87 89
4 147 44 59
77 195 21 22
193 195 23 26
44 157 10 12
135 157 19 19
87 189 1 5
79 189 40 40
93 95 2 11
95 235 84 97
116 232 3...

output:

YES
98 30 84 32 101 76 27 14 102 2 61 64 87 55 21 23 10 19 5 40 7 94 45 99 73 79 9 110 58 15 63 103 35 6 92 163 69 235 108 144 47 217 28 82 13 50 42 11 57 68 52 25 86 104 20 172 8 75 70 18 39 31 100 202 205 74 128 136 65 16 180 77 147 204 333 118 276 231 3 177 143 141 43 109 210 301 138 362 97 62 11...

result:

ok all is ok (10 test cases)

Test #130:

score: 11
Accepted
time: 35ms
memory: 6040kb

input:

1
2501 5000
554 764 278 302
554 2366 11 43
764 1536 473 497
764 2439 164 199
616 2366 349 368
363 2366 482 515
1536 2179 405 427
1536 2481 205 211
2208 2439 784 784
1437 2439 498 519
616 1271 824 858
616 2075 543 548
363 881 299 303
363 725 404 416
1531 2179 109 123
2179 2377 428 457
912 2481 5 27
1...

output:

YES
291 35 481 187 354 501 415 205 784 507 851 543 299 405 111 444 9 904 875 789 858 435 837 5 37 636 48 326 336 225 495 392 148 972 901 311 197 322 273 885 547 90 684 74 316 118 209 902 324 973 790 990 889 882 140 627 373 144 258 56 21 795 445 207 745 408 26 907 389 300 380 941 479 260 432 355 161 ...

result:

ok all is ok (1 test case)

Test #131:

score: 11
Accepted
time: 105ms
memory: 6276kb

input:

1
2501 5000
119 611 3092 3112
119 1774 3092 3092
130 1774 3096 3111
130 2213 3087 3099
1020 2213 3092 3096
1020 1346 2849 2866
1346 1946 2853 2864
522 1946 2847 2853
522 2161 2841 2862
2161 2371 2852 2853
126 2371 2853 2873
126 440 2742 2754
208 440 2511 2514
54 208 1231 1248
54 1918 29 48
1860 1918...

output:

YES
3098 3092 3096 3091 3094 2856 2855 2847 2857 2852 2854 2745 2511 1239 46 655 134 2504 2519 1997 2517 1738 2506 1222 2502 2481 2493 2505 2500 2371 2477 2508 2489 2496 2490 2452 562 469 2498 2032 1897 2483 2442 2445 2503 1066 2478 135 876 279 2482 1571 593 2099 2487 2479 2398 1440 2491 277 2494 22...

result:

ok all is ok (1 test case)

Test #132:

score: 11
Accepted
time: 72ms
memory: 6808kb

input:

1
4001 5000
2624 3672 4999 5000
1196 3672 4989 5000
1194 1196 4968 4969
1194 3346 4620 4625
1269 3346 4617 4628
1269 3911 4622 4622
800 3911 4623 4630
800 1964 4235 4246
1964 2296 4233 4244
1393 2296 4239 4246
1393 3589 4189 4195
1302 3589 4192 4201
1302 3560 4186 4188
3537 3560 4049 4052
2946 3537 ...

output:

YES
4999 5000 4968 4621 4624 4622 4625 4243 4240 4242 4191 4197 4187 4049 4051 4046 4050 4003 3986 4024 4022 4021 4017 3999 4010 4002 4023 4011 4005 4012 4014 3997 3996 3995 4025 4015 3991 3987 4000 3989 1970 3952 2358 1520 2095 609 235 2929 420 3748 378 1345 1008 327 1315 885 2630 192 1661 997 1017...

result:

ok all is ok (1 test case)

Test #133:

score: 11
Accepted
time: 106ms
memory: 6408kb

input:

1
3001 5000
539 987 4992 4998
987 2070 4990 4994
750 2070 3932 3933
587 750 3929 3935
587 2851 3102 3105
401 2851 3079 3085
401 596 3070 3072
596 2073 3079 3080
586 2073 3069 3070
586 2197 3063 3064
1469 2197 3082 3084
797 1469 3103 3108
797 1691 3098 3104
611 1691 3101 3107
412 611 3066 3072
412 22...

output:

YES
4998 4992 3932 3933 3102 3083 3071 3079 3069 3063 3082 3103 3100 3104 3072 3068 3066 3067 3055 3062 2984 2976 2985 1396 2649 2682 607 2216 916 2655 2674 2924 1049 1291 146 2373 2462 1315 286 2325 2012 1287 1660 2869 1938 970 1007 806 2733 1711 538 295 1643 824 2063 1887 496 175 733 2007 2111 198...

result:

ok all is ok (1 test case)

Test #134:

score: 11
Accepted
time: 103ms
memory: 6492kb

input:

1
2001 5000
625 1894 2505 2505
1046 1894 2419 2425
1046 1212 2419 2420
1212 1683 2158 2164
1031 1683 2036 2036
139 1031 2036 2038
139 1229 2041 2043
168 1229 2014 2020
168 583 2023 2026
247 583 1988 1994
247 796 2009 2015
143 796 1652 1652
120 143 2019 2021
120 1375 2030 2034
1228 1375 2034 2034
278...

output:

YES
2505 2422 2419 2160 2036 2037 2043 2017 2026 1992 2013 1652 2020 2032 2034 2021 2008 2029 1343 2003 1994 2024 2014 2040 1998 2025 2019 2001 324 761 2038 2010 1677 641 812 1167 963 1773 190 1272 1956 318 225 30 282 1034 707 1618 476 479 397 1160 1557 20 1278 551 928 1854 1115 1824 1775 440 1948 1...

result:

ok all is ok (1 test case)

Test #135:

score: 11
Accepted
time: 63ms
memory: 6040kb

input:

1
1001 5000
467 645 1495 1498
189 645 800 800
189 944 617 619
523 944 980 983
387 523 386 387
387 983 364 365
658 983 733 734
658 939 978 981
573 939 634 636
207 573 187 188
147 207 308 310
147 184 902 905
184 213 776 779
213 386 269 272
386 483 787 787
483 604 803 804
586 604 174 175
98 586 943 945...

output:

YES
1495 800 619 981 386 365 733 980 635 187 308 904 776 271 787 804 174 945 620 52 135 822 879 293 370 359 41 743 687 565 186 729 259 10 566 719 454 284 563 137 120 885 194 374 300 485 511 689 261 891 789 883 410 88 79 144 211 801 69 358 448 614 949 316 459 538 7 331 517 170 430 307 594 934 833 200...

result:

ok all is ok (1 test case)

Test #136:

score: 11
Accepted
time: 109ms
memory: 6504kb

input:

1
2501 5000
1046 2160 4999 5000
867 2160 3311 3329
867 1214 3208 3284
1214 1902 3078 3167
1653 1902 2659 2766
1653 1935 2643 2816
4 1935 2592 2742
4 628 2591 2716
628 2130 2452 2657
2130 2359 2481 2676
1444 2359 2531 2536
274 1444 2397 2561
105 274 2444 2664
105 1607 2520 2638
1607 1826 2457 2667
18...

output:

YES
4999 3311 3231 3078 2693 2713 2663 2646 2539 2537 2531 2513 2540 2530 2538 2529 2511 2534 2433 330 2425 1418 2428 2457 244 902 1779 1671 2443 2424 1472 59 218 1925 446 914 1187 1315 2383 438 971 317 179 2227 1350 2092 2442 1542 228 933 1863 1913 763 1387 54 1539 2163 781 232 799 930 2455 2345 28...

result:

ok all is ok (1 test case)

Test #137:

score: 11
Accepted
time: 94ms
memory: 8476kb

input:

1
3501 5000
1304 3311 4878 4893
1301 3311 4879 4911
953 1301 4884 4934
953 1058 3921 3973
1058 1558 3929 3986
1558 2634 3935 3990
2634 3187 3941 3959
98 3187 3941 3946
98 3477 3591 3646
848 3477 3611 3612
1 848 3614 3616
1 3312 3622 3637
467 3312 3605 3662
239 467 3609 3637
239 2409 3608 3663
2409 2...

output:

YES
4878 4879 4884 3958 3963 3960 3944 3941 3636 3611 3614 3624 3645 3625 3646 3627 3615 3616 3628 3596 3610 3605 3621 3617 3520 3511 3519 3530 3510 3522 3497 3504 3528 3514 3502 3529 3508 3525 3524 3495 3518 3512 3515 3517 3503 3513 3526 3444 3446 3472 3451 3453 3457 3481 3456 3437 3469 3439 3448 3...

result:

ok all is ok (1 test case)

Test #138:

score: 11
Accepted
time: 105ms
memory: 6344kb

input:

1
2501 5000
1955 2193 4263 5000
1374 2193 2941 3434
679 1374 2737 3526
679 1632 2494 3633
1632 1645 2602 2610
1645 2197 1898 2643
1130 2197 2531 2548
1130 2151 2561 2571
440 2151 2050 2885
440 775 2411 2552
775 1831 2450 3290
1524 1831 2277 2805
1523 1524 2362 2567
195 1523 2183 2932
195 1106 2242 3...

output:

YES
4903 3110 2999 3001 2602 2495 2531 2561 2642 2452 2496 2502 2455 2511 2505 2500 1062 668 488 2514 2213 793 2459 2445 2497 1092 558 1989 2447 2498 673 2383 2499 2501 2503 785 2437 2456 217 2090 894 1211 1702 980 2513 820 2064 1466 2504 1999 667 115 1325 609 2043 129 1772 436 466 2044 1410 595 152...

result:

ok all is ok (1 test case)

Test #139:

score: 11
Accepted
time: 90ms
memory: 6364kb

input:

1
3501 5000
2024 2275 4162 4307
681 2275 3743 4378
681 2224 3370 3927
1380 2224 3598 3865
876 1380 3682 4039
876 2288 3240 3899
833 2288 3554 3757
833 2766 3344 3786
1421 2766 3310 3622
1421 2260 3336 3771
1293 2260 3527 3538
1293 1812 3441 3674
1812 3226 3340 3599
2719 3226 3324 3549
2600 2719 3505...

output:

YES
4162 4015 3721 3671 3829 3697 3599 3612 3498 3545 3527 3538 3484 3463 3505 3494 3534 3544 3541 3533 3502 3466 3535 3546 3537 3513 3548 3530 3540 3543 3536 1924 541 2375 2072 2743 2115 3059 2629 1689 330 3507 1773 2521 2070 3473 1966 364 1538 2968 3140 1625 2133 602 800 2376 717 3450 2686 2087 35...

result:

ok all is ok (1 test case)

Test #140:

score: 11
Accepted
time: 109ms
memory: 6332kb

input:

1
2501 5000
2155 2364 2395 2410
2155 2225 1864 1866
2225 2386 2234 2244
1897 2386 2505 2508
1414 1897 2516 2520
1025 1414 1995 2010
1025 2228 1307 1316
1913 2228 2513 2525
1913 2409 2496 2508
2178 2409 474 481
2025 2178 732 733
1887 2025 2492 2492
1090 1887 1762 1765
517 1090 2519 2528
517 2260 2477...

output:

YES
2406 1864 2239 2505 2516 2004 1311 2522 2507 479 732 2492 1763 2525 2487 2508 1235 2495 2499 2220 1008 120 2514 744 44 748 2519 197 1533 1859 1041 2110 787 65 2501 1484 1158 70 2523 323 2521 783 2490 1369 1277 96 1721 1249 2022 544 1412 1198 2480 535 278 1059 2060 2515 459 2046 1456 439 1251 167...

result:

ok all is ok (1 test case)

Test #141:

score: 11
Accepted
time: 89ms
memory: 6424kb

input:

1
3501 5000
1677 2949 4845 5000
2949 3374 3687 4424
1883 3374 4202 4471
1883 3119 3165 4445
3022 3119 3454 5000
945 3022 3383 4159
945 3309 2812 3756
527 3309 2409 4254
527 1159 3487 3627
1159 2506 2335 3645
2395 2506 2570 4225
2275 2395 3403 4591
2275 2330 3414 4237
727 2330 3289 3784
727 1719 3116...

output:

YES
4845 3880 4202 3900 3941 3740 3527 3596 3487 3458 3595 3589 3587 3543 3429 3523 3593 3503 3590 3435 3512 1719 2931 1272 3547 3455 3342 835 2781 3452 3296 2895 3461 3473 3491 3469 3465 3471 3470 3483 3493 3460 3481 3478 888 3489 1923 884 3434 2243 2267 1226 3475 2783 2063 65 984 264 2085 3480 231...

result:

ok all is ok (1 test case)

Test #142:

score: 11
Accepted
time: 109ms
memory: 8580kb

input:

1
2501 5000
230 1156 1 5000
230 1620 955 5000
1302 1620 1 5000
1302 1713 1 5000
104 1713 1 5000
104 1961 1 5000
673 1961 1 5000
391 673 1 5000
391 433 1 5000
433 873 1 5000
873 2374 1 5000
1340 2374 1 2816
1340 2419 1 5000
302 2419 1 5000
302 2379 1 5000
784 2379 1 5000
699 784 1 5000
699 2148 1 500...

output:

YES
2630 1302 2049 2048 2047 2046 2045 2044 2042 2031 2040 2039 2038 2036 2035 2034 2033 2032 2041 1323 2067 2066 2065 2064 2063 2062 2510 2061 2051 2059 2058 2057 2056 2055 2054 2053 2052 2023 2013 1330 148 2012 35 2011 2010 2170 2009 2007 2006 2005 1995 2003 2002 2001 2000 1999 1998 1997 1996 2004...

result:

ok all is ok (1 test case)

Subtask #8:

score: 0
Time Limit Exceeded

Test #143:

score: 8
Accepted
time: 923ms
memory: 5720kb

input:

1000
251 500
1 2 280 287
2 3 251 256
3 4 249 249
4 5 252 253
5 6 252 256
6 7 250 250
7 8 254 261
8 9 245 256
9 10 123 127
10 11 45 49
11 12 122 128
12 13 164 167
13 14 153 156
14 15 210 217
15 16 53 64
16 17 205 208
17 18 136 149
18 19 132 135
19 20 24 27
20 21 45 51
21 22 21 30
22 23 5 7
23 24 178 ...

output:

YES
280 254 249 252 253 250 257 255 123 46 126 164 153 214 58 205 146 132 24 47 27 5 179 87 78 216 187 106 215 23 181 109 21 32 121 8 221 29 127 207 141 37 217 42 11 184 150 66 68 145 168 211 162 144 90 159 138 61 28 173 85 115 134 54 76 165 30 148 101 3 105 75 139 178 188 1 14 74 209 35 192 33 124 ...

result:

ok all is ok (1000 test cases)

Test #144:

score: 8
Accepted
time: 824ms
memory: 5736kb

input:

1000
351 500
1 2 62 69
2 3 225 227
3 4 160 166
4 5 172 177
5 6 118 120
6 7 35 42
7 8 92 100
8 9 82 87
9 10 222 230
10 11 234 239
11 12 141 145
12 13 213 217
13 14 110 116
14 15 154 157
15 16 280 280
16 17 243 250
17 18 124 132
18 19 20 29
19 20 328 329
20 21 41 48
21 22 189 192
22 23 241 249
23 24 4...

output:

YES
64 225 164 174 118 39 95 83 226 234 141 213 115 156 280 248 130 27 328 45 189 247 50 157 74 214 257 284 9 143 235 29 282 150 26 334 216 123 249 87 134 139 313 170 323 220 78 72 110 217 151 270 128 238 30 42 330 294 48 43 187 111 343 254 54 180 66 97 107 348 340 318 19 125 86 312 63 91 162 37 303...

result:

ok all is ok (1000 test cases)

Test #145:

score: 8
Accepted
time: 925ms
memory: 5716kb

input:

1000
251 500
1 2 175 184
2 3 74 76
3 4 134 143
4 5 63 69
5 6 18 19
6 7 258 258
7 8 216 221
8 9 157 163
9 10 224 229
10 11 220 227
11 12 115 115
12 13 187 189
13 14 209 216
14 15 1 4
15 16 10 10
16 17 82 83
17 18 75 84
18 19 146 148
19 20 233 238
20 21 80 87
21 22 134 136
22 23 59 59
23 24 228 238
24...

output:

YES
182 74 139 65 18 258 218 159 226 221 115 187 212 2 10 82 79 146 234 86 136 59 235 112 121 83 216 68 34 95 30 55 215 196 143 217 58 201 106 27 155 56 149 54 41 124 96 85 170 228 51 63 71 78 21 175 154 3 69 174 134 243 157 93 7 162 26 44 99 36 199 148 119 241 220 132 13 163 186 80 120 231 118 229 ...

result:

ok all is ok (1000 test cases)

Test #146:

score: 8
Accepted
time: 783ms
memory: 5672kb

input:

1000
151 500
1 2 198 198
2 3 165 167
3 4 1 10
4 5 121 125
5 6 114 117
6 7 131 136
7 8 134 141
8 9 97 103
9 10 90 94
10 11 133 135
11 12 118 123
12 13 51 60
13 14 139 147
14 15 61 61
15 16 46 49
16 17 33 40
17 18 62 62
18 19 70 76
19 20 65 69
20 21 114 122
21 22 1 1
22 23 71 71
23 24 5 5
24 25 2 5
25...

output:

YES
198 166 9 123 115 135 137 97 91 133 120 57 143 61 46 35 62 70 65 119 1 71 5 4 18 96 6 90 78 19 68 20 108 40 134 76 101 66 69 98 112 100 121 136 142 85 51 80 86 138 103 125 31 32 114 132 44 117 92 77 58 110 144 104 49 2 64 127 50 75 26 41 30 53 8 99 87 131 109 48 74 28 79 88 124 12 116 130 128 11...

result:

ok all is ok (1000 test cases)

Test #147:

score: 0
Time Limit Exceeded

input:

1
250001 500000
1 2 232634 232778
2 3 439147 439210
3 4 242069 242195
4 5 123158 123260
5 6 404204 404219
6 7 148853 149029
7 8 128047 128105
8 9 241218 241219
9 10 396066 396078
10 11 431745 431863
11 12 265898 265945
12 13 358860 358915
13 14 154751 154864
14 15 346376 346465
15 16 251154 251293
1...

output:


result:


Subtask #9:

score: 0
Time Limit Exceeded

Dependency #7:

100%
Accepted

Test #170:

score: 12
Accepted
time: 197ms
memory: 5904kb

input:

100
501 1000
59 300 426 438
15 166 59 90
58 306 424 441
183 451 328 330
56 496 380 411
12 387 212 230
250 410 191 212
282 460 123 132
169 392 647 676
74 362 269 286
273 459 154 177
187 420 204 232
52 180 515 529
178 498 774 777
93 310 607 608
78 344 162 196
186 498 122 130
240 425 395 399
190 501 22...

output:

YES
426 84 430 328 405 220 206 123 670 271 166 222 522 774 607 187 122 395 223 298 197 256 438 59 105 65 513 193 147 71 215 49 279 214 144 435 116 66 62 30 347 370 293 189 625 353 154 577 342 173 534 81 86 161 386 333 257 319 251 294 130 487 167 164 302 44 498 134 596 362 153 35 458 681 23 358 96 45...

result:

ok all is ok (100 test cases)

Test #171:

score: 0
Time Limit Exceeded

input:

10
5001 10000
2215 3470 9821 9832
3470 4468 2363 2393
2600 3470 9557 9598
2504 3470 58 64
67 3470 4182 4207
2952 3470 9751 9767
3351 3470 7357 7405
2460 3470 4335 4380
3249 3470 4231 4256
2748 3470 9175 9231
1303 3470 937 985
888 3470 7032 7096
3042 3470 9426 9470
222 3470 1745 1746
3470 3937 6159 6...

output:

YES
9821 2376 9581 58 4187 9751 7379 4343 4231 9209 970 7053 9452 1745 6159 8627 8866 9126 1697 1588 3148 4461 8935 7603 9229 1960 4766 8619 4440 3824 329 5638 2659 5277 1559 3672 3364 9053 9707 460 4294 7519 1299 7447 5776 1600 4313 72 2785 4280 379 4780 3572 2636 769 3647 1213 776 3411 5519 3798 1...

result:


Subtask #10:

score: 0
Skipped

Dependency #1:

0%