QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#396644#4996. Icy ItineraryNetwork_ErrorAC ✓553ms77620kbC++141.7kb2024-04-22 22:41:252024-04-22 22:41:25

Judging History

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

  • [2024-04-22 22:41:25]
  • 评测
  • 测评结果:AC
  • 用时:553ms
  • 内存:77620kb
  • [2024-04-22 22:41:25]
  • 提交

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: 0ms
memory: 6052kb

input:

4 4
1 2
1 3
1 4
3 4

output:

1 4 3 2 

result:

ok qwq

Test #2:

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

input:

5 0

output:

1 3 2 4 5 

result:

ok qwq

Test #3:

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

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 9 5 3 6 8 4 7 10 

result:

ok qwq

Test #4:

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

input:

2 1
1 2

output:

1 2 

result:

ok qwq

Test #5:

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

input:

2 0

output:

1 2 

result:

ok qwq

Test #6:

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

input:

3 1
1 3

output:

1 3 2 

result:

ok qwq

Test #7:

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

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 6 2 10 5 3 4 7 8 9 

result:

ok qwq

Test #8:

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

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 6 10 2 5 3 4 7 8 9 

result:

ok qwq

Test #9:

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

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 6 9 8 10 3 15 13 5 12 7 14 4 2 11 

result:

ok qwq

Test #10:

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

input:

15 1
13 6

output:

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

result:

ok qwq

Test #11:

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

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 16 108 100 61 45 75 92 118 6 70 95 93 34 42 37 144 107 104 145 81 58 86 119 139 28 149 20 137 44 41 112 128 17 127 5 131 21 115 136 142 77 97 30 74 39 91 53 48 102 36 129 51 101 8 113 18 90 148 133 68 29 132 72 10 125 11 69 63 120 117 141 124 123 23 94 82 116 73 85 126 140 59 60 46 26 76 3 121 111...

result:

ok qwq

Test #12:

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

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 250 1442 1075 586 622 27 120 1027 944 360 1452 1147 368 626 987 1371 1051 253 83 880 1315 336 918 1101 1275 344 1038 8 1254 1455 197 878 96 341 937 797 45 372 1186 225 858 39 719 1050 141 685 1300 1310 938 1466 140 979 144 261 904 757 267 1113 796 699 1311 943 646 700 1013 223 321 963 1208 1068 50...

result:

ok qwq

Test #13:

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

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 2794 10455 5378 6289 6116 7324 5603 9998 7543 9390 13017 7586 2683 1550 14860 2801 9433 6938 8525 1886 10757 13950 1331 5655 7331 6669 5535 7267 3537 9921 13165 14750 11003 6005 2204 163 11440 6506 6883 428 11541 6455 1555 7359 14628 12811 7167 10107 1045 1716 6386 718 676 1187 11856 3149 9263 603...

result:

ok qwq

Test #14:

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

input:

300000 0

output:

1 245694 5577 279724 297686 246005 231144 117544 22602 220872 12418 201027 122250 122372 110746 86777 115169 17448 169123 140239 220597 235911 282526 58087 35250 125534 212037 287958 161347 217593 33678 36040 287942 280087 139628 106158 277128 289791 144773 214145 36594 120974 79426 186395 9328 2783...

result:

ok qwq

Test #15:

score: 0
Accepted
time: 142ms
memory: 49420kb

input:

300000 1
80856 110687

output:

1 245694 5577 279724 297686 246005 231144 117544 22602 220872 12418 201027 122250 122372 110746 86777 115169 17448 169123 140239 220597 235911 282526 58087 35250 125534 212037 287958 161347 217593 33678 36040 287942 280087 139628 106158 277128 289791 144773 214145 36594 120974 79426 186395 9328 2783...

result:

ok qwq

Test #16:

score: 0
Accepted
time: 158ms
memory: 49696kb

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 245694 5577 279724 297686 246005 231144 117544 22602 220872 12418 201027 122250 122372 110746 86777 115169 17448 169123 140239 220597 235911 282526 58087 35250 125534 212037 287958 161347 217593 33678 36040 287942 280087 139628 106158 277128 289791 144773 214145 36594 120974 79426 186395 9328 2783...

result:

ok qwq

Test #17:

score: 0
Accepted
time: 299ms
memory: 58960kb

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 245694 5577 279724 297686 246005 231144 117544 22602 220872 12418 201027 122250 122372 110746 86777 115169 17448 169123 140239 220597 235911 282526 58087 35250 125534 212037 287958 161347 217593 33678 36040 287942 280087 139628 106158 277128 289791 144773 214145 36594 120974 79426 186395 9328 2783...

result:

ok qwq

Test #18:

score: 0
Accepted
time: 553ms
memory: 77616kb

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 275381 22036 158313 227981 274540 147294 11834 228971 174687 153752 89559 89003 276373 130339 180150 282083 552 121284 121188 184535 126709 235953 91308 97137 91829 35284 261086 242242 115755 23039 15873 56961 208575 206336 246646 194184 292091 242130 134950 206379 16103 70683 131439 294651 95989 ...

result:

ok qwq

Test #19:

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

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 949 721 921 595 889 826 380 396 808 278 425 942 753 661 264 131 227 5 832 776 443 763 647 894 553 308 313 435 405 631 718 836 419 172 879 457 584 318 320 67 845 347 338 94 153 475 873 656 61 542 726 98 330 594 794 513 89 602 48 880 346 136 7 235 768 693 664 446 440 358 160 766 943 589 805 729 754 ...

result:

ok qwq

Test #20:

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

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 1475 323 804 187 1411 101 693 905 620 1467 48 454 103 442 495 1163 351 748 1438 1228 614 1239 415 889 1357 610 306 423 220 941 1401 684 521 916 1310 165 584 1245 262 1392 945 1082 74 53 178 596 923 999 1027 525 422 1149 673 746 598 93 1232 227 1366 519 404 765 1420 624 1417 672 1323 728 642 1000 8...

result:

ok qwq

Test #21:

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

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 402 3282 2503 7497 432 8855 7704 934 1352 3231 6136 5160 4033 8722 6035 1148 7286 6222 6389 986 9980 3536 1029 3886 9749 2806 6934 3210 6295 7773 3214 3704 224 2628 7742 937 5368 3908 897 4096 7499 4464 8849 7111 5977 8212 3067 1381 4358 5035 4427 3589 5383 8361 6405 961 5504 7269 6911 2663 1904 3...

result:

ok qwq

Test #22:

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

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 3 6 8 2 10 5 9 4 7 

result:

ok qwq

Test #23:

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

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

result:

ok qwq

Test #24:

score: 0
Accepted
time: 97ms
memory: 34580kb

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 255 873 660 867 119 577 697 820 175 335 89 141 134 545 191 222 636 311 569 338 200 429 36 499 449 451 280 936 66 465 24 267 910 181 375 442 447 321 521 230 726 978 454 682 159 776 688 763 840 770 21 858 981 846 707 648 82 759 471 252 932 85 700 227 861 31 644 929 196 438 283 863 416 832 874 408 81...

result:

ok qwq

Test #25:

score: 0
Accepted
time: 104ms
memory: 34612kb

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 1472 434 2046 2203 1862 303 2755 1651 1009 1611 1401 1077 1718 1980 2078 1448 2284 186 714 738 358 2290 536 1151 459 2104 495 964 802 259 2691 1389 614 941 1094 1325 1463 2030 496 1017 713 1099 419 1393 845 2700 2480 164 1044 753 2333 1329 971 1152 2400 2680 179 2829 360 1936 63 1313 1243 129 1470...

result:

ok qwq

Test #26:

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

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 4798 8012 4674 1989 7613 8423 2710 8161 8639 4787 5086 6454 8272 4360 4188 4185 5069 4938 5216 535 926 8364 8102 4814 6606 827 1342 1374 9153 7529 900 3638 3374 7513 87 4344 1230 2950 6225 9673 9987 8134 8571 3637 8684 1622 586 8071 5627 7986 972 1255 9302 7915 2032 423 6709 1110 2018 2048 42 2245...

result:

ok qwq

Test #27:

score: 0
Accepted
time: 160ms
memory: 39904kb

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 8955 23515 25657 3379 29812 36483 13055 2889 7634 21547 4654 36749 39143 10943 39327 11859 18612 28998 25765 17879 28720 2992 37393 11462 2362 15672 14736 23471 26475 5045 3549 31903 10278 9549 29784 6914 37501 17909 35916 18954 28917 25684 22476 8152 35340 19080 6021 18236 23763 27722 17268 17870...

result:

ok qwq

Test #28:

score: 0
Accepted
time: 230ms
memory: 48900kb

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 16693 8639 33264 48404 77578 26181 34460 21565 67394 99253 20515 12437 26374 1733 71662 57916 68139 31717 32490 14067 93073 74512 48299 88533 78038 12190 40317 73553 26725 60547 46806 74426 46003 5899 77557 39546 97617 58482 3305 3663 64105 49624 14159 9873 49702 81576 65246 74765 29840 61598 2088...

result:

ok qwq

Test #29:

score: 0
Accepted
time: 430ms
memory: 77620kb

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 72763 218502 21282 266016 23393 210887 164843 104714 237160 134479 95048 125134 227775 190221 156875 51936 266984 24193 104519 42732 66876 144147 142214 50550 119844 33295 193559 198718 199020 56328 52836 183798 142957 241962 42100 277922 61383 118149 44909 251059 272421 89893 51636 46022 280678 2...

result:

ok qwq

Test #30:

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

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 540 821 797 594 425 665 345 760 412 961 312 243 589 850 714 12 300 786 415 385 551 868 282 424 484 440 865 464 567 896 427 378 457 971 59 653 81 541 155 799 459 2 787 47 183 1000 13 133 934 593 298 761 916 837 680 842 294 876 396 22 317 616 528 942 230 875 863 676 95 212 171 780 812 204 488 698 19...

result:

ok qwq

Test #31:

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

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 264 596 215 630 483 107 199 621 63 257 75 560 451 249 386 604 401 705 345 597 652 593 565 691 182 322 503 129 5 579 71 357 543 61 566 729 32 146 461 375 458 330 721 273 611 306 619 476 279 574 164 307 186 85 603 150 30 398 716 135 22 206 554 650 444 535 397 516 697 351 130 15 292 268 343 655 51 15...

result:

ok qwq

Test #32:

score: 0
Accepted
time: 97ms
memory: 29220kb

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 704 209 739 312 489 378 452 387 142 530 237 249 445 116 48 63 712 534 718 471 714 366 414 634 280 309 95 611 473 560 709 673 637 270 619 551 487 291 22 394 168 179 405 153 345 601 302 100 640 234 223 441 151 255 38 46 407 730 435 546 188 358 404 418 652 675 623 207 362 69 717 24 630 572 107 413 14...

result:

ok qwq

Test #33:

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

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 282 393 166 340 502 303 286 617 423 490 214 742 136 450 36 455 83 360 87 445 317 468 348 453 659 219 408 5 116 122 295 165 74 469 167 63 160 523 725 451 267 96 723 568 239 493 616 452 319 712 573 296 652 440 263 708 321 246 196 299 392 62 145 2 593 146 247 106 434 354 8 398 135 316 610 48 693 326 ...

result:

ok qwq

Test #34:

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

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 588 742 103 347 148 514 264 100 195 454 177 159 659 545 215 645 731 630 60 499 559 596 533 254 374 536 483 107 548 377 671 270 285 237 610 175 119 84 163 49 156 498 745 335 115 305 699 334 455 646 165 429 462 199 424 621 331 580 625 494 329 732 341 727 75 415 63 257 560 278 488 235 584 638 598 67 ...

result:

ok qwq

Test #35:

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

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 548 377 699 334 646 165 605 749 326 572 411 246 352 233 595 739 291 332 164 307 678 145 722 308 206 430 713 224 518 493 48 481 456 692 489 124 181 741 422 690 435 740 123 450 418 366 720 497 371 105 724 730 362 660 288 33 426 142 577 339 196 73 203 197 700 325 480 505 28 532 693 262 433 363 70 228...

result:

ok qwq

Test #36:

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

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 286 299 239 12 740 207 684 374 251 236 749 101 209 660 88 338 437 267 350 342 604 550 29 124 613 25 339 232 324 654 510 605 241 650 89 581 614 220 271 501 227 225 743 727 93 601 472 508 365 249 551 445 430 438 19 718 493 262 331 131 530 22 343 6 141 384 230 367 528 460 282 159 82 557 109 266 631 4...

result:

ok qwq

Test #37:

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

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 519 668 432 629 159 229 643 330 153 122 610 178 491 488 261 410 672 581 531 7 263 739 242 476 386 9 37 236 35 515 203 264 108 180 310 674 702 171 208 654 87 413 245 415 516 53 349 193 631 433 116 353 93 267 603 681 364 334 523 478 508 700 614 618 620 511 149 235 362 272 484 677 110 528 652 367 445...

result:

ok qwq

Test #38:

score: 0
Accepted
time: 104ms
memory: 29040kb

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 251 248 705 280 747 713 418 3 97 634 624 305 368 315 473 565 361 64 379 286 275 558 625 627 485 688 644 743 120 595 697 722 613 241 91 518 390 266 472 285 2 503 104 721 365 16 354 554 636 269 621 616 456 51 673 474 206 327 284 575 392 522 422 640 290 514 168 88 233 419 583 689 727 274 391 42 454 4...

result:

ok qwq

Test #39:

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

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 272 1070 1270 771 613 528 595 1499 426 886 452 154 1127 1498 1304 1055 687 708 949 696 1119 451 26 155 334 239 777 1296 157 976 1488 1123 553 523 1359 545 550 887 524 369 1341 1199 1434 651 1477 111 347 612 1280 390 1259 740 609 1473 407 643 1144 1048 1447 1241 907 405 588 1009 640 1391 458 1294 1...

result:

ok qwq

Test #40:

score: 0
Accepted
time: 125ms
memory: 32876kb

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 884 119 1308 1000 887 908 234 567 699 427 1419 254 846 362 822 902 971 1352 544 1018 1337 1070 1043 1357 1322 127 1478 1141 523 645 549 843 620 202 81 990 799 1230 1435 1176 641 946 853 907 438 398 462 1105 62 540 596 715 521 893 700 988 1116 698 1457 447 867 927 1273 458 425 666 859 487 930 869 7...

result:

ok qwq

Test #41:

score: 0
Accepted
time: 90ms
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 251 705 248 280 713 747 974 3 97 634 305 856 989 368 473 924 286 275 379 797 64 625 485 688 957 969 120 595 862 697 565 722 241 91 390 926 518 472 503 104 884 794 285 923 258 365 361 16 613 354 554 636 616 456 959 370 877 474 950 284 863 360 206 575 290 514 928 168 422 88 233 419 769 583 689 727 2...

result:

ok qwq

Test #42:

score: 0
Accepted
time: 88ms
memory: 28400kb

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 169 594 248 357 364 305 702 614 561 101 222 436 650 604 72 69 216 534 438 494 100 595 39 209 159 257 198 204 172 526 14 450 629 543 750 353 359 182 669 117 95 374 285 287 366 351 177 373 389 621 563 260 639 264 565 635 414 721 44 12 255 392 716 531 126 149 48 111 254 518 439 458 62 429 237 64 453 ...

result:

ok qwq

Test #43:

score: 0
Accepted
time: 98ms
memory: 29744kb

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 812 621 149 826 369 830 3 348 730 647 26 58 806 368 701 411 563 804 682 355 728 364 796 374 744 337 898 171 681 882 993 934 750 393 922 190 970 593 712 810 955 141 710 261 109 614 182 498 326 554 132 977 523 313 803 813 569 134 693 372 521 923 921 311 663 241 729 447 57 329 582 225 838 330 325 896...

result:

ok qwq

Test #44:

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

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 293 362 92 236 374 336 223 647 634 409 164 120 191 462 393 183 356 454 189 422 665 4 193 360 402 525 315 585 413 646 408 308 684 271 632 509 535 67 319 306 569 542 700 382 109 346 9 407 192 625 608 669 438 582 335 143 87 52 561 290 156 147 124 111 580 502 547 658 177 32 173 224 330 14 59 348 568 2...

result:

ok qwq

Test #45:

score: 0
Accepted
time: 88ms
memory: 29840kb

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 908 749 26 141 243 234 996 913 247 303 741 382 621 474 911 784 329 887 631 767 308 902 550 117 653 641 509 523 249 25 115 685 989 199 387 401 74 534 217 666 462 294 43 780 740 137 437 777 522 629 497 605 214 535 531 354 166 121 476 788 446 924 717 420 337 467 586 3 212 19 746 225 305 41 543 559 67...

result:

ok qwq

Test #46:

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

input:

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

output:

1 3 5 2 4 

result:

ok qwq

Test #47:

score: 0
Accepted
time: 381ms
memory: 63092kb

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 33016 77647 9070 179834 195524 164082 192598 112318 169397 118107 192444 198755 67791 35709 11007 56934 94604 36314 186087 86224 22716 80524 108102 8335 47505 184628 40103 130665 82271 52896 107149 137745 96942 7772 25751 75929 98167 20425 67551 91259 136386 147559 168896 182689 99700 83248 190416...

result:

ok qwq

Test #48:

score: 0
Accepted
time: 410ms
memory: 77500kb

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 75320 258278 50459 191994 187643 207282 63261 23269 136535 52123 53779 91468 238369 172145 25589 44472 108903 159541 236336 173115 258119 72034 149159 249526 9987 57433 124026 143714 175626 44710 56698 15781 270547 260258 212555 67260 79952 59635 124524 165017 155255 263432 144394 124056 117125 17...

result:

ok qwq

Test #49:

score: 0
Accepted
time: 376ms
memory: 55824kb

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 126942 21983 98288 111731 28808 101180 99363 25925 29170 73008 137353 32878 146476 54813 145160 97132 139124 41906 86370 58845 15093 107284 148914 140231 59342 35468 59214 125097 133444 13923 134875 148197 74269 55038 28492 107446 18774 31055 84971 16178 59591 81787 117568 26537 75274 55124 108577...

result:

ok qwq

Test #50:

score: 0
Accepted
time: 354ms
memory: 42852kb

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 37493 4616 37976 16531 48692 46663 39447 59826 55733 10506 4640 11739 51377 32869 18778 38124 33495 1137 50683 53189 24383 5673 39168 39814 19051 42310 40742 59325 58085 16441 43171 7705 27555 6264 28984 52562 4072 55537 1693 39141 27728 3987 12316 26835 48818 51351 49673 875 52221 14462 31724 141...

result:

ok qwq

Test #51:

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

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 1279 9612 13877 3449 12177 8800 10082 7091 10581 2795 5997 3343 3680 7317 7269 4142 138 12672 9686 7223 7542 11951 9352 3614 11033 11944 9261 9111 1565 13590 9973 14574 6944 3077 2023 13346 1121 3592 10684 6655 8508 12288 344 1931 2698 4227 6441 2087 2010 12264 6807 12125 6096 4600 7573 3269 14903...

result:

ok qwq

Test #52:

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

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 164343 118336 20698 87625 121236 112501 196050 43231 107893 163120 159019 86222 119127 19472 26148 90114 76017 95447 42674 96377 80965 59679 15983 129181 96218 45443 82388 11908 19459 83934 157125 77846 176155 133519 73764 132513 157603 37010 133172 78922 46544 71197 12509 146448 7945 9622 97364 8...

result:

ok qwq

Test #53:

score: 0
Accepted
time: 372ms
memory: 63036kb

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 191659 99643 153119 79308 136170 186922 70495 145408 136341 143075 121542 138706 26943 89332 173509 192058 195900 169130 1060 118144 44971 63284 180711 11334 7476 7010 70677 24654 182991 41058 100764 85918 45088 4044 124293 138842 65076 33146 55204 113937 60555 148313 75629 197337 166480 70556 164...

result:

ok qwq

Test #54:

score: 0
Accepted
time: 356ms
memory: 77540kb

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 160867 61307 266608 222607 154166 239091 214874 102088 164179 35409 58237 220847 170227 224539 69610 294904 265354 150355 245216 52473 270447 215906 28304 32292 23629 114213 149720 153658 197633 195317 37713 229208 247732 170970 203150 264084 34861 47866 183338 269438 166347 146943 130757 41349 19...

result:

ok qwq

Test #55:

score: 0
Accepted
time: 501ms
memory: 74500kb

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 13588 231688 177556 233418 184064 253761 55540 172936 171131 119458 121505 123217 184909 265666 202475 56322 222060 226074 105312 212515 223044 139212 192438 7225 247685 80112 125231 99574 239139 108823 33585 12987 40409 60434 230580 197105 89004 261931 215931 47490 222562 271168 255311 250636 211...

result:

ok qwq

Test #56:

score: 0
Accepted
time: 203ms
memory: 29796kb

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 227 134 173 534 513 811 709 511 28 212 910 800 941 39 872 916 793 390 356 459 716 873 668 246 636 686 333 51 294 275 714 845 586 754 545 682 874 403 78 429 184 973 67 87 223 216 268 355 962 810 407 270 940 728 775 68 159 265 434 699 424 52 426 768 891 487 470 698 127 731 201 794 556 354 182 338 50...

result:

ok qwq

Test #57:

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

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 436 799 893 844 323 626 231 906 331 830 150 776 309 956 726 647 74 359 189 915 101 296 605 574 66 6 129 571 651 578 431 930 997 55 325 704 650 253 932 820 512 740 255 792 224 79 664 468 482 448 99 467 341 562 528 156 191 210 917 770 692 370 982 123 826 500 866 690 217 842 999 881 847 252 165 850 5...

result:

ok qwq

Test #58:

score: 0
Accepted
time: 267ms
memory: 34532kb

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 1541 164 1733 1773 2036 945 2049 86 984 1256 1380 1200 621 2078 2280 1515 1112 1395 578 1984 1065 332 1994 2172 2214 1723 2154 1764 214 302 1965 79 752 987 2037 1525 1438 4 554 1790 1300 1864 14 90 1527 1057 545 624 820 1671 1090 87 672 441 610 812 1548 492 541 1859 2309 1767 1589 2223 2150 2091 1...

result:

ok qwq

Test #59:

score: 0
Accepted
time: 297ms
memory: 39152kb

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 9632 6350 15966 32385 19169 3949 20393 21123 16016 18205 23378 37005 33950 33628 6525 39968 4530 1138 12779 25002 39257 40943 17218 4425 21289 14391 27496 10916 34987 38579 36592 14831 24244 39308 29441 40075 10625 14991 14652 32208 24172 5681 17957 22367 9062 17082 12230 12917 5773 11087 10398 36...

result:

ok qwq

Test #60:

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

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 44381 29438 91764 45777 19164 16029 5274 69309 53785 22844 53981 55043 21452 70772 48069 15773 25226 58563 52591 41125 17615 73977 68524 9031 96749 10624 51783 92494 47241 2039 5316 86030 13276 43738 12584 54496 21340 35201 31580 1240 30207 80042 16770 10543 70809 95314 39264 66195 38869 84979 349...

result:

ok qwq

Test #61:

score: 0
Accepted
time: 358ms
memory: 49012kb

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 42069 98898 89451 43465 16852 11221 15891 66996 51473 51669 42344 52731 68459 45757 3168 22914 56251 15303 50279 7737 98932 66211 27400 17675 94436 49471 90181 7120 15659 19920 83717 41426 19028 8231 52184 32889 99732 27895 26684 7724 77729 30930 39407 68496 93001 43768 63883 32626 82666 47196 234...

result:

ok qwq

Test #62:

score: 0
Accepted
time: 402ms
memory: 56096kb

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 85430 105173 114191 146170 23426 52905 15132 138978 42813 70346 77335 69316 55061 34000 102688 114696 77384 110976 78530 56545 53506 112987 96165 96988 129900 86382 97564 121818 82409 68868 82441 116701 19376 130443 93397 109133 18735 11118 27222 122106 101905 73633 74383 143262 131092 135988 1000...

result:

ok qwq

Test #63:

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

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 580 213 31 537 94 704 263 360 271 597 590 546 125 547 454 140 294 353 697 669 373 515 752 237 293 378 555 428 4 698 439 744 146 370 298 516 522 191 324 54 681 741 637 249 465 247 344 615 81 481 173 711 336 568 143 616 579 302 650 538 448 585 676 394 501 618 280 445 42 313 606 602 75 248 456 111 51...

result:

ok qwq