QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#396645#4996. Icy ItineraryNetwork_ErrorAC ✓538ms77580kbC++141.7kb2024-04-22 22:44:392024-04-22 22:44:40

Judging History

你现在查看的是最新测评结果

  • [2024-04-22 22:44:40]
  • 评测
  • 测评结果:AC
  • 用时:538ms
  • 内存:77580kb
  • [2024-04-22 22:44:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define piii tuple<int,int,int>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define deb(var) cerr<<#var<<'='<<(var)<<"; "
mt19937 rnd(time(0));
int n,m,L[300010],R[300010];
map<int,map<int,bool> > p;
void sol2(){
	memset(L,0,sizeof L);
	memset(R,0,sizeof R);
	vector<int> vec(n);
	iota(vec.begin(),vec.end(),1);
	shuffle(vec.begin(),vec.end(),rnd);
	int mid=1;
	for(auto i:vec){
		if(i==1)continue;
		if(!R[mid])L[R[mid]=i]=mid,mid=!p[mid][i]?i:mid;
//		else if(!L[mid])R[L[mid]=i]=mid,s=i;
		else{
			if(!p[mid][i]){
				int nxt=R[mid];
				L[R[mid]=i]=mid;
				R[L[nxt]=i]=nxt;
				mid=!p[i][nxt]?nxt:i;
			}else{
				int nxt=L[mid];
				if(!nxt)return;
				L[R[nxt]=i]=nxt;
				R[L[mid]=i]=mid;
				mid=!p[nxt][i]?i:nxt;
			}
		} 
	}
	for(int i=1;i;i=R[i])cout<<i<<' ';cout<<'\n';exit(0);
}
void sol1(){
	memset(L,0,sizeof L);
	memset(R,0,sizeof R);
	vector<int> vec(n);
	iota(vec.begin(),vec.end(),1);
	shuffle(vec.begin(),vec.end(),rnd);
	int mid=1;
	for(auto i:vec){
		if(i==1)continue;
		if(!R[mid])L[R[mid]=i]=mid,mid=p[mid][i]?i:mid;
		else{
			if(p[mid][i]){
				int nxt=R[mid];
				L[R[mid]=i]=mid;
				R[L[nxt]=i]=nxt;
				mid=p[i][nxt]?nxt:i;
			}else{
				int nxt=L[mid];
				if(!nxt)return;
				L[R[nxt]=i]=nxt;
				R[L[mid]=i]=mid;
				mid=p[nxt][i]?i:nxt;
			}
		} 
	}
	for(int i=1;i;i=R[i])cout<<i<<' ';cout<<'\n';exit(0);
}
void work(){
	cin>>n>>m;
	for(int i=1,u,v;i<=m;i++)
		cin>>u>>v,p[u][v]=p[v][u]=1;
	while(1)sol1(),sol2();
}
signed main(){
	ios::sync_with_stdio(0),
	cin.tie(0),cout.tie(0);
	int T=1;while(T--)work();return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 6028kb

input:

4 4
1 2
1 3
1 4
3 4

output:

1 3 2 4 

result:

ok qwq

Test #2:

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

input:

5 0

output:

1 2 5 3 4 

result:

ok qwq

Test #3:

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

input:

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

output:

1 2 7 6 10 8 3 9 5 4 

result:

ok qwq

Test #4:

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

input:

2 1
1 2

output:

1 2 

result:

ok qwq

Test #5:

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

input:

2 0

output:

1 2 

result:

ok qwq

Test #6:

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

input:

3 1
1 3

output:

1 3 2 

result:

ok qwq

Test #7:

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

input:

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

output:

1 2 10 7 8 9 6 3 4 5 

result:

ok qwq

Test #8:

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

input:

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

output:

1 2 10 7 8 9 6 3 4 5 

result:

ok qwq

Test #9:

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

input:

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

output:

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

result:

ok qwq

Test #10:

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

input:

15 1
13 6

output:

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

result:

ok qwq

Test #11:

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

input:

150 150
110 99
80 122
55 67
24 47
73 68
150 13
94 140
146 59
136 28
94 134
131 2
26 105
65 79
57 37
116 102
84 16
110 78
72 5
34 8
8 43
83 57
49 146
43 112
54 139
95 13
11 95
75 29
29 30
52 14
118 56
4 51
18 146
31 113
56 69
44 14
63 123
44 66
101 122
52 10
16 118
71 93
22 113
28 88
5 108
16 48
84 1...

output:

1 142 129 133 67 31 33 101 106 55 9 14 20 108 35 13 66 104 47 84 75 107 37 100 27 41 15 42 89 87 90 81 8 63 128 51 56 11 24 88 97 117 109 143 127 135 69 38 16 98 43 120 148 4 91 74 78 12 34 46 125 25 39 103 18 22 96 58 93 82 137 140 136 112 7 126 138 147 134 28 132 94 72 64 50 2 102 83 79 77 122 116...

result:

ok qwq

Test #12:

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

input:

1500 1500
370 639
1046 375
1191 907
782 923
1369 196
998 194
640 331
309 631
1053 1076
887 1112
650 1437
2 1133
847 302
647 81
22 691
772 14
1112 62
266 1399
865 980
1302 1146
1007 575
1448 261
1489 1189
1134 1009
7 1175
1369 942
709 365
675 514
1021 1250
1415 2
976 746
564 388
431 326
43 147
385 81...

output:

1 214 1256 1108 887 85 425 1407 1022 560 766 243 415 28 1260 167 333 447 1050 329 297 845 293 1145 757 767 830 1188 980 1334 1114 586 639 250 686 345 1230 569 1425 351 1378 1472 216 1352 1421 877 811 615 947 340 702 310 1420 961 556 1253 1081 196 489 198 1190 554 350 1343 762 1085 331 1331 967 661 5...

result:

ok qwq

Test #13:

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

input:

15000 15000
11602 9990
5492 14226
2633 14599
7956 12544
1258 1198
13788 3283
171 3770
8226 10782
915 6735
7186 14219
12806 1549
8783 5596
3692 9668
370 4654
13811 4032
835 12990
14273 14020
8902 7798
7405 4524
7476 1864
7786 14984
4367 13552
2927 2463
1929 3198
97 5800
14012 5674
6283 827
13860 1139...

output:

1 6856 4240 2918 11784 1770 5903 10775 6200 1151 5525 12032 7544 8105 10024 10222 14218 1934 9384 14000 1170 8659 12689 11668 9642 10066 3640 8522 5843 5986 12525 3983 6883 7464 14061 12903 2925 12169 7921 13368 3669 4074 12725 3619 5191 8296 10730 59 12679 10662 12086 7591 12668 7391 3165 5671 7975...

result:

ok qwq

Test #14:

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

input:

300000 0

output:

1 255137 56918 288320 70996 61395 71718 173340 287372 121666 171581 84676 209742 146384 4411 216363 295629 273431 171697 149229 21620 251401 117378 272417 164397 246435 279621 220277 221887 237727 164407 151601 210224 234543 283486 232718 278183 299118 18710 274399 14958 119377 102214 124877 171608 ...

result:

ok qwq

Test #15:

score: 0
Accepted
time: 164ms
memory: 49392kb

input:

300000 1
80856 110687

output:

1 255137 56918 288320 70996 61395 71718 173340 287372 121666 171581 84676 209742 146384 4411 216363 295629 273431 171697 149229 21620 251401 117378 272417 164397 246435 279621 220277 221887 237727 164407 151601 210224 234543 283486 232718 278183 299118 18710 274399 14958 119377 102214 124877 171608 ...

result:

ok qwq

Test #16:

score: 0
Accepted
time: 155ms
memory: 49360kb

input:

300000 100
254473 70041
278954 218026
54339 23948
90766 35432
145294 42945
10824 168971
162204 196321
137959 274421
274330 8901
113606 229638
136217 161945
232685 214848
91296 146678
8764 206628
297190 163150
140047 161791
188167 261504
261443 160497
262029 233857
112139 37654
43010 192683
3697 1727...

output:

1 255137 56918 288320 70996 61395 71718 173340 287372 121666 171581 84676 209742 146384 4411 216363 295629 273431 171697 149229 21620 251401 117378 272417 164397 246435 279621 220277 221887 237727 164407 151601 210224 234543 283486 232718 278183 299118 18710 274399 14958 119377 102214 124877 171608 ...

result:

ok qwq

Test #17:

score: 0
Accepted
time: 277ms
memory: 58992kb

input:

300000 100000
279619 105099
95580 46691
139476 105331
67098 144910
105689 84242
198438 147050
274697 179922
229381 179041
210820 243557
162433 137909
14644 17464
295783 151723
180167 63360
17314 119555
201506 121519
129982 11913
3312 283798
197026 175391
86210 36036
177182 150502
37900 95301
261630 ...

output:

1 255137 56918 288320 70996 61395 71718 173340 287372 121666 171581 84676 209742 146384 4411 216363 295629 273431 171697 149229 21620 251401 117378 272417 164397 246435 279621 220277 221887 237727 164407 151601 210224 234543 283486 232718 278183 299118 18710 274399 14958 119377 102214 124877 171608 ...

result:

ok qwq

Test #18:

score: 0
Accepted
time: 538ms
memory: 77480kb

input:

300000 300000
297121 280398
49505 181149
186167 88552
250816 195719
113345 180891
103968 274040
148345 167433
283785 32444
281156 62491
76167 222701
181130 69399
291957 220950
21996 17907
98113 270806
247895 36687
122761 248769
235623 41248
274601 174896
296046 235115
57460 64170
286130 15089
91951 ...

output:

1 79637 252936 118905 227686 12808 26498 2819 11534 212089 72733 32300 13734 207249 124956 286705 239196 258689 279018 140331 256121 20241 27620 653 76771 236067 202535 137540 73148 248190 112058 57752 39204 296825 9947 263706 153491 110243 187036 112383 60127 173640 282928 291573 264787 88150 25349...

result:

ok qwq

Test #19:

score: 0
Accepted
time: 244ms
memory: 34296kb

input:

1000 300000
794 378
253 365
792 287
235 482
50 807
795 174
786 980
763 645
615 440
364 542
209 856
925 709
965 709
755 592
242 870
960 978
253 404
164 439
931 998
443 318
663 958
560 445
970 245
192 631
321 621
120 472
402 520
939 454
436 893
840 577
112 961
509 9
815 190
357 128
52 433
554 967
384 ...

output:

1 222 749 526 430 884 411 914 888 894 113 172 900 334 5 402 433 226 631 847 12 165 738 604 640 728 312 336 751 658 983 809 376 857 483 824 335 317 811 434 375 619 399 314 448 196 362 739 475 104 895 689 618 277 45 238 22 1000 629 101 712 699 795 352 422 991 404 922 502 318 207 578 966 54 731 596 912...

result:

ok qwq

Test #20:

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

input:

1500 300000
1189 1031
85 1047
1096 1290
1497 193
885 27
603 979
1438 1441
507 1256
1432 803
332 750
536 157
333 1248
1009 943
857 422
849 796
1399 814
911 481
836 36
1360 1175
592 737
277 672
551 331
849 1049
725 343
1312 112
889 544
1154 691
1387 1326
91 481
432 689
1051 248
1069 1499
499 194
748 1...

output:

1 693 902 1289 937 1240 298 1494 158 966 864 419 1300 577 299 697 93 1193 575 812 1079 882 779 517 81 90 955 36 1260 1349 895 626 940 303 1293 666 621 253 1366 852 391 910 140 1474 567 611 574 122 58 1192 171 442 598 1205 1156 1035 1390 324 768 292 854 192 1155 743 547 1187 737 538 952 1014 527 20 3...

result:

ok qwq

Test #21:

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

input:

10000 300000
1236 4556
6003 6937
2217 6717
1150 1520
835 87
6994 6123
4263 8371
6772 4802
7302 3130
6157 4469
9918 3820
1997 5129
9662 7860
5882 9655
4931 8546
4776 1017
3925 6960
8114 6760
7793 3511
2958 3481
7244 3603
8609 4155
1832 2597
1639 6861
6563 8641
7870 3706
3772 4396
7696 6907
8722 1019
...

output:

1 5966 1738 1434 2216 142 832 6662 123 7835 5119 8068 563 1251 7150 6336 1977 808 3336 9983 1579 299 8658 7880 7800 1701 1729 2275 6857 8041 2662 4490 4370 4400 6015 2017 5803 1140 6477 7562 7111 5509 4172 4164 4005 4923 1328 3291 7097 7418 3457 477 8620 2985 8624 4762 2217 3597 5888 9695 8355 9088 ...

result:

ok qwq

Test #22:

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

input:

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

output:

1 2 4 9 3 8 7 5 6 10 

result:

ok qwq

Test #23:

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

input:

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

output:

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

result:

ok qwq

Test #24:

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

input:

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

output:

1 285 468 594 904 693 451 852 522 747 849 875 721 381 234 245 637 79 351 810 557 686 949 429 9 270 769 742 440 720 931 863 281 64 938 604 161 685 217 311 355 862 952 606 157 393 805 422 994 319 402 182 855 179 627 332 827 702 371 507 28 833 499 231 197 652 108 664 887 873 170 171 832 978 41 537 276 ...

result:

ok qwq

Test #25:

score: 0
Accepted
time: 105ms
memory: 34560kb

input:

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

output:

1 328 2357 1480 481 617 2900 2944 381 803 245 1711 239 916 1343 111 1194 2760 1526 698 29 2894 1684 2963 936 548 1230 1123 2037 1024 903 1890 1093 2587 1027 2201 2471 703 326 2844 426 2993 557 1262 2721 1878 2164 573 659 2896 2386 1906 1900 1990 2153 1584 2503 2935 2492 696 335 208 1076 301 1401 175...

result:

ok qwq

Test #26:

score: 0
Accepted
time: 110ms
memory: 35600kb

input:

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

output:

1 7642 160 486 6824 802 1388 7482 1837 8600 6310 7338 8354 7911 9821 118 2565 7134 3878 4050 3264 5694 4457 6993 7347 5482 5729 3834 6727 5771 2045 8525 5871 5549 526 9149 1954 8659 2618 8637 3292 8945 3537 3048 8278 6319 5155 2602 258 2646 9889 5852 2243 3892 3484 339 4757 865 7285 9041 484 4089 29...

result:

ok qwq

Test #27:

score: 0
Accepted
time: 153ms
memory: 40144kb

input:

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

output:

1 37029 34757 13055 28533 31412 19367 39228 34074 2264 25932 31833 26081 23409 8296 20162 6988 37914 26892 16219 23110 22633 13249 21860 2844 1322 31089 4212 21334 23104 31304 14912 2070 3539 7765 39020 19295 20208 36510 26620 33684 7026 28315 947 9114 22966 27394 6165 15410 24546 7969 9013 14280 10...

result:

ok qwq

Test #28:

score: 0
Accepted
time: 219ms
memory: 48624kb

input:

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

output:

1 16696 11336 29389 22126 63990 11832 70903 81398 70205 42170 59888 99646 18845 75957 6693 99119 47375 2677 97357 37099 24811 21860 71722 93606 70852 46166 9603 96885 7576 98342 48362 34562 17551 19579 31595 22115 34600 83451 34443 77291 98880 52698 46080 8410 76342 12320 64181 60910 29554 79907 378...

result:

ok qwq

Test #29:

score: 0
Accepted
time: 412ms
memory: 77520kb

input:

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

output:

1 52313 153656 44720 180915 80521 216102 215953 266975 99027 253988 215286 215104 157558 96532 227374 74204 237186 7577 173058 157626 265403 299568 80778 86909 292504 129359 70275 89558 164757 8076 232982 169956 54812 175446 145105 105641 295945 249356 217553 261039 208824 175302 288335 257803 14191...

result:

ok qwq

Test #30:

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

input:

1000 249500
1 702
1 559
1 154
1 284
1 707
1 397
1 281
1 105
1 856
1 712
1 864
1 638
1 640
1 984
1 134
1 819
1 36
1 820
1 146
1 779
1 516
1 420
1 721
1 932
1 426
1 922
1 790
1 167
1 365
1 667
1 690
1 357
1 543
1 778
1 473
1 9
1 239
1 746
1 983
1 141
1 349
1 852
1 826
1 553
1 929
1 628
1 500
1 352
1 6...

output:

1 425 296 372 718 377 18 34 632 186 202 445 51 755 782 260 842 645 580 366 177 123 126 955 932 411 413 834 252 701 635 747 342 595 246 954 765 735 728 620 648 818 937 77 526 124 76 454 82 307 987 213 901 917 506 180 450 511 486 295 441 374 952 867 829 900 52 396 662 784 28 458 726 335 170 163 429 83...

result:

ok qwq

Test #31:

score: 0
Accepted
time: 96ms
memory: 29256kb

input:

750 245875
1 596
1 476
1 375
1 129
1 650
1 604
1 579
1 302
1 574
1 322
1 351
1 206
1 107
1 535
1 597
1 135
1 516
1 330
1 515
1 151
1 357
1 146
1 4
1 150
1 85
1 15
1 655
1 227
1 549
1 311
1 560
1 705
1 273
1 249
1 307
1 191
1 398
1 691
1 621
1 257
1 268
1 729
1 593
1 61
1 139
1 630
1 172
1 740
1 306
...

output:

1 642 139 76 306 487 740 110 85 340 476 461 151 159 398 169 206 568 107 140 4 703 597 32 268 295 549 200 729 661 574 348 560 38 311 441 351 186 691 243 135 82 621 59 357 181 705 251 596 176 146 25 655 657 150 106 227 428 302 281 593 408 604 87 257 250 129 709 579 520 322 226 273 478 61 158 535 166 6...

result:

ok qwq

Test #32:

score: 0
Accepted
time: 87ms
memory: 29108kb

input:

750 245875
1 368
1 278
1 71
1 353
1 405
1 149
1 616
1 153
1 622
1 655
1 105
1 682
1 140
1 668
1 352
1 210
1 257
1 677
1 749
1 612
1 234
1 35
1 400
1 604
1 193
1 505
1 230
1 586
1 358
1 737
1 428
1 346
1 279
1 395
1 584
1 691
1 73
1 435
1 639
1 205
1 320
1 496
1 384
1 295
1 522
1 672
1 309
1 250
1 43...

output:

1 641 700 169 304 584 63 531 136 746 60 572 232 115 310 32 430 152 283 358 110 158 189 707 279 245 668 533 188 445 609 37 463 162 718 210 302 289 261 640 326 236 689 150 729 57 355 154 731 708 594 387 633 491 604 503 53 70 160 127 342 293 29 623 195 222 123 51 580 545 395 88 429 206 270 743 512 510 ...

result:

ok qwq

Test #33:

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

input:

750 101324
1 411
1 270
1 170
1 697
1 76
1 64
1 744
1 353
1 109
1 115
1 133
1 560
1 453
1 690
1 297
1 733
1 523
1 479
1 62
1 32
1 80
1 578
1 261
1 682
1 506
1 303
1 646
1 229
1 750
1 421
1 322
1 168
1 543
1 568
1 456
1 138
1 57
1 380
1 534
1 131
1 452
1 614
1 174
1 207
1 617
1 123
1 562
1 69
1 567
1 ...

output:

1 505 380 597 234 98 191 225 273 728 284 678 367 69 121 63 168 217 340 152 475 317 131 26 115 357 151 502 155 355 368 135 710 348 426 496 663 725 123 536 113 90 5 223 320 640 591 181 261 24 122 529 375 462 548 42 488 118 60 74 733 268 601 238 266 298 532 672 246 356 689 255 440 651 187 684 316 382 4...

result:

ok qwq

Test #34:

score: 0
Accepted
time: 13ms
memory: 10376kb

input:

750 45299
1 415
1 743
1 571
1 531
1 419
1 378
1 188
1 454
1 117
1 344
1 362
1 180
1 461
1 228
1 693
1 115
1 275
1 250
1 501
1 618
1 322
1 217
1 42
1 398
1 129
1 88
1 414
1 740
1 90
1 528
1 437
1 124
1 733
1 241
1 487
1 72
1 295
1 366
1 748
1 143
1 55
1 113
1 534
1 479
1 555
1 712
1 349
1 586
1 212
1...

output:

1 505 380 597 98 234 191 225 728 678 367 273 69 284 63 121 168 217 340 152 317 475 131 26 115 674 483 403 628 357 151 502 155 136 355 368 135 710 28 257 348 426 629 68 496 536 725 91 36 113 78 123 255 90 5 529 640 462 223 42 320 591 181 663 261 13 24 122 375 548 488 356 238 118 74 60 733 268 601 266...

result:

ok qwq

Test #35:

score: 0
Accepted
time: 106ms
memory: 30364kb

input:

750 258869
1 124
1 233
1 740
1 493
1 145
1 749
1 142
1 224
1 308
1 572
1 33
1 660
1 246
1 377
1 690
1 105
1 741
1 692
1 497
1 334
1 481
1 450
1 366
1 307
1 739
1 165
1 730
1 430
1 332
52 349
52 424
52 212
52 555
52 531
52 426
52 379
52 637
52 635
52 434
52 40
52 404
52 261
52 190
52 557
52 225
52 52...

output:

1 672 246 37 692 18 572 311 749 580 224 173 481 747 33 92 430 667 124 72 660 179 105 303 332 100 739 495 142 211 493 694 740 56 233 624 730 590 308 587 307 485 377 414 366 325 450 241 741 519 334 484 690 408 165 7 497 644 145 432 630 208 230 534 206 514 407 245 637 250 392 306 270 137 251 452 585 64...

result:

ok qwq

Test #36:

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

input:

750 1154
1 433
1 99
1 563
1 370
1 149
1 218
1 477
1 170
1 98
1 299
1 586
1 574
1 51
1 667
1 539
1 659
1 615
1 730
1 12
1 694
1 695
1 662
1 166
1 253
1 84
1 420
1 533
1 231
1 410
433 99
433 563
433 370
433 149
433 218
433 477
433 170
433 98
433 299
433 586
433 574
433 51
433 667
433 539
433 659
433 6...

output:

1 505 380 597 98 234 191 225 728 273 284 678 367 69 121 63 168 217 340 152 317 475 131 26 115 674 483 403 628 357 151 502 155 136 355 368 135 710 28 257 348 426 629 68 496 663 13 536 725 123 113 91 36 78 255 90 5 42 462 529 640 223 320 591 181 261 24 122 375 548 488 356 238 74 118 60 733 268 601 266...

result:

ok qwq

Test #37:

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

input:

750 1924
1 211
1 576
1 697
1 175
1 675
1 641
1 301
1 227
1 311
1 669
1 637
1 673
1 245
1 548
1 74
1 740
1 134
1 561
1 90
1 185
1 511
1 57
1 478
1 423
1 310
1 741
1 550
1 7
1 712
1 725
1 293
1 361
1 593
1 558
1 414
1 356
1 94
1 120
1 700
1 60
1 434
1 226
1 647
1 453
1 328
1 221
1 28
1 352
1 11
1 654
...

output:

1 505 380 597 98 234 191 225 728 273 284 678 367 69 121 63 168 217 340 152 317 475 131 26 115 674 483 403 628 357 151 502 155 136 355 368 135 710 28 257 348 426 629 68 496 663 13 536 725 123 113 91 36 78 255 90 5 42 462 529 640 223 320 591 181 261 24 122 375 548 488 356 238 74 118 60 733 268 601 266...

result:

ok qwq

Test #38:

score: 0
Accepted
time: 81ms
memory: 29288kb

input:

750 244699
1 235
1 228
1 716
1 27
1 55
1 706
1 313
1 247
1 131
1 120
1 446
1 25
1 615
1 351
1 712
1 606
1 406
1 324
1 356
1 182
1 622
1 230
1 497
1 511
1 163
1 137
1 630
1 434
1 273
1 350
1 297
1 674
1 605
1 109
1 707
1 101
1 78
1 691
1 133
1 705
1 354
1 115
1 735
1 384
1 211
1 364
1 386
1 663
1 54
...

output:

1 641 700 169 304 584 63 508 531 136 746 60 572 232 115 112 93 310 32 430 152 283 358 158 189 707 279 245 668 533 188 428 475 445 609 37 463 162 718 210 302 289 261 640 326 236 689 150 729 57 355 426 72 154 731 708 594 167 727 387 633 338 457 662 101 491 604 503 53 70 160 127 342 293 29 623 195 222 ...

result:

ok qwq

Test #39:

score: 0
Accepted
time: 102ms
memory: 32908kb

input:

1500 281624
1 1109
1 1191
1 775
1 218
1 867
1 1135
1 1484
1 72
1 523
1 502
1 1296
1 187
1 1241
1 1178
1 1099
1 305
1 962
1 431
1 813
1 368
1 755
1 722
1 404
1 1092
1 1263
1 999
1 704
1 1096
1 1234
1 645
1 504
1 246
1 365
1 624
1 838
1 1061
1 1458
1 430
1 738
1 1349
1 302
1 691
1 1098
1 1437
1 250
1 ...

output:

1 140 328 199 947 603 1362 73 97 765 1043 1330 574 338 1353 538 412 1048 92 653 375 764 1499 761 1009 866 333 1388 413 1462 1003 286 103 1422 606 1392 495 526 1409 334 228 1488 849 525 786 117 77 1324 102 864 1325 829 696 292 1313 647 1402 1236 196 1428 223 604 245 1183 283 1403 1496 449 657 1433 67...

result:

ok qwq

Test #40:

score: 0
Accepted
time: 106ms
memory: 32788kb

input:

1500 281624
1 359
1 429
1 391
1 904
1 152
1 321
1 1361
1 435
1 1043
1 1059
1 669
1 1437
1 548
1 186
1 278
1 416
1 618
1 1472
1 634
1 806
1 503
1 713
1 1197
1 252
1 960
1 1341
1 366
1 302
1 623
1 226
1 52
1 1034
1 448
1 738
1 430
1 408
1 1366
1 874
1 727
1 18
1 240
1 1294
1 301
1 141
1 1046
1 369
1 9...

output:

1 979 206 88 62 1160 1089 420 921 229 1256 1133 759 1321 502 599 722 741 952 586 1061 212 1155 1405 589 421 49 926 292 868 1392 383 209 148 1147 1058 1417 845 831 324 1468 265 910 600 1475 528 1238 1073 819 496 1244 368 642 164 323 458 987 342 604 522 409 939 382 617 220 1112 1148 144 816 255 1294 4...

result:

ok qwq

Test #41:

score: 0
Accepted
time: 96ms
memory: 29556kb

input:

1000 250000
1 576
1 827
1 255
1 901
1 254
1 217
1 553
1 531
1 436
1 209
1 339
1 765
1 21
1 610
1 235
1 613
1 495
1 918
1 299
1 512
1 628
1 68
1 4
1 421
1 422
1 858
1 587
1 458
1 154
1 487
1 205
1 687
1 227
1 279
1 394
1 608
1 802
1 656
1 548
1 286
1 752
1 544
1 821
1 328
1 751
1 175
1 801
1 871
1 99...

output:

1 402 788 568 12 882 352 428 927 494 842 796 11 436 74 735 142 241 563 282 145 205 695 23 325 183 214 870 998 577 319 271 47 389 134 105 110 21 129 397 599 877 369 853 221 328 59 1000 612 39 454 468 785 827 94 346 730 752 921 201 111 31 69 736 345 371 559 240 284 121 684 623 347 513 197 883 363 584 ...

result:

ok qwq

Test #42:

score: 0
Accepted
time: 86ms
memory: 28200kb

input:

750 235576
1 584
1 479
1 457
1 589
1 456
1 195
1 284
1 120
1 220
1 340
1 566
1 134
1 661
1 666
1 742
1 702
1 563
1 246
1 370
1 415
1 388
1 159
1 532
1 209
1 121
1 157
1 573
1 272
1 77
1 454
1 487
1 471
1 545
1 600
1 256
1 262
1 612
1 58
1 131
1 607
1 403
1 124
1 691
1 571
1 534
1 740
1 43
1 482
1 19...

output:

1 277 329 452 264 607 386 367 43 403 363 379 656 301 191 159 123 216 211 738 630 332 749 660 435 469 415 239 248 200 337 641 27 79 376 92 702 70 259 269 725 136 504 680 41 307 728 33 625 670 721 167 550 174 215 157 623 89 503 460 461 442 689 549 108 364 485 310 147 657 447 378 637 673 30 357 716 122...

result:

ok qwq

Test #43:

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

input:

1000 250000
1 54
1 332
1 325
1 717
1 164
1 931
1 373
1 578
1 788
1 290
1 900
1 610
1 646
1 531
1 188
1 600
1 448
1 625
1 728
1 320
1 461
1 204
1 558
1 665
1 629
1 869
1 100
1 340
1 268
1 715
1 338
1 608
1 353
1 777
1 264
1 771
1 835
1 169
1 276
1 601
1 895
1 661
1 507
1 611
1 568
1 475
1 863
1 510
1...

output:

1 790 863 310 265 614 332 359 353 288 508 286 703 574 228 503 118 410 488 651 22 58 608 482 290 157 358 789 798 899 88 516 924 553 473 33 237 436 704 234 510 383 537 474 725 719 191 659 390 535 913 220 106 321 480 476 821 791 761 248 502 365 63 975 576 694 926 391 838 127 495 293 37 304 856 766 26 9...

result:

ok qwq

Test #44:

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

input:

700 226506
1 663
1 483
1 532
1 537
1 492
1 641
1 648
1 208
1 472
1 266
1 662
1 91
1 379
1 463
1 297
1 61
1 23
1 530
1 12
1 411
1 322
1 17
1 654
1 451
1 329
1 351
1 162
1 283
1 501
1 643
1 403
1 627
1 386
1 251
1 19
1 92
1 350
1 69
1 55
1 65
1 73
1 528
1 432
1 371
1 597
1 605
1 202
1 498
1 177
1 222
...

output:

1 599 410 487 632 591 349 339 241 539 577 687 543 309 180 143 26 15 377 360 611 533 480 133 111 476 630 104 567 522 183 220 684 156 361 343 354 96 665 216 400 177 459 129 391 272 305 676 88 151 678 370 201 158 652 605 634 253 102 175 308 598 194 75 302 230 76 493 157 535 246 142 386 554 692 564 112 ...

result:

ok qwq

Test #45:

score: 0
Accepted
time: 76ms
memory: 29780kb

input:

1000 249494
933 199
933 48
933 238
933 122
933 17
933 573
933 592
933 505
933 784
933 165
933 840
933 809
933 676
933 565
933 353
933 819
933 425
933 423
933 185
933 733
933 580
933 870
933 257
933 735
933 629
933 114
933 200
933 181
933 1000
933 951
933 538
933 658
933 318
933 171
933 841
933 258
9...

output:

1 606 284 7 788 119 346 696 510 929 712 314 583 711 640 938 532 146 632 218 656 138 170 950 846 207 311 511 548 596 648 9 498 638 814 390 343 779 354 787 89 888 732 527 613 39 67 804 755 595 875 746 525 508 622 76 435 547 612 272 415 381 52 338 953 202 647 807 981 74 720 834 944 963 235 918 957 835 ...

result:

ok qwq

Test #46:

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

input:

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

output:

1 5 3 4 2 

result:

ok qwq

Test #47:

score: 0
Accepted
time: 349ms
memory: 63068kb

input:

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

output:

1 160767 152213 38511 110481 4703 73942 143289 97684 14314 48149 17158 187843 116647 51595 3448 198445 143171 136439 118936 102264 186158 45769 80902 54512 112916 192513 168850 161534 126271 77668 145509 111227 171385 189480 902 196224 23465 33590 2486 180861 31463 65503 189951 80126 21199 62016 184...

result:

ok qwq

Test #48:

score: 0
Accepted
time: 389ms
memory: 77580kb

input:

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

output:

1 156168 207913 42011 35043 275693 51341 205768 1832 248338 271696 102126 175483 202221 98807 280181 63905 289736 8252 43695 242608 121400 3979 61796 111239 144804 233975 19436 14021 135205 27138 274016 150426 253419 200264 238777 100911 171640 239199 160689 123257 192693 261579 213836 90216 218100 ...

result:

ok qwq

Test #49:

score: 0
Accepted
time: 367ms
memory: 55852kb

input:

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

output:

1 119824 26730 6813 64436 24890 26333 1995 69276 101160 83021 39189 126543 4826 147823 47846 81566 77641 67033 3547 146759 141912 69687 126079 62030 7042 121044 32415 116107 81768 30291 147104 79740 97115 116723 30509 88946 75433 71728 128911 33921 54904 123225 106556 43573 77374 72310 94445 20104 6...

result:

ok qwq

Test #50:

score: 0
Accepted
time: 341ms
memory: 42840kb

input:

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

output:

1 538 1796 50094 10516 31210 3158 2334 37772 24030 473 36926 28744 54515 56120 31810 22547 29255 41735 27588 51066 55793 3765 334 14203 15774 31608 52156 17585 58550 15448 29488 39473 35840 18710 24945 54615 21238 34037 39121 10430 39225 42065 30507 13559 29958 39620 36801 48128 58243 17201 3566 145...

result:

ok qwq

Test #51:

score: 0
Accepted
time: 281ms
memory: 36236kb

input:

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

output:

1 345 493 1680 3521 12423 10707 5922 13575 4951 9466 4310 14758 13339 8897 11851 6356 11540 551 587 4706 8396 5620 14088 7823 13929 5685 9595 9068 6598 5140 10069 12885 8086 13894 14382 13849 14603 5874 10450 8006 5024 14854 86 14062 9795 5396 13034 5910 13517 8549 7962 12607 770 7711 3349 10095 115...

result:

ok qwq

Test #52:

score: 0
Accepted
time: 357ms
memory: 63284kb

input:

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

output:

1 125679 149942 180824 151614 145931 180067 159911 11773 124104 71735 52159 43841 177154 80579 26465 130158 91632 84660 25143 60485 165751 21081 190744 163778 77741 185671 16394 27356 40642 186641 46062 87533 40808 134245 32826 46205 21912 1629 50414 176605 20137 44579 165797 179849 113793 101960 11...

result:

ok qwq

Test #53:

score: 0
Accepted
time: 371ms
memory: 63008kb

input:

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

output:

1 191190 125679 149942 180824 151614 145931 180067 159911 11773 124104 71735 52159 43841 177154 80579 26465 130158 91632 84660 25143 60485 165751 21081 190744 163778 77741 185671 16394 27356 40642 186641 46062 87533 40808 134245 32826 46205 21912 1629 50414 176605 20137 44579 165797 179849 113793 10...

result:

ok qwq

Test #54:

score: 0
Accepted
time: 347ms
memory: 77528kb

input:

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

output:

1 238648 135504 17 238821 88972 205456 26751 220890 199825 70414 67488 111013 16499 16801 167710 290932 151696 259972 43306 250341 196556 172494 126412 110967 181250 4426 283207 271061 178281 233990 110000 25951 273553 219561 291284 133954 245185 270662 224089 51264 165677 124991 15914 224234 294935...

result:

ok qwq

Test #55:

score: 0
Accepted
time: 476ms
memory: 74452kb

input:

277777 299999
83480 84066
89447 138053
22019 117298
177566 275000
1 102260
1 243393
1 72575
1 158614
242036 131536
16114 153213
1 14416
173641 89066
64085 248261
25577 106882
137668 220979
226900 232508
180916 268690
1 197089
136413 2874
218273 106977
1 28628
1 66331
264247 167205
165667 194678
1 12...

output:

1 64043 160405 77555 265970 17851 144500 190950 193017 76467 77227 18866 25334 43409 34674 30712 98531 43726 51321 108667 8907 166126 71324 251020 127831 131767 115634 97756 51369 127020 146412 110416 202052 83228 166180 242270 53976 52882 250608 35762 57091 26345 69877 276072 17830 164849 133602 23...

result:

ok qwq

Test #56:

score: 0
Accepted
time: 201ms
memory: 29592kb

input:

1001 250000
277 821
646 178
815 340
54 841
141 706
257 155
376 969
1001 332
91 196
51 67
737 60
450 656
138 756
494 937
999 428
991 148
648 556
807 776
345 146
639 829
748 617
987 746
21 853
897 84
435 634
789 739
971 995
416 785
499 451
734 530
811 941
398 633
819 855
293 32
435 582
507 32
355 321
...

output:

1 193 441 854 182 504 726 59 977 813 521 91 320 987 519 712 745 993 318 561 478 378 72 134 545 132 899 538 15 310 81 897 440 574 839 384 274 887 601 370 594 272 278 150 249 569 121 453 305 537 721 653 618 253 869 683 113 494 540 878 8 191 591 851 475 593 241 322 28 621 64 825 709 688 24 350 901 288 ...

result:

ok qwq

Test #57:

score: 0
Accepted
time: 178ms
memory: 28244kb

input:

1001 233359
401 540
791 950
167 305
233 735
143 698
614 39
935 923
823 952
864 151
388 360
148 701
962 349
318 698
171 830
127 228
378 521
274 313
544 399
607 221
748 824
250 408
148 316
657 294
608 39
853 39
656 536
951 570
689 558
789 733
723 500
419 320
120 887
348 349
185 212
687 176
154 810
298...

output:

1 903 577 52 76 38 847 442 774 492 906 770 510 473 142 536 881 768 950 101 368 174 212 68 172 340 776 811 199 558 416 301 205 201 181 714 383 73 192 735 512 650 293 175 585 973 54 400 316 263 448 559 23 349 256 169 564 845 210 986 893 159 894 129 647 832 435 332 40 262 890 727 260 765 133 315 325 12...

result:

ok qwq

Test #58:

score: 0
Accepted
time: 260ms
memory: 34508kb

input:

2333 300000
625 896
1013 677
1737 1495
2126 2006
861 1177
719 967
1453 1465
43 2030
2089 1048
353 2229
844 1617
1471 2027
1126 2277
62 2198
799 397
470 1359
1266 252
2236 412
46 1548
783 1113
2231 1558
968 1599
1721 746
1032 939
2089 2117
1921 967
302 1581
343 1515
1371 1713
1532 464
864 1687
1894 7...

output:

1 83 1098 1997 1186 1473 1509 1073 952 1760 1222 355 647 669 1272 156 1105 1046 2138 1491 348 932 1615 737 572 986 193 575 652 2269 1227 905 317 2127 1087 1109 1815 1206 2225 1485 866 705 1366 938 2189 1789 589 516 653 1906 1221 2235 981 1243 409 1795 1256 1990 928 412 1951 2164 2160 2184 1943 1480 ...

result:

ok qwq

Test #59:

score: 0
Accepted
time: 290ms
memory: 39148kb

input:

41337 289303
5168 20449
19925 39393
41187 16784
41187 34827
25451 30122
38242 23752
5168 9331
38242 34141
25451 30641
41187 28920
19925 12908
38242 8286
41187 34195
28038 1113
23216 9730
38242 27780
41187 6968
19925 33368
41187 40415
41187 2367
41187 12706
41187 7031
38242 23805
19925 9172
38242 336...

output:

1 20316 3427 13072 19470 7001 25639 29474 21832 29773 21521 12689 14924 22397 30495 16975 35131 22665 39242 17287 15240 37555 10697 3309 7299 26233 10153 11765 20619 40953 26394 25706 40452 26912 5638 23749 20991 13244 10741 38729 39768 4254 23092 39230 26324 25140 9186 2727 31328 29461 22994 41160 ...

result:

ok qwq

Test #60:

score: 0
Accepted
time: 334ms
memory: 48524kb

input:

99999 299985
26299 90867
51122 17693
81891 51018
26299 98987
26299 66077
81891 54919
51122 65487
51122 27865
26299 23884
81891 36921
51122 22704
26299 3538
26299 82595
81891 70563
26299 63110
81891 58335
51122 67974
81891 94538
51122 30153
26299 11592
51122 99077
26299 38022
51122 21128
81891 19911
...

output:

1 77309 94447 99624 19126 7178 5508 33376 52935 13335 57108 33295 28918 24696 22744 84611 84869 15385 42370 9295 98395 85378 31363 43638 69104 2044 74011 73139 81610 15809 29039 29019 92160 75870 99764 95482 36054 74416 42063 4857 86036 68625 34115 11043 75088 79755 36424 14438 99245 85913 67063 636...

result:

ok qwq

Test #61:

score: 0
Accepted
time: 314ms
memory: 48888kb

input:

102311 300000
84558 28122
73800 60160
16887 2984
73800 2740
48666 79181
84558 49101
73800 66332
48666 87065
73800 20123
85294 20372
48666 10539
85294 68529
73800 72419
73800 65059
16887 91344
48666 4996
85294 98487
73800 81170
85294 77951
48666 67637
48666 60644
73800 50867
48666 23902
73800 52178
4...

output:

1 49827 32345 5480 71698 54067 15583 70981 17420 50531 43974 10298 33311 89067 66514 6651 35537 40288 59710 71839 43639 65455 80122 6394 24607 101491 50091 63033 47935 99186 76341 22399 30801 6134 100183 76380 59269 48333 24195 4021 67223 38813 101199 94908 100030 76298 49920 81037 78183 17315 60411...

result:

ok qwq

Test #62:

score: 0
Accepted
time: 433ms
memory: 55800kb

input:

149999 299992
139174 24744
139174 38713
32325 41832
139174 30995
139174 46952
139174 54496
139174 89954
32325 8291
139174 122154
139174 89004
32325 114391
32325 99295
32325 34620
32325 71999
139174 115054
32325 105559
32325 2277
139174 59806
139174 44962
32325 50155
32325 100720
32325 144804
32325 1...

output:

1 8952 57834 145316 124437 4298 41377 134346 72496 32432 133968 149600 19533 28690 53801 67281 51496 59445 95853 59594 81129 89922 110795 76563 63733 12313 59947 89743 100712 93989 591 41452 126996 6531 106103 94321 108035 138382 36891 38794 70417 135217 69925 149881 38389 17479 6954 79751 62007 712...

result:

ok qwq

Test #63:

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

input:

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

output:

1 446 567 22 731 619 397 508 403 63 203 97 60 39 343 338 578 184 604 488 522 612 3 230 214 749 171 407 415 518 413 199 398 120 332 705 37 438 94 122 732 752 442 729 40 588 268 650 352 424 83 93 583 635 20 368 751 587 741 507 148 581 375 165 720 7 468 362 556 56 733 460 693 476 647 187 134 19 572 342...

result:

ok qwq