QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426229#7278. Brought Down the Grading Server?Kevin5307100 ✓1442ms75728kbC++232.3kb2024-05-30 23:28:322024-05-30 23:28:32

Judging History

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

  • [2024-05-30 23:28:32]
  • 评测
  • 测评结果:100
  • 用时:1442ms
  • 内存:75728kb
  • [2024-05-30 23:28:32]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
vector<vector<int>> ans;
int t;
vector<pii> G[100100];
map<int,int> vis;
vector<pii> res;
int deg[100100];
bool refresh(int x)
{
	while(sz(G[x])&&vis[G[x].back().second])
		G[x].pop_back();
	return sz(G[x]);
}
void dfs(int x)
{
	while(refresh(x))
	{
		int ind=G[x].back().second;
		int y=G[x].back().first;
		res[ind]=mp(x,y);
		deg[x]--;
		deg[y]--;
		vis[ind]=1;
		dfs(y);
		return ;
	}
}
vector<pii> solve(vector<pii> vec)
{
	res.resize(sz(vec));
	vis.clear();
	vector<int> node;
	for(auto pr:vec)
	{
		node.pb(pr.first);
		node.pb(pr.second);
		deg[pr.first]++;
		deg[pr.second]++;
	}
	srt(node);
	uni(node);
	for(int i=0;i<sz(vec);i++)
	{
		G[vec[i].first].pb(vec[i].second,i);
		G[vec[i].second].pb(vec[i].first,i);
	}
	for(auto x:node)
		if(deg[x]&1)
			dfs(x);
	for(auto x:node)
		while(refresh(x))
			dfs(x);
	return res;
}
void solve(vector<vector<int>> vec)
{
	int n=sz(vec),s=sz(vec[0]);
	if(s==1)
	{
		for(int i=0;i<n;i++)
			ans[i].pb(vec[i][0]);
		return ;
	}
	vector<pii> tmp;
	for(int i=0;i<n;i++)
		for(int j=0;j<s;j+=2)
			tmp.pb(vec[i][j],vec[i][j+1]);
	tmp=solve(tmp);
	vector<vector<int>> vl(n),vr(n);
	for(int i=0;i<n;i++)
		for(int j=0;j<s/2;j++)
		{
			vl[i].pb(tmp[i*(s/2)+j].first);
			vr[i].pb(tmp[i*(s/2)+j].second);
		}
	solve(vl);
	solve(vr);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,s;
	cin>>n>>s>>t;
	vector<vector<int>> vec(n,vector<int>(s));
	ans.resize(n);
	for(auto &arr:vec)
		for(auto &x:arr)
			cin>>x;
	solve(vec);
	for(auto arr:ans)
	{
		for(auto x:arr)
			cout<<x<<" ";
		cout<<'\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
3 2 
2 3 

result:

ok 

Test #2:

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

input:

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

output:

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

result:

ok 

Test #3:

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

input:

20 2 12
12 11
1 9
12 12
3 4
3 9
8 3
8 11
10 9
4 3
6 7
11 6
11 3
7 10
12 10
11 10
11 11
11 2
1 12
6 12
2 7

output:

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

result:

ok 

Test #4:

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

input:

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

output:

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

result:

ok 

Test #5:

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

input:

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

output:

13 1 
4 14 
14 13 
1 17 
8 15 
14 5 
3 7 
20 6 
1 9 
11 19 
6 20 
13 11 

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

input:

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

output:

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

result:

ok 

Subtask #2:

score: 15
Accepted

Test #8:

score: 15
Accepted
time: 143ms
memory: 49304kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
63612 53683 
78264 70370 
76881 42647 
31741 39251 
66491 61186 
57686 65819 
53278 59145 
26052 71962 
55279 81040 
50859 51310 
46800 24546 
85013 91165 
21890 61530 
84003 29099 
86182 33573 
10639 49212 
97312 91851 
57682 14067 
69674 5243 
62508 99007 
26...

result:

ok 

Test #9:

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

input:

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

output:

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

result:

ok 

Test #10:

score: 0
Accepted
time: 84ms
memory: 52508kb

input:

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

output:

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

result:

ok 

Test #11:

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

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

59126 27085 
75021 23663 
67175 78883 
90698 3919 
67504 20718 
49374 44011 
1660 3236 
71971 79270 
24502 90540 
54202 9732 
88659 14395 
52635 56600 
21912 17986 
56526 92420 
40254 3472 
64330 20431 
9381 56003 
57750 45529 
45230 9388 
83797 53437 
75562 47526 
45219 63126 
87437 71020 
50298 20...

result:

ok 

Test #12:

score: 0
Accepted
time: 121ms
memory: 46632kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

13223 16598 
18759 19981 
8681 2642 
18080 4102 
16749 11473 
15290 690 
16229 17900 
10684 17481 
12171 6328 
9417 1150 
5689 7185 
17102 10346 
17958 9727 
13756 2117 
13157 10955 
2840 245 
5257 5337 
6429 16622 
17516 10772 
13007 19349 
2821 11359 
14341 8897 
2482 3974 
16241 17966 
15458 1814...

result:

ok 

Test #13:

score: 0
Accepted
time: 68ms
memory: 48556kb

input:

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

output:

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

result:

ok 

Test #14:

score: 0
Accepted
time: 111ms
memory: 51848kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

25002 53479 
63606 53479 
40735 53479 
83340 53479 
40775 53479 
11458 53479 
53479 8684 
60405 53479 
45116 53479 
67722 53479 
26014 53479 
87860 53479 
55147 53479 
22726 53479 
67769 53479 
129 53479 
14600 53479 
21514 53479 
32164 53479 
60088 53479 
25415 53479 
70946 53479 
27091 53479 
3338...

result:

ok 

Test #15:

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

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
79073 63660 
20397 41795 
84311 1296 
21178 3690 
21052 31611 
14323 51423 
82468 34208 
83835 2785 
28274 50594 
59957 10993 
34259 64334 
89407 73934 
14947 61083 
89472 53201 
61243 33351 
76632 58718 
67464 85318 
54224 45096 
76529 84552 
30697 44253 
3108 43669 
26489 64691 
85776 ...

result:

ok 

Test #16:

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

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

80944 83824 
26621 25208 
28836 57146 
43915 18169 
59242 47842 
78881 34224 
38791 20722 
91046 89723 
72800 40306 
94906 92681 
7263 41151 
13332 76035 
38800 93928 
86055 97168 
73623 44186 
68071 7391 
20692 72265 
44111 42596 
77687 36037 
64592 836 
43568 35187 
88539 34861 
22111 37477 
98028...

result:

ok 

Test #17:

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

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

92592 91980 
12359 10704 
35873 56718 
28601 20301 
55548 78422 
74736 59974 
29025 81664 
70432 55916 
47381 34185 
56168 31764 
33997 30947 
70076 9029 
67057 52532 
99273 79680 
56704 54410 
45238 71652 
6894 12615 
66478 78041 
5451 40520 
5950 58133 
70551 89237 
97551 36028 
90630 83553 
33690...

result:

ok 

Test #18:

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

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457 
40457 80634 
49074 21580 
92701 14354 
44540 70461 
47132 47637 
84954 27979 
87556 60683 
43063 22633 
63643 49914 
4494 3571 
53632 88758 
17055 50019 
49334 79039 
67659 50111 
17945 48061 
60323 84596 
72033 14629 
77184 30069 
64209 36217 
49947 35279 
44707 45866 
58484 58146 
139...

result:

ok 

Subtask #3:

score: 5
Accepted

Dependency #2:

100%
Accepted

Test #19:

score: 5
Accepted
time: 162ms
memory: 49528kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
63612 53683 
78264 70370 
76881 42647 
31741 39251 
66491 61186 
57686 65819 
53278 59145 
26052 71962 
55279 81040 
50859 51310 
46800 24546 
85013 91165 
21890 61530 
84003 29099 
86182 33573 
10639 49212 
97312 91851 
57682 14067 
69674 5243 
62508 99007 
26...

result:

ok 

Test #20:

score: 0
Accepted
time: 85ms
memory: 52652kb

input:

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

output:

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

result:

ok 

Test #21:

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

input:

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

output:

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

result:

ok 

Test #22:

score: 0
Accepted
time: 144ms
memory: 48384kb

input:

100000 2 100000
47641 2360
32311 27712
96580 5576
74432 69601
5497 90724
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
35990 98338
39222 14744
65183 72902
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
65669 53200
74170 53434
44590 79062
45816 66321
37251 32926
26433 58003
...

output:

2360 47641 
27712 32311 
5576 96580 
69601 74432 
5497 90724 
61408 72215 
23207 86499 
29593 43465 
20236 49534 
95890 83680 
35990 98338 
14744 39222 
65183 72902 
73553 76527 
40936 27695 
96356 68239 
66861 20211 
59817 9499 
53200 65669 
53434 74170 
44590 79062 
66321 45816 
32926 37251 
26433...

result:

ok 

Test #23:

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

input:

99000 2 100
50 76
35 53
70 8
48 61
12 98
81 72
62 87
10 6
61 83
63 42
66 10
7 46
35 66
47 52
30 60
70 33
27 16
32 82
8 28
85 83
95 21
63 84
47 57
89 86
73 69
52 60
72 78
78 61
61 36
3 73
31 50
47 20
69 28
74 34
100 79
99 56
51 43
86 15
38 28
3 94
63 76
19 56
31 90
79 97
3 23
14 44
78 63
99 85
14 50
...

output:

50 76 
53 35 
70 8 
48 61 
12 98 
81 72 
62 87 
6 10 
61 83 
42 63 
10 66 
46 7 
66 35 
52 47 
30 60 
33 70 
16 27 
32 82 
8 28 
83 85 
21 95 
63 84 
47 57 
89 86 
69 73 
60 52 
78 72 
61 78 
36 61 
73 3 
31 50 
20 47 
69 28 
34 74 
79 100 
56 99 
43 51 
86 15 
28 38 
3 94 
76 63 
19 56 
90 31 
97 7...

result:

ok 

Test #24:

score: 0
Accepted
time: 139ms
memory: 45984kb

input:

99000 2 40000
13317 12923
15159 469
15225 23585
11180 1824
7967 39735
13852 38886
33137 27292
21697 28740
9887 13116
25732 33405
9156 39496
24569 31286
12900 32138
2345 1862
18626 2824
19382 25016
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
39650 14279
8842 1957
15206 22521
1...

output:

13317 12923 
469 15159 
15225 23585 
11180 1824 
7967 39735 
38886 13852 
33137 27292 
28740 21697 
9887 13116 
25732 33405 
9156 39496 
24569 31286 
12900 32138 
2345 1862 
18626 2824 
19382 25016 
11342 18721 
296 10236 
8228 37626 
10247 30418 
29998 33581 
21676 4543 
39650 14279 
8842 1957 
152...

result:

ok 

Test #25:

score: 0
Accepted
time: 117ms
memory: 49356kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

59126 27085 
75021 23663 
67175 78883 
90698 3919 
67504 20718 
49374 44011 
1660 3236 
71971 79270 
24502 90540 
54202 9732 
88659 14395 
52635 56600 
21912 17986 
56526 92420 
40254 3472 
64330 20431 
9381 56003 
57750 45529 
45230 9388 
83797 53437 
75562 47526 
45219 63126 
87437 71020 
50298 20...

result:

ok 

Test #26:

score: 0
Accepted
time: 121ms
memory: 46672kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

13223 16598 
18759 19981 
8681 2642 
18080 4102 
16749 11473 
15290 690 
16229 17900 
10684 17481 
12171 6328 
9417 1150 
5689 7185 
17102 10346 
17958 9727 
13756 2117 
13157 10955 
2840 245 
5257 5337 
6429 16622 
17516 10772 
13007 19349 
2821 11359 
14341 8897 
2482 3974 
16241 17966 
15458 1814...

result:

ok 

Test #27:

score: 0
Accepted
time: 71ms
memory: 50532kb

input:

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

output:

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

result:

ok 

Test #28:

score: 0
Accepted
time: 111ms
memory: 52024kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

25002 53479 
63606 53479 
40735 53479 
83340 53479 
40775 53479 
11458 53479 
53479 8684 
60405 53479 
45116 53479 
67722 53479 
26014 53479 
87860 53479 
55147 53479 
22726 53479 
67769 53479 
129 53479 
14600 53479 
21514 53479 
32164 53479 
60088 53479 
25415 53479 
70946 53479 
27091 53479 
3338...

result:

ok 

Test #29:

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

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
79073 63660 
20397 41795 
84311 1296 
21178 3690 
21052 31611 
14323 51423 
82468 34208 
83835 2785 
28274 50594 
59957 10993 
34259 64334 
89407 73934 
14947 61083 
89472 53201 
61243 33351 
76632 58718 
67464 85318 
54224 45096 
76529 84552 
30697 44253 
3108 43669 
26489 64691 
85776 ...

result:

ok 

Test #30:

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

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

80944 83824 
26621 25208 
28836 57146 
43915 18169 
59242 47842 
78881 34224 
38791 20722 
91046 89723 
72800 40306 
94906 92681 
7263 41151 
13332 76035 
38800 93928 
86055 97168 
73623 44186 
68071 7391 
20692 72265 
44111 42596 
77687 36037 
64592 836 
43568 35187 
88539 34861 
22111 37477 
98028...

result:

ok 

Test #31:

score: 0
Accepted
time: 118ms
memory: 52680kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

92592 91980 
12359 10704 
35873 56718 
28601 20301 
55548 78422 
74736 59974 
29025 81664 
70432 55916 
47381 34185 
56168 31764 
33997 30947 
70076 9029 
67057 52532 
99273 79680 
56704 54410 
45238 71652 
6894 12615 
66478 78041 
5451 40520 
5950 58133 
70551 89237 
97551 36028 
90630 83553 
33690...

result:

ok 

Test #32:

score: 0
Accepted
time: 116ms
memory: 52628kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457 
40457 80634 
49074 21580 
92701 14354 
44540 70461 
47132 47637 
84954 27979 
87556 60683 
43063 22633 
63643 49914 
4494 3571 
53632 88758 
17055 50019 
49334 79039 
67659 50111 
17945 48061 
60323 84596 
72033 14629 
77184 30069 
64209 36217 
49947 35279 
44707 45866 
58484 58146 
139...

result:

ok 

Subtask #4:

score: 5
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #33:

score: 5
Accepted
time: 1ms
memory: 3572kb

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
3 2 
2 3 

result:

ok 

Test #34:

score: 0
Accepted
time: 128ms
memory: 45124kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

13223 16598 
18759 19981 
8681 2642 
18080 4102 
16749 11473 
15290 690 
16229 17900 
10684 17481 
12171 6328 
9417 1150 
5689 7185 
17102 10346 
17958 9727 
13756 2117 
13157 10955 
2840 245 
5257 5337 
6429 16622 
17516 10772 
13007 19349 
2821 11359 
14341 8897 
2482 3974 
16241 17966 
15458 1814...

result:

ok 

Test #35:

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

input:

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

output:

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

result:

ok 

Test #36:

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

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

25002 53479 
63606 53479 
40735 53479 
83340 53479 
40775 53479 
11458 53479 
53479 8684 
60405 53479 
45116 53479 
67722 53479 
26014 53479 
87860 53479 
55147 53479 
22726 53479 
67769 53479 
129 53479 
14600 53479 
21514 53479 
32164 53479 
60088 53479 
25415 53479 
70946 53479 
27091 53479 
3338...

result:

ok 

Test #37:

score: 0
Accepted
time: 151ms
memory: 50020kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
79073 63660 
20397 41795 
84311 1296 
21178 3690 
21052 31611 
14323 51423 
82468 34208 
83835 2785 
28274 50594 
59957 10993 
34259 64334 
89407 73934 
14947 61083 
89472 53201 
61243 33351 
76632 58718 
67464 85318 
54224 45096 
76529 84552 
30697 44253 
3108 43669 
26489 64691 
85776 ...

result:

ok 

Test #38:

score: 0
Accepted
time: 130ms
memory: 47880kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

80944 83824 
26621 25208 
28836 57146 
43915 18169 
59242 47842 
78881 34224 
38791 20722 
91046 89723 
72800 40306 
94906 92681 
7263 41151 
13332 76035 
38800 93928 
86055 97168 
73623 44186 
68071 7391 
20692 72265 
44111 42596 
77687 36037 
64592 836 
43568 35187 
88539 34861 
22111 37477 
98028...

result:

ok 

Test #39:

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

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

92592 91980 
12359 10704 
35873 56718 
28601 20301 
55548 78422 
74736 59974 
29025 81664 
70432 55916 
47381 34185 
56168 31764 
33997 30947 
70076 9029 
67057 52532 
99273 79680 
56704 54410 
45238 71652 
6894 12615 
66478 78041 
5451 40520 
5950 58133 
70551 89237 
97551 36028 
90630 83553 
33690...

result:

ok 

Test #40:

score: 0
Accepted
time: 111ms
memory: 52512kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457 
40457 80634 
49074 21580 
92701 14354 
44540 70461 
47132 47637 
84954 27979 
87556 60683 
43063 22633 
63643 49914 
4494 3571 
53632 88758 
17055 50019 
49334 79039 
67659 50111 
17945 48061 
60323 84596 
72033 14629 
77184 30069 
64209 36217 
49947 35279 
44707 45866 
58484 58146 
139...

result:

ok 

Test #41:

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

input:

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

output:

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

result:

ok 

Test #42:

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

input:

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

output:

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

result:

ok 

Test #43:

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

input:

100000 2 100000
47641 2360
32311 27712
96580 5576
74432 69601
5497 90724
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
35990 98338
39222 14744
65183 72902
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
65669 53200
74170 53434
44590 79062
45816 66321
37251 32926
26433 58003
...

output:

2360 47641 
27712 32311 
5576 96580 
69601 74432 
5497 90724 
61408 72215 
23207 86499 
29593 43465 
20236 49534 
95890 83680 
35990 98338 
14744 39222 
65183 72902 
73553 76527 
40936 27695 
96356 68239 
66861 20211 
59817 9499 
53200 65669 
53434 74170 
44590 79062 
66321 45816 
32926 37251 
26433...

result:

ok 

Test #44:

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

input:

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

output:

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

result:

ok 

Test #45:

score: 0
Accepted
time: 82ms
memory: 48096kb

input:

99000 2 100
50 76
35 53
70 8
48 61
12 98
81 72
62 87
10 6
61 83
63 42
66 10
7 46
35 66
47 52
30 60
70 33
27 16
32 82
8 28
85 83
95 21
63 84
47 57
89 86
73 69
52 60
72 78
78 61
61 36
3 73
31 50
47 20
69 28
74 34
100 79
99 56
51 43
86 15
38 28
3 94
63 76
19 56
31 90
79 97
3 23
14 44
78 63
99 85
14 50
...

output:

50 76 
53 35 
70 8 
48 61 
12 98 
81 72 
62 87 
6 10 
61 83 
42 63 
10 66 
46 7 
66 35 
52 47 
30 60 
33 70 
16 27 
32 82 
8 28 
83 85 
21 95 
63 84 
47 57 
89 86 
69 73 
60 52 
78 72 
61 78 
36 61 
73 3 
31 50 
20 47 
69 28 
34 74 
79 100 
56 99 
43 51 
86 15 
28 38 
3 94 
76 63 
19 56 
90 31 
97 7...

result:

ok 

Test #46:

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

input:

99000 2 40000
13317 12923
15159 469
15225 23585
11180 1824
7967 39735
13852 38886
33137 27292
21697 28740
9887 13116
25732 33405
9156 39496
24569 31286
12900 32138
2345 1862
18626 2824
19382 25016
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
39650 14279
8842 1957
15206 22521
1...

output:

13317 12923 
469 15159 
15225 23585 
11180 1824 
7967 39735 
38886 13852 
33137 27292 
28740 21697 
9887 13116 
25732 33405 
9156 39496 
24569 31286 
12900 32138 
2345 1862 
18626 2824 
19382 25016 
11342 18721 
296 10236 
8228 37626 
10247 30418 
29998 33581 
21676 4543 
39650 14279 
8842 1957 
152...

result:

ok 

Test #47:

score: 0
Accepted
time: 61ms
memory: 27648kb

input:

50000 2 100000
98362 76208
42505 92719
18460 89381
66596 99759
12116 82137
92591 4043
134 72622
43432 47060
48543 74386
24648 12398
15658 30807
44636 99813
53782 10967
99129 43783
31224 17380
1594 90445
4363 11935
83427 79197
57698 64946
55536 76058
25332 10458
66313 31325
77601 43931
23727 27286
38...

output:

76208 98362 
42505 92719 
89381 18460 
66596 99759 
12116 82137 
4043 92591 
134 72622 
47060 43432 
48543 74386 
12398 24648 
15658 30807 
44636 99813 
10967 53782 
43783 99129 
17380 31224 
1594 90445 
11935 4363 
83427 79197 
57698 64946 
55536 76058 
10458 25332 
31325 66313 
77601 43931 
23727 ...

result:

ok 

Test #48:

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

input:

1000 2 90000
23815 25217
6968 45020
4010 7431
26939 4476
2589 64334
32215 84328
8428 78626
15793 9319
30520 48129
73647 7113
69869 35054
2118 65562
13093 15772
66586 74609
2641 56451
80789 47288
35419 63553
4412 70594
45845 37418
71587 74602
19228 59932
53972 84459
7561 23333
29074 12664
26734 61072...

output:

23815 25217 
6968 45020 
4010 7431 
4476 26939 
2589 64334 
32215 84328 
8428 78626 
9319 15793 
30520 48129 
7113 73647 
35054 69869 
2118 65562 
13093 15772 
66586 74609 
2641 56451 
47288 80789 
35419 63553 
4412 70594 
37418 45845 
71587 74602 
19228 59932 
53972 84459 
7561 23333 
12664 29074 
...

result:

ok 

Test #49:

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

input:

20 2 12
12 11
1 9
12 12
3 4
3 9
8 3
8 11
10 9
4 3
6 7
11 6
11 3
7 10
12 10
11 10
11 11
11 2
1 12
6 12
2 7

output:

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

result:

ok 

Test #50:

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

input:

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

output:

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

result:

ok 

Test #51:

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

input:

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

output:

13 1 
4 14 
14 13 
1 17 
8 15 
14 5 
3 7 
20 6 
1 9 
11 19 
6 20 
13 11 

result:

ok 

Test #52:

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

input:

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

output:

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

result:

ok 

Test #53:

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

input:

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

output:

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

result:

ok 

Test #54:

score: 0
Accepted
time: 121ms
memory: 49344kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
63612 53683 
78264 70370 
76881 42647 
31741 39251 
66491 61186 
57686 65819 
53278 59145 
26052 71962 
55279 81040 
50859 51310 
46800 24546 
85013 91165 
21890 61530 
84003 29099 
86182 33573 
10639 49212 
97312 91851 
57682 14067 
69674 5243 
62508 99007 
26...

result:

ok 

Test #55:

score: 0
Accepted
time: 129ms
memory: 49436kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

59126 27085 
75021 23663 
67175 78883 
90698 3919 
67504 20718 
49374 44011 
1660 3236 
71971 79270 
24502 90540 
54202 9732 
88659 14395 
52635 56600 
21912 17986 
56526 92420 
40254 3472 
64330 20431 
9381 56003 
57750 45529 
45230 9388 
83797 53437 
75562 47526 
45219 63126 
87437 71020 
50298 20...

result:

ok 

Subtask #5:

score: 15
Accepted

Test #56:

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

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 3 3 2 
2 2 2 3 

result:

ok 

Test #57:

score: 0
Accepted
time: 8ms
memory: 5396kb

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

2334 540 1156 475 
1328 2439 2421 750 
471 2007 1792 1051 
2269 1776 786 705 
1674 1277 755 1622 
1217 590 1378 603 
1920 239 967 1658 
2307 78 857 1589 
2172 2322 861 1634 
2077 2179 2021 1381 
1547 1126 2126 345 
994 1477 412 1214 
1857 831 2085 978 
2406 1844 281 2174 
1779 521 2334 2254 
1508 19...

result:

ok 

Test #58:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

2 3 2 1 
1429 1 1 1429 
4 7 4 3 
3 1430 3 1430 
1 6 6 5 
5 1431 5 1431 
8 11 8 7 
7 1432 7 1432 
10 5 10 9 
1433 9 9 1433 
12 15 12 11 
11 1434 11 1434 
9 14 14 13 
13 1435 13 1435 
16 19 16 15 
15 1436 15 1436 
18 13 18 17 
1437 17 17 1437 
20 23 20 19 
19 1438 19 1438 
17 22 22 21 
21 1439 21 1439...

result:

ok 

Test #59:

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

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #60:

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

input:

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

output:

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

result:

ok 

Test #61:

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

input:

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

output:

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

result:

ok 

Test #62:

score: 0
Accepted
time: 14ms
memory: 4776kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

26 116 7 123 83 5 12 122 9 114 76 86 36 125 145 95 102 72 128 36 92 151 101 60 80 66 33 29 19 155 89 109 93 123 122 132 140 97 155 3 57 119 62 154 19 14 145 125 55 102 36 125 97 19 62 29 13 109 123 89 104 4 60 89 
113 148 33 84 71 75 4 109 127 13 27 55 154 97 47 93 63 78 150 21 10 25 122 3 93 104 30...

result:

ok 

Test #63:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 8 4 6 6 1 8 1 8 6 4 1 8 6 1 1 4 5 8 6 6 1 8 1 5 6 4 8 8 1 1 1 5 8 4 1 8 6 6 1 5 8 6 1 4 8 6 1 4 5 8 1 6 1 6 1 4 8 6 1 8 1 1 1 8 6 4 1 5 4 8 1 5 8 6 1 4 6 8 1 5 6 8 1 4 1 6 1 8 6 4 1 8 1 6 1 5 4 8 6 6 1 8 1 4 8 6 1 6 8 1 1 5 4 6 1 8 1 8 1 8 6 4 1 6 1 1 1 5 4 6 8 8 6 1 1 4 8 6 1 5 8 6 1 4 8 6 1 5 6 ...

result:

ok 

Test #64:

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

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

967 595 1986 1326 
2187 19 880 173 
1645 1179 961 843 
1225 1102 1566 177 
961 1553 354 1065 
625 611 1814 1276 
572 1097 1110 845 
2041 780 2178 1291 
1138 1531 2390 415 
1649 499 584 1131 
1982 752 1296 754 
2295 1627 1853 498 
1647 1282 1628 974 
2321 1271 265 2097 
2252 123 1776 1161 
723 487 43...

result:

ok 

Test #65:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

2 1 
2 2 
1 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 2 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
1 1 
2 2 
1 1 
2 1 
2 2 
1 2 
1 1 
2 1 
1 1 
2 2 
1 2 
2 1 
1 2 
2 2 
2 1 
2 2 
1 1 
1 2 
2 1 
1 2 
2 1 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
2 2 
2 2 
1 2 
...

result:

ok 

Test #66:

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

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
1208 2674 
4977 2674 
3028 2674 
36 2674 
1712 2674 
3561 2674 
3033 2674 
4699 2674 
1785 2674 
4345 2674 
3302 2674 
2493 2674 
4280 2674 
3999 2674 
4850 2674 
4508 2674 
3742 2674 
2718 2674 
3461 2674 
260 2674 
4223 2674 
2069 2674 
1144 2674 
1975 2674 
527 2674 
3260 2674 
2806 26...

result:

ok 

Test #67:

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

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 317 793 417 
1237 1990 507 1460 
1155 1030 1744 1114 
486 1284 2376 868 
2391 1441 704 665 
1283 1607 173 789 
2192 1309 1045 1466 
734 284 254 766 
1752 1181 1814 937 
1638 2346 1329 1459 
1205 1744 1155 443 
1098 1096 1050 430 
1622 2224 186 930 
2196 1772 1833 1916 
757 739 2066 114 
1180 996...

result:

ok 

Test #68:

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

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

926 833 788 67 830 795 580 861 
701 227 566 768 421 582 113 823 
981 868 494 76 745 910 644 188 
409 742 771 572 210 751 665 875 
151 131 455 298 387 145 442 3 
550 672 118 74 250 694 85 78 
857 855 695 533 944 977 431 807 
787 432 881 615 523 649 789 742 
538 159 114 894 42 29 942 619 
355 558 834 ...

result:

ok 

Test #69:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

161 969 1246 981 374 598 761 131 
257 674 658 837 826 749 119 163 
863 1166 891 929 733 564 802 207 
964 202 400 311 507 314 233 77 
445 1247 376 709 388 1093 408 71 
48 1020 468 19 581 566 966 403 
479 946 1201 730 822 703 132 785 
37 861 188 183 349 1202 18 731 
882 1226 896 648 523 333 614 126 
9...

result:

ok 

Subtask #6:

score: 5
Accepted

Dependency #5:

100%
Accepted

Test #70:

score: 5
Accepted
time: 1ms
memory: 5636kb

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 3 3 2 
2 2 2 3 

result:

ok 

Test #71:

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

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

2334 540 1156 475 
1328 2439 2421 750 
471 2007 1792 1051 
2269 1776 786 705 
1674 1277 755 1622 
1217 590 1378 603 
1920 239 967 1658 
2307 78 857 1589 
2172 2322 861 1634 
2077 2179 2021 1381 
1547 1126 2126 345 
994 1477 412 1214 
1857 831 2085 978 
2406 1844 281 2174 
1779 521 2334 2254 
1508 19...

result:

ok 

Test #72:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

2 3 2 1 
1429 1 1 1429 
4 7 4 3 
3 1430 3 1430 
1 6 6 5 
5 1431 5 1431 
8 11 8 7 
7 1432 7 1432 
10 5 10 9 
1433 9 9 1433 
12 15 12 11 
11 1434 11 1434 
9 14 14 13 
13 1435 13 1435 
16 19 16 15 
15 1436 15 1436 
18 13 18 17 
1437 17 17 1437 
20 23 20 19 
19 1438 19 1438 
17 22 22 21 
21 1439 21 1439...

result:

ok 

Test #73:

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

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #74:

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

input:

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

output:

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

result:

ok 

Test #75:

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

input:

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

output:

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

result:

ok 

Test #76:

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

input:

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

output:

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

result:

ok 

Test #77:

score: 0
Accepted
time: 8ms
memory: 5464kb

input:

2500 4 2500
648 780 1555 2479
544 2007 2025 186
2208 783 346 2150
462 975 240 1243
1693 1777 2390 522
1126 1859 505 1731
991 684 1608 751
1605 129 1236 1271
121 1073 2079 409
882 1636 2432 2416
2125 1519 1046 79
315 1906 679 2452
86 669 2191 1467
326 397 286 1986
1299 2409 2259 2166
854 1437 620 330...

output:

648 1555 2479 780 
544 2025 186 2007 
2150 783 346 2208 
462 1243 240 975 
1693 2390 522 1777 
1731 1126 505 1859 
751 684 991 1608 
1236 1605 129 1271 
409 1073 121 2079 
882 2416 1636 2432 
1519 79 1046 2125 
679 1906 315 2452 
86 1467 669 2191 
326 1986 286 397 
1299 2166 2409 2259 
854 620 1437 ...

result:

ok 

Test #78:

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

input:

1250 8 1250
1143 47 853 56 15 316 165 820
768 1167 447 1006 696 621 491 431
301 1068 674 1050 1107 235 256 499
702 264 364 1158 959 489 450 966
972 83 910 399 944 744 202 196
433 893 553 1010 13 847 917 296
199 788 380 1018 442 1066 1064 1059
1206 686 399 975 298 730 439 781
964 398 283 449 241 788 ...

output:

56 165 47 15 1143 820 316 853 
431 447 621 1167 768 491 1006 696 
301 256 674 1107 499 1050 1068 235 
450 1158 264 489 966 702 959 364 
944 910 196 972 83 202 399 744 
296 433 553 13 893 847 1010 917 
199 1059 380 442 788 1066 1064 1018 
686 730 399 439 781 1206 298 975 
788 964 283 788 398 241 449 ...

result:

ok 

Test #79:

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

input:

2500 4 2500
11 34 1064 1548
2120 1668 2 1223
1208 390 12 1204
482 830 1427 2204
312 1940 1551 1432
2282 1122 2271 1334
1702 344 623 224
258 20 288 1335
262 308 1502 992
474 345 2403 2254
1466 930 1281 1642
2151 434 786 1345
64 464 2265 51
2054 274 435 2007
171 867 395 544
1766 358 872 1478
345 474 2...

output:

34 1064 11 1548 
1223 2120 2 1668 
12 390 1204 1208 
830 1427 482 2204 
1551 1940 312 1432 
1334 2282 1122 2271 
224 344 1702 623 
288 258 20 1335 
262 992 308 1502 
474 2254 345 2403 
1281 930 1642 1466 
434 1345 2151 786 
51 64 2265 464 
2007 2054 435 274 
395 867 171 544 
358 872 1766 1478 
345 2...

result:

ok 

Test #80:

score: 0
Accepted
time: 14ms
memory: 6468kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

26 116 7 123 83 5 12 122 9 114 76 86 36 125 145 95 102 72 128 36 92 151 101 60 80 66 33 29 19 155 89 109 93 123 122 132 140 97 155 3 57 119 62 154 19 14 145 125 55 102 36 125 97 19 62 29 13 109 123 89 104 4 60 89 
113 148 33 84 71 75 4 109 127 13 27 55 154 97 47 93 63 78 150 21 10 25 122 3 93 104 30...

result:

ok 

Test #81:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 8 4 6 6 1 8 1 8 6 4 1 8 6 1 1 4 5 8 6 6 1 8 1 5 6 4 8 8 1 1 1 5 8 4 1 8 6 6 1 5 8 6 1 4 8 6 1 4 5 8 1 6 1 6 1 4 8 6 1 8 1 1 1 8 6 4 1 5 4 8 1 5 8 6 1 4 6 8 1 5 6 8 1 4 1 6 1 8 6 4 1 8 1 6 1 5 4 8 6 6 1 8 1 4 8 6 1 6 8 1 1 5 4 6 1 8 1 8 1 8 6 4 1 6 1 1 1 5 4 6 8 8 6 1 1 4 8 6 1 5 8 6 1 4 8 6 1 5 6 ...

result:

ok 

Test #82:

score: 0
Accepted
time: 8ms
memory: 5412kb

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

967 595 1986 1326 
2187 19 880 173 
1645 1179 961 843 
1225 1102 1566 177 
961 1553 354 1065 
625 611 1814 1276 
572 1097 1110 845 
2041 780 2178 1291 
1138 1531 2390 415 
1649 499 584 1131 
1982 752 1296 754 
2295 1627 1853 498 
1647 1282 1628 974 
2321 1271 265 2097 
2252 123 1776 1161 
723 487 43...

result:

ok 

Test #83:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

2 1 
2 2 
1 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 2 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
1 1 
2 2 
1 1 
2 1 
2 2 
1 2 
1 1 
2 1 
1 1 
2 2 
1 2 
2 1 
1 2 
2 2 
2 1 
2 2 
1 1 
1 2 
2 1 
1 2 
2 1 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
2 2 
2 2 
1 2 
...

result:

ok 

Test #84:

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

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
1208 2674 
4977 2674 
3028 2674 
36 2674 
1712 2674 
3561 2674 
3033 2674 
4699 2674 
1785 2674 
4345 2674 
3302 2674 
2493 2674 
4280 2674 
3999 2674 
4850 2674 
4508 2674 
3742 2674 
2718 2674 
3461 2674 
260 2674 
4223 2674 
2069 2674 
1144 2674 
1975 2674 
527 2674 
3260 2674 
2806 26...

result:

ok 

Test #85:

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

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 317 793 417 
1237 1990 507 1460 
1155 1030 1744 1114 
486 1284 2376 868 
2391 1441 704 665 
1283 1607 173 789 
2192 1309 1045 1466 
734 284 254 766 
1752 1181 1814 937 
1638 2346 1329 1459 
1205 1744 1155 443 
1098 1096 1050 430 
1622 2224 186 930 
2196 1772 1833 1916 
757 739 2066 114 
1180 996...

result:

ok 

Test #86:

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

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

926 833 788 67 830 795 580 861 
701 227 566 768 421 582 113 823 
981 868 494 76 745 910 644 188 
409 742 771 572 210 751 665 875 
151 131 455 298 387 145 442 3 
550 672 118 74 250 694 85 78 
857 855 695 533 944 977 431 807 
787 432 881 615 523 649 789 742 
538 159 114 894 42 29 942 619 
355 558 834 ...

result:

ok 

Test #87:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

161 969 1246 981 374 598 761 131 
257 674 658 837 826 749 119 163 
863 1166 891 929 733 564 802 207 
964 202 400 311 507 314 233 77 
445 1247 376 709 388 1093 408 71 
48 1020 468 19 581 566 966 403 
479 946 1201 730 822 703 132 785 
37 861 188 183 349 1202 18 731 
882 1226 896 648 523 333 614 126 
9...

result:

ok 

Subtask #7:

score: 5
Accepted

Dependency #6:

100%
Accepted

Test #88:

score: 5
Accepted
time: 1ms
memory: 3636kb

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 3 3 2 
2 2 2 3 

result:

ok 

Test #89:

score: 0
Accepted
time: 8ms
memory: 5364kb

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

2334 540 1156 475 
1328 2439 2421 750 
471 2007 1792 1051 
2269 1776 786 705 
1674 1277 755 1622 
1217 590 1378 603 
1920 239 967 1658 
2307 78 857 1589 
2172 2322 861 1634 
2077 2179 2021 1381 
1547 1126 2126 345 
994 1477 412 1214 
1857 831 2085 978 
2406 1844 281 2174 
1779 521 2334 2254 
1508 19...

result:

ok 

Test #90:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

2 3 2 1 
1429 1 1 1429 
4 7 4 3 
3 1430 3 1430 
1 6 6 5 
5 1431 5 1431 
8 11 8 7 
7 1432 7 1432 
10 5 10 9 
1433 9 9 1433 
12 15 12 11 
11 1434 11 1434 
9 14 14 13 
13 1435 13 1435 
16 19 16 15 
15 1436 15 1436 
18 13 18 17 
1437 17 17 1437 
20 23 20 19 
19 1438 19 1438 
17 22 22 21 
21 1439 21 1439...

result:

ok 

Test #91:

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

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #92:

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

input:

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

output:

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

result:

ok 

Test #93:

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

input:

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

output:

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

result:

ok 

Test #94:

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

input:

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

output:

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

result:

ok 

Test #95:

score: 0
Accepted
time: 9ms
memory: 5500kb

input:

2500 4 2500
648 780 1555 2479
544 2007 2025 186
2208 783 346 2150
462 975 240 1243
1693 1777 2390 522
1126 1859 505 1731
991 684 1608 751
1605 129 1236 1271
121 1073 2079 409
882 1636 2432 2416
2125 1519 1046 79
315 1906 679 2452
86 669 2191 1467
326 397 286 1986
1299 2409 2259 2166
854 1437 620 330...

output:

648 1555 2479 780 
544 2025 186 2007 
2150 783 346 2208 
462 1243 240 975 
1693 2390 522 1777 
1731 1126 505 1859 
751 684 991 1608 
1236 1605 129 1271 
409 1073 121 2079 
882 2416 1636 2432 
1519 79 1046 2125 
679 1906 315 2452 
86 1467 669 2191 
326 1986 286 397 
1299 2166 2409 2259 
854 620 1437 ...

result:

ok 

Test #96:

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

input:

1250 8 1250
1143 47 853 56 15 316 165 820
768 1167 447 1006 696 621 491 431
301 1068 674 1050 1107 235 256 499
702 264 364 1158 959 489 450 966
972 83 910 399 944 744 202 196
433 893 553 1010 13 847 917 296
199 788 380 1018 442 1066 1064 1059
1206 686 399 975 298 730 439 781
964 398 283 449 241 788 ...

output:

56 165 47 15 1143 820 316 853 
431 447 621 1167 768 491 1006 696 
301 256 674 1107 499 1050 1068 235 
450 1158 264 489 966 702 959 364 
944 910 196 972 83 202 399 744 
296 433 553 13 893 847 1010 917 
199 1059 380 442 788 1066 1064 1018 
686 730 399 439 781 1206 298 975 
788 964 283 788 398 241 449 ...

result:

ok 

Test #97:

score: 0
Accepted
time: 9ms
memory: 5308kb

input:

2500 4 2500
11 34 1064 1548
2120 1668 2 1223
1208 390 12 1204
482 830 1427 2204
312 1940 1551 1432
2282 1122 2271 1334
1702 344 623 224
258 20 288 1335
262 308 1502 992
474 345 2403 2254
1466 930 1281 1642
2151 434 786 1345
64 464 2265 51
2054 274 435 2007
171 867 395 544
1766 358 872 1478
345 474 2...

output:

34 1064 11 1548 
1223 2120 2 1668 
12 390 1204 1208 
830 1427 482 2204 
1551 1940 312 1432 
1334 2282 1122 2271 
224 344 1702 623 
288 258 20 1335 
262 992 308 1502 
474 2254 345 2403 
1281 930 1642 1466 
434 1345 2151 786 
51 64 2265 464 
2007 2054 435 274 
395 867 171 544 
358 872 1766 1478 
345 2...

result:

ok 

Test #98:

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

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
3 2 
2 3 

result:

ok 

Test #99:

score: 0
Accepted
time: 14ms
memory: 4548kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

26 116 7 123 83 5 12 122 9 114 76 86 36 125 145 95 102 72 128 36 92 151 101 60 80 66 33 29 19 155 89 109 93 123 122 132 140 97 155 3 57 119 62 154 19 14 145 125 55 102 36 125 97 19 62 29 13 109 123 89 104 4 60 89 
113 148 33 84 71 75 4 109 127 13 27 55 154 97 47 93 63 78 150 21 10 25 122 3 93 104 30...

result:

ok 

Test #100:

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

input:

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

output:

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

result:

ok 

Test #101:

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

input:

20 2 12
12 11
1 9
12 12
3 4
3 9
8 3
8 11
10 9
4 3
6 7
11 6
11 3
7 10
12 10
11 10
11 11
11 2
1 12
6 12
2 7

output:

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

result:

ok 

Test #102:

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

input:

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

output:

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

result:

ok 

Test #103:

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

input:

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

output:

13 1 
4 14 
14 13 
1 17 
8 15 
14 5 
3 7 
20 6 
1 9 
11 19 
6 20 
13 11 

result:

ok 

Test #104:

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

input:

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

output:

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

result:

ok 

Test #105:

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

input:

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

output:

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

result:

ok 

Test #106:

score: 0
Accepted
time: 21ms
memory: 7428kb

input:

78 128 100000
81808 77744 77980 20344 56544 50739 70835 39983 68165 34656 3072 42835 82535 82728 67410 26960 83125 8567 68716 87268 1041 55994 57260 55232 2311 39201 31839 52222 97649 77452 99484 9817 25951 19307 89403 41701 29144 21015 97490 47889 80786 38025 80518 41671 15279 15331 14598 14750 388...

output:

1041 3038 6989 11423 3072 8223 14413 14598 2311 13035 19307 20263 19500 20344 21831 27780 8567 13160 19232 21015 19722 26960 22413 28260 9817 24377 30768 38025 38811 56770 39983 72373 15279 25807 30384 31839 25161 30001 31796 34656 39136 41701 41130 50739 47154 53954 52468 55232 28172 41671 41572 68...

result:

ok 

Test #107:

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

input:

4 2048 95000
38783 19709 71675 15481 45011 21868 31035 86793 51119 32657 89325 16883 19411 82169 55236 12196 70200 53239 39110 1874 74802 92295 14936 39296 33336 21076 44167 41683 70853 46547 4147 92052 23634 43406 21048 62597 37396 48811 32118 56333 72463 15734 84750 74354 93564 26993 34448 9656 49...

output:

2 110 197 355 44 137 670 1239 191 700 402 1397 720 999 1196 2153 131 728 1236 1244 1132 1506 1861 2267 1368 3161 1680 3246 2954 3496 3312 3619 812 1489 1569 1668 1782 2599 2964 4289 1874 2019 2081 2809 2846 5593 5727 7644 3324 3938 3545 4523 3673 6294 7410 8862 5077 9953 7963 11478 10307 13928 11691...

result:

ok 

Test #108:

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

input:

1250 8 8000
1142 5185 4039 4187 6143 3133 1453 6322
2826 1179 6307 4164 4163 1381 6393 5987
165 7650 2235 6199 1828 7154 1702 6555
1924 5298 6688 3890 2158 6145 6260 1593
6582 7121 595 566 1943 1749 498 4850
1658 2980 77 1807 19 5771 1887 1851
6975 6093 5956 6901 7876 3172 4955 7840
6805 5280 991 89...

output:

1453 4187 1142 6143 3133 4039 5185 6322 
1179 4163 5987 6307 1381 4164 2826 6393 
1828 2235 1702 7650 165 7154 6199 6555 
1593 3890 2158 5298 1924 6145 6260 6688 
595 1749 498 6582 566 4850 1943 7121 
19 1658 1807 1851 77 1887 2980 5771 
4955 6093 3172 6901 5956 7840 6975 7876 
991 1888 6805 7036 40...

result:

ok 

Test #109:

score: 0
Accepted
time: 8ms
memory: 7512kb

input:

1250 8 100000
33559 35032 86872 2746 93799 19407 3978 35031
45242 19554 51244 7095 76508 73954 58274 17339
33768 22747 28465 45940 68882 8649 47192 74009
85827 61438 15635 42263 10935 25322 70609 29138
89239 2604 35343 91233 24911 24596 24352 4723
61239 30122 86493 3193 95509 53433 14784 66391
97818...

output:

2746 3978 19407 33559 35032 35031 86872 93799 
17339 7095 19554 73954 45242 58274 51244 76508 
22747 8649 47192 28465 68882 33768 74009 45940 
25322 15635 61438 29138 10935 42263 70609 85827 
2604 4723 24596 35343 89239 24911 24352 91233 
14784 3193 53433 30122 61239 66391 86493 95509 
8896 6555 519...

result:

ok 

Test #110:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 8 4 6 6 1 8 1 8 6 4 1 8 6 1 1 4 5 8 6 6 1 8 1 5 6 4 8 8 1 1 1 5 8 4 1 8 6 6 1 5 8 6 1 4 8 6 1 4 5 8 1 6 1 6 1 4 8 6 1 8 1 1 1 8 6 4 1 5 4 8 1 5 8 6 1 4 6 8 1 5 6 8 1 4 1 6 1 8 6 4 1 8 1 6 1 5 4 8 6 6 1 8 1 4 8 6 1 6 8 1 1 5 4 6 1 8 1 8 1 8 6 4 1 6 1 1 1 5 4 6 8 8 6 1 1 4 8 6 1 5 8 6 1 4 8 6 1 5 6 ...

result:

ok 

Test #111:

score: 0
Accepted
time: 8ms
memory: 5400kb

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

967 595 1986 1326 
2187 19 880 173 
1645 1179 961 843 
1225 1102 1566 177 
961 1553 354 1065 
625 611 1814 1276 
572 1097 1110 845 
2041 780 2178 1291 
1138 1531 2390 415 
1649 499 584 1131 
1982 752 1296 754 
2295 1627 1853 498 
1647 1282 1628 974 
2321 1271 265 2097 
2252 123 1776 1161 
723 487 43...

result:

ok 

Test #112:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

2 1 
2 2 
1 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 2 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
1 1 
2 2 
1 1 
2 1 
2 2 
1 2 
1 1 
2 1 
1 1 
2 2 
1 2 
2 1 
1 2 
2 2 
2 1 
2 2 
1 1 
1 2 
2 1 
1 2 
2 1 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
2 2 
2 2 
1 2 
...

result:

ok 

Test #113:

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

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
1208 2674 
4977 2674 
3028 2674 
36 2674 
1712 2674 
3561 2674 
3033 2674 
4699 2674 
1785 2674 
4345 2674 
3302 2674 
2493 2674 
4280 2674 
3999 2674 
4850 2674 
4508 2674 
3742 2674 
2718 2674 
3461 2674 
260 2674 
4223 2674 
2069 2674 
1144 2674 
1975 2674 
527 2674 
3260 2674 
2806 26...

result:

ok 

Test #114:

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

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 317 793 417 
1237 1990 507 1460 
1155 1030 1744 1114 
486 1284 2376 868 
2391 1441 704 665 
1283 1607 173 789 
2192 1309 1045 1466 
734 284 254 766 
1752 1181 1814 937 
1638 2346 1329 1459 
1205 1744 1155 443 
1098 1096 1050 430 
1622 2224 186 930 
2196 1772 1833 1916 
757 739 2066 114 
1180 996...

result:

ok 

Test #115:

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

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

926 833 788 67 830 795 580 861 
701 227 566 768 421 582 113 823 
981 868 494 76 745 910 644 188 
409 742 771 572 210 751 665 875 
151 131 455 298 387 145 442 3 
550 672 118 74 250 694 85 78 
857 855 695 533 944 977 431 807 
787 432 881 615 523 649 789 742 
538 159 114 894 42 29 942 619 
355 558 834 ...

result:

ok 

Test #116:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

161 969 1246 981 374 598 761 131 
257 674 658 837 826 749 119 163 
863 1166 891 929 733 564 802 207 
964 202 400 311 507 314 233 77 
445 1247 376 709 388 1093 408 71 
48 1020 468 19 581 566 966 403 
479 946 1201 730 822 703 132 785 
37 861 188 183 349 1202 18 731 
882 1226 896 648 523 333 614 126 
9...

result:

ok 

Subtask #8:

score: 20
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Test #117:

score: 20
Accepted
time: 141ms
memory: 49296kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
63612 53683 
78264 70370 
76881 42647 
31741 39251 
66491 61186 
57686 65819 
53278 59145 
26052 71962 
55279 81040 
50859 51310 
46800 24546 
85013 91165 
21890 61530 
84003 29099 
86182 33573 
10639 49212 
97312 91851 
57682 14067 
69674 5243 
62508 99007 
26...

result:

ok 

Test #118:

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

input:

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

output:

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

result:

ok 

Test #119:

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

input:

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

output:

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

result:

ok 

Test #120:

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

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 3 3 2 
2 2 2 3 

result:

ok 

Test #121:

score: 0
Accepted
time: 9ms
memory: 4476kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

26 116 7 123 83 5 12 122 9 114 76 86 36 125 145 95 102 72 128 36 92 151 101 60 80 66 33 29 19 155 89 109 93 123 122 132 140 97 155 3 57 119 62 154 19 14 145 125 55 102 36 125 97 19 62 29 13 109 123 89 104 4 60 89 
113 148 33 84 71 75 4 109 127 13 27 55 154 97 47 93 63 78 150 21 10 25 122 3 93 104 30...

result:

ok 

Test #122:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 8 4 6 6 1 8 1 8 6 4 1 8 6 1 1 4 5 8 6 6 1 8 1 5 6 4 8 8 1 1 1 5 8 4 1 8 6 6 1 5 8 6 1 4 8 6 1 4 5 8 1 6 1 6 1 4 8 6 1 8 1 1 1 8 6 4 1 5 4 8 1 5 8 6 1 4 6 8 1 5 6 8 1 4 1 6 1 8 6 4 1 8 1 6 1 5 4 8 6 6 1 8 1 4 8 6 1 6 8 1 1 5 4 6 1 8 1 8 1 8 6 4 1 6 1 1 1 5 4 6 8 8 6 1 1 4 8 6 1 5 8 6 1 4 8 6 1 5 6 ...

result:

ok 

Test #123:

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

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

967 595 1986 1326 
2187 19 880 173 
1645 1179 961 843 
1225 1102 1566 177 
961 1553 354 1065 
625 611 1814 1276 
572 1097 1110 845 
2041 780 2178 1291 
1138 1531 2390 415 
1649 499 584 1131 
1982 752 1296 754 
2295 1627 1853 498 
1647 1282 1628 974 
2321 1271 265 2097 
2252 123 1776 1161 
723 487 43...

result:

ok 

Test #124:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

2 1 
2 2 
1 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 2 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
1 1 
2 2 
1 1 
2 1 
2 2 
1 2 
1 1 
2 1 
1 1 
2 2 
1 2 
2 1 
1 2 
2 2 
2 1 
2 2 
1 1 
1 2 
2 1 
1 2 
2 1 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
2 2 
2 2 
1 2 
...

result:

ok 

Test #125:

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

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
1208 2674 
4977 2674 
3028 2674 
36 2674 
1712 2674 
3561 2674 
3033 2674 
4699 2674 
1785 2674 
4345 2674 
3302 2674 
2493 2674 
4280 2674 
3999 2674 
4850 2674 
4508 2674 
3742 2674 
2718 2674 
3461 2674 
260 2674 
4223 2674 
2069 2674 
1144 2674 
1975 2674 
527 2674 
3260 2674 
2806 26...

result:

ok 

Test #126:

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

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 317 793 417 
1237 1990 507 1460 
1155 1030 1744 1114 
486 1284 2376 868 
2391 1441 704 665 
1283 1607 173 789 
2192 1309 1045 1466 
734 284 254 766 
1752 1181 1814 937 
1638 2346 1329 1459 
1205 1744 1155 443 
1098 1096 1050 430 
1622 2224 186 930 
2196 1772 1833 1916 
757 739 2066 114 
1180 996...

result:

ok 

Test #127:

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

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

926 833 788 67 830 795 580 861 
701 227 566 768 421 582 113 823 
981 868 494 76 745 910 644 188 
409 742 771 572 210 751 665 875 
151 131 455 298 387 145 442 3 
550 672 118 74 250 694 85 78 
857 855 695 533 944 977 431 807 
787 432 881 615 523 649 789 742 
538 159 114 894 42 29 942 619 
355 558 834 ...

result:

ok 

Test #128:

score: 0
Accepted
time: 135ms
memory: 49556kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

59126 27085 
75021 23663 
67175 78883 
90698 3919 
67504 20718 
49374 44011 
1660 3236 
71971 79270 
24502 90540 
54202 9732 
88659 14395 
52635 56600 
21912 17986 
56526 92420 
40254 3472 
64330 20431 
9381 56003 
57750 45529 
45230 9388 
83797 53437 
75562 47526 
45219 63126 
87437 71020 
50298 20...

result:

ok 

Test #129:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

161 969 1246 981 374 598 761 131 
257 674 658 837 826 749 119 163 
863 1166 891 929 733 564 802 207 
964 202 400 311 507 314 233 77 
445 1247 376 709 388 1093 408 71 
48 1020 468 19 581 566 966 403 
479 946 1201 730 822 703 132 785 
37 861 188 183 349 1202 18 731 
882 1226 896 648 523 333 614 126 
9...

result:

ok 

Test #130:

score: 0
Accepted
time: 8ms
memory: 5580kb

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

2334 540 1156 475 
1328 2439 2421 750 
471 2007 1792 1051 
2269 1776 786 705 
1674 1277 755 1622 
1217 590 1378 603 
1920 239 967 1658 
2307 78 857 1589 
2172 2322 861 1634 
2077 2179 2021 1381 
1547 1126 2126 345 
994 1477 412 1214 
1857 831 2085 978 
2406 1844 281 2174 
1779 521 2334 2254 
1508 19...

result:

ok 

Test #131:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

2 3 2 1 
1429 1 1 1429 
4 7 4 3 
3 1430 3 1430 
1 6 6 5 
5 1431 5 1431 
8 11 8 7 
7 1432 7 1432 
10 5 10 9 
1433 9 9 1433 
12 15 12 11 
11 1434 11 1434 
9 14 14 13 
13 1435 13 1435 
16 19 16 15 
15 1436 15 1436 
18 13 18 17 
1437 17 17 1437 
20 23 20 19 
19 1438 19 1438 
17 22 22 21 
21 1439 21 1439...

result:

ok 

Test #132:

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

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #133:

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

input:

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

output:

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

result:

ok 

Test #134:

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

input:

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

output:

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

result:

ok 

Test #135:

score: 0
Accepted
time: 897ms
memory: 73496kb

input:

62400 8 62400
617 61873 50005 41067 20321 15682 32071 28672
22133 8305 52336 45992 33172 47471 17329 39927
42134 45570 15289 42551 55858 19194 10715 10649
8176 5735 13244 20965 61861 7073 12818 5527
21000 8783 29108 17636 58752 9701 42134 11867
35793 5665 25545 53912 41719 7606 30422 4734
6540 43594...

output:

20321 617 28672 50005 61873 32071 41067 15682 
33172 8305 52336 39927 47471 22133 45992 17329 
55858 45570 42551 10715 19194 15289 10649 42134 
13244 12818 7073 8176 61861 5735 5527 20965 
11867 8783 17636 58752 21000 42134 9701 29108 
30422 25545 35793 7606 41719 53912 5665 4734 
6540 20671 4918 77...

result:

ok 

Test #136:

score: 0
Accepted
time: 1194ms
memory: 44288kb

input:

488 1024 488
437 386 352 3 204 235 111 327 270 195 436 108 324 319 398 484 177 270 133 272 484 202 67 380 1 215 36 327 104 412 432 67 157 455 286 196 62 262 437 4 289 108 272 402 136 265 291 48 135 182 385 319 112 186 70 50 273 196 231 195 17 319 178 270 132 424 78 406 324 346 57 71 97 186 396 422 3...

output:

300 69 341 277 129 476 398 426 368 125 466 236 93 396 350 357 18 134 467 271 353 339 418 383 100 174 456 297 262 356 30 414 97 179 483 301 168 187 470 255 358 198 55 113 215 158 90 189 385 471 147 308 445 366 86 440 306 229 439 404 447 355 78 130 22 172 160 9 184 269 415 486 319 167 107 329 441 402 ...

result:

ok 

Test #137:

score: 0
Accepted
time: 159ms
memory: 11268kb

input:

6 16384 6
2 5 1 6 5 2 5 1 6 1 5 5 6 5 5 6 2 6 2 1 6 6 5 5 6 5 2 2 1 1 1 6 5 1 5 6 6 2 6 1 2 6 6 2 2 1 6 6 6 1 5 5 1 5 5 6 2 5 1 5 1 5 1 2 5 1 1 6 5 6 5 2 1 1 6 1 6 6 5 5 5 1 5 6 2 5 6 5 5 6 6 6 2 5 5 6 2 5 6 1 5 6 6 2 2 5 1 2 5 5 6 5 6 6 1 1 2 2 5 5 6 5 6 5 5 1 6 6 6 6 1 6 5 6 5 2 6 6 6 5 5 6 6 6 6 ...

output:

6 2 6 5 2 6 5 1 2 5 6 5 6 5 6 1 2 6 6 5 2 6 5 1 2 6 5 1 6 5 5 1 2 6 6 5 2 6 5 1 2 5 6 5 6 5 6 1 2 6 6 5 6 5 5 1 2 6 5 1 6 5 5 1 2 5 6 5 2 6 5 1 2 6 6 5 6 5 5 1 2 5 6 5 6 5 6 1 2 6 5 1 6 5 6 1 2 5 6 5 2 6 5 1 2 6 5 1 6 5 6 1 2 6 6 5 6 5 5 1 2 6 5 1 6 5 5 1 2 6 6 5 2 6 5 1 2 6 6 5 6 5 5 1 2 6 6 5 2 6 ...

result:

ok 

Test #138:

score: 0
Accepted
time: 289ms
memory: 20708kb

input:

6035 32 3126
2384 1507 1419 2790 466 3034 613 391 1142 1913 2728 1770 1249 2719 457 1720 2670 541 568 1711 1147 1498 2929 1920 2067 351 2089 1076 3001 2562 2615 1630
1719 1848 849 3098 1026 1016 2612 2228 526 2395 1808 1898 1626 2249 2857 1473 2360 2448 1450 1045 55 2166 2597 1586 1181 540 789 612 1...

output:

1249 1498 1076 2384 466 2670 2728 2615 391 351 1920 1720 2790 1711 3001 1142 1419 2929 457 1630 2089 613 1770 568 541 2719 3034 2067 1147 1913 1507 2562 
2448 2395 612 1719 1026 335 55 2857 2612 1579 1626 1045 1586 1808 849 540 1848 1450 1898 2828 2597 1473 789 2228 1016 2166 526 1181 2360 3098 2249...

result:

ok 

Test #139:

score: 0
Accepted
time: 120ms
memory: 45152kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

13223 16598 
18759 19981 
8681 2642 
18080 4102 
16749 11473 
15290 690 
16229 17900 
10684 17481 
12171 6328 
9417 1150 
5689 7185 
17102 10346 
17958 9727 
13756 2117 
13157 10955 
2840 245 
5257 5337 
6429 16622 
17516 10772 
13007 19349 
2821 11359 
14341 8897 
2482 3974 
16241 17966 
15458 1814...

result:

ok 

Test #140:

score: 0
Accepted
time: 992ms
memory: 40192kb

input:

442 1024 442
204 189 272 54 225 232 246 111 211 39 140 31 133 213 40 172 5 229 225 147 176 81 31 108 40 148 128 210 21 262 105 163 228 247 259 161 184 211 3 211 261 277 70 186 27 195 89 282 233 258 169 215 154 267 21 239 264 213 91 131 295 39 163 282 254 63 286 282 9 116 139 285 76 206 85 233 73 180...

output:

109 70 12 51 116 43 261 18 209 127 147 169 190 39 36 121 233 144 180 142 22 15 146 75 3 242 226 94 21 41 273 225 250 11 172 113 27 272 110 56 246 220 266 251 6 294 173 7 134 249 9 211 295 60 44 92 288 50 255 52 84 187 126 129 285 258 271 208 160 112 245 241 106 161 171 184 117 196 132 55 123 118 119...

result:

ok 

Test #141:

score: 0
Accepted
time: 825ms
memory: 69284kb

input:

59767 8 50000
14021 37442 6924 2683 26908 28108 49331 4157
37602 8443 19287 12234 4215 29554 33860 1201
2453 34206 48003 47930 30310 48979 24906 2040
19079 30112 42351 26155 23394 37361 37618 35224
18576 29106 48671 22449 25578 19435 4011 7931
7174 13442 3382 24117 23309 31964 19031 45122
33083 3854...

output:

26908 2683 37442 49331 28108 14021 4157 6924 
4215 12234 8443 1201 37602 33860 19287 29554 
48003 30310 2453 2040 34206 24906 48979 47930 
37618 42351 30112 23394 37361 26155 19079 35224 
29106 25578 7931 48671 18576 19435 22449 4011 
23309 24117 7174 19031 13442 45122 3382 31964 
16358 5388 33083 4...

result:

ok 

Test #142:

score: 0
Accepted
time: 1015ms
memory: 73820kb

input:

62500 8 62500
51504 53517 18444 47810 55743 52115 39033 39945
39582 40153 48723 405 57762 57932 38589 34957
46544 29639 46926 5502 36080 4497 12837 5415
40364 54270 15841 56968 20512 49512 23271 29535
32613 29997 43963 8109 43144 40423 38621 31273
32431 16718 11192 30443 19278 38857 30834 60796
1958...

output:

39033 51504 18444 55743 52115 47810 39945 53517 
38589 405 57932 39582 48723 57762 34957 40153 
4497 29639 5502 12837 5415 46926 36080 46544 
20512 54270 29535 56968 15841 49512 40364 23271 
43963 38621 43144 32613 8109 31273 40423 29997 
11192 38857 16718 60796 30834 30443 19278 32431 
48478 44729 ...

result:

ok 

Test #143:

score: 0
Accepted
time: 1151ms
memory: 44020kb

input:

61 8192 61
47 47 47 47 47 36 36 47 36 36 36 47 36 47 36 47 47 36 36 36 47 36 36 36 47 36 47 47 47 36 47 36 36 47 47 36 47 47 47 47 47 47 36 36 36 47 47 21 36 36 36 36 47 47 36 47 36 47 47 47 36 47 47 47 47 36 36 47 36 47 36 47 47 36 47 47 36 47 47 36 36 36 36 36 47 36 36 36 36 47 36 47 36 47 47 36 3...

output:

25 36 36 47 47 32 47 36 36 47 45 36 36 47 36 47 47 36 36 47 36 47 36 47 36 47 36 47 47 19 47 36 36 43 36 47 13 47 47 36 18 36 47 36 36 47 47 36 36 47 36 47 36 47 47 36 47 36 36 47 36 47 47 36 47 4 36 36 36 47 36 20 36 47 47 36 47 36 36 47 36 47 36 47 36 47 47 36 47 26 36 47 36 47 47 36 47 36 36 47 4...

result:

ok 

Test #144:

score: 0
Accepted
time: 904ms
memory: 38772kb

input:

50 8192 50
40 29 20 40 40 40 20 40 40 40 40 49 20 20 40 40 20 40 40 20 20 20 40 20 40 40 20 20 40 40 40 40 40 20 40 40 40 40 40 40 20 40 20 40 20 40 40 20 40 40 20 20 40 20 40 40 20 40 40 40 20 19 40 40 40 40 20 40 20 40 20 20 20 20 20 20 20 40 20 40 20 20 20 40 40 40 40 40 40 40 20 20 40 20 20 40 4...

output:

20 15 20 36 41 40 40 20 27 40 20 40 20 18 20 40 40 20 20 40 28 20 20 40 20 40 20 40 40 20 20 40 40 48 20 44 9 40 20 40 20 40 20 40 20 40 40 20 19 40 20 40 20 40 40 20 20 40 20 40 20 40 20 40 20 40 40 20 40 21 20 40 20 40 20 40 40 22 20 40 20 40 7 40 40 20 20 40 20 40 40 20 20 40 40 20 20 40 20 40 20...

result:

ok 

Test #145:

score: 0
Accepted
time: 671ms
memory: 60652kb

input:

56000 8 50000
38540 29053 29109 38746 29288 38450 43383 32332
14057 662 19282 8910 49216 18920 32722 25913
4461 24280 3328 17870 569 37854 3246 27991
35958 21836 18035 12840 25641 36792 21982 33634
6456 49901 35635 42812 24541 44145 8939 11926
29442 26462 18739 27152 42797 5777 15117 19193
40156 501...

output:

29288 38540 32332 29109 29053 43383 38746 38450 
25913 8910 49216 14057 19282 18920 32722 662 
37854 4461 27991 17870 24280 3246 3328 569 
35958 21982 36792 18035 21836 33634 12840 25641 
11926 42812 49901 24541 44145 35635 6456 8939 
29442 42797 15117 18739 27152 19193 26462 5777 
40156 44159 36892...

result:

ok 

Test #146:

score: 0
Accepted
time: 844ms
memory: 71584kb

input:

61952 8 61952
31143 31143 3756 34556 4617 49727 3756 48229
48054 10150 10150 1113 46750 1113 11148 44687
18150 50774 34447 50642 31286 44185 50642 18150
18803 8000 20838 21039 20764 18803 20764 56246
59196 9154 49057 7963 47927 59196 59996 7963
27925 33037 27925 25590 4557 12519 33037 21779
9336 551...

output:

3756 48229 31143 4617 49727 34556 31143 3756 
44687 1113 10150 46750 1113 10150 48054 11148 
31286 34447 18150 50642 44185 50774 18150 50642 
20838 20764 18803 56246 21039 18803 20764 8000 
59196 7963 47927 49057 59196 9154 7963 59996 
21779 25590 33037 12519 27925 33037 27925 4557 
56435 9336 28094...

result:

ok 

Test #147:

score: 0
Accepted
time: 240ms
memory: 73672kb

input:

99995 4 99995
1 2 28571 28571
2 4 28572 28572
3 1 28573 28573
4 6 28574 28574
5 3 28575 28575
6 8 28576 28576
7 5 28577 28577
8 10 28578 28578
9 7 28579 28579
10 12 28580 28580
11 9 28581 28581
12 14 28582 28582
13 11 28583 28583
14 16 28584 28584
15 13 28585 28585
16 18 28586 28586
17 15 28587 2858...

output:

2 28571 28571 1 
4 28572 28572 2 
28573 1 28573 3 
6 28574 28574 4 
3 28575 28575 5 
8 28576 28576 6 
28577 5 28577 7 
10 28578 28578 8 
7 28579 28579 9 
12 28580 28580 10 
28581 9 28581 11 
14 28582 28582 12 
11 28583 28583 13 
16 28584 28584 14 
28585 13 28585 15 
18 28586 28586 16 
15 28587 28587...

result:

ok 

Test #148:

score: 0
Accepted
time: 231ms
memory: 75668kb

input:

99995 4 99995
1 2 2 3
57141 1 1 57141
3 4 4 7
57142 3 3 57142
5 6 6 1
57143 5 5 57143
7 8 8 11
57144 7 7 57144
9 10 10 5
57145 9 9 57145
11 12 12 15
57146 11 11 57146
13 14 14 9
57147 13 13 57147
15 16 16 19
57148 15 15 57148
17 18 18 13
57149 17 17 57149
19 20 20 23
57150 19 19 57150
21 22 22 17
57...

output:

2 3 2 1 
57141 1 1 57141 
4 7 4 3 
3 57142 3 57142 
1 6 6 5 
5 57143 5 57143 
8 11 8 7 
7 57144 7 57144 
10 5 10 9 
57145 9 9 57145 
12 15 12 11 
11 57146 11 57146 
9 14 14 13 
13 57147 13 57147 
16 19 16 15 
15 57148 15 57148 
18 13 18 17 
57149 17 17 57149 
20 23 20 19 
19 57150 19 57150 
17 22 22...

result:

ok 

Test #149:

score: 0
Accepted
time: 237ms
memory: 73140kb

input:

99995 4 99995
71425 71425 99994 99995
71424 71424 99992 99994
71423 71423 99995 99993
71422 71422 99990 99992
71421 71421 99993 99991
71420 71420 99988 99990
71419 71419 99991 99989
71418 71418 99986 99988
71417 71417 99989 99987
71416 71416 99984 99986
71415 71415 99987 99985
71414 71414 99982 9998...

output:

99995 71425 99994 71425 
99994 71424 99992 71424 
99993 71423 71423 99995 
99992 71422 99990 71422 
99991 71421 99993 71421 
99990 71420 99988 71420 
99989 71419 71419 99991 
99988 71418 99986 71418 
99987 71417 99989 71417 
99986 71416 99984 71416 
99985 71415 71415 99987 
99984 71414 99982 71414 
...

result:

ok 

Test #150:

score: 0
Accepted
time: 70ms
memory: 48596kb

input:

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

output:

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

result:

ok 

Test #151:

score: 0
Accepted
time: 233ms
memory: 73140kb

input:

99995 4 99995
99993 99994 99994 99995
42855 99995 99995 42855
99989 99992 99992 99993
42854 99993 99993 42854
99995 99990 99990 99991
42853 99991 99991 42853
99985 99988 99988 99989
42852 99989 99989 42852
99991 99986 99986 99987
42851 99987 99987 42851
99981 99984 99984 99985
42850 99985 99985 4285...

output:

99993 99994 99995 99994 
99995 42855 42855 99995 
99989 99992 99993 99992 
42854 99993 42854 99993 
99990 99995 99991 99990 
42853 99991 42853 99991 
99985 99988 99989 99988 
42852 99989 42852 99989 
99991 99986 99987 99986 
99987 42851 42851 99987 
99981 99984 99985 99984 
42850 99985 42850 99985 
...

result:

ok 

Test #152:

score: 0
Accepted
time: 248ms
memory: 73008kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 85710 71425 
85709 71424 71424 85709 
85708 71423 71423 85708 
85707 71422 71422 85707 
85706 71421 85706 71421 
85705 71420 71420 85705 
85704 71419 71419 85704 
85703 71418 71418 85703 
85702 71417 85702 71417 
85701 71416 71416 85701 
85700 71415 71415 85700 
85699 71414 71414 85699 
...

result:

ok 

Test #153:

score: 0
Accepted
time: 240ms
memory: 73120kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 71425 85710 
85709 71424 85709 71424 
85708 71423 85708 71423 
85707 71422 85707 71422 
85706 71421 71421 85706 
85705 71420 85705 71420 
85704 71419 85704 71419 
85703 71418 85703 71418 
85702 71417 71417 85702 
85701 71416 85701 71416 
85700 71415 85700 71415 
85699 71414 85699 71414 
...

result:

ok 

Test #154:

score: 0
Accepted
time: 237ms
memory: 73232kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
28572 14287 28572 14287 
28573 14288 28573 14288 
28574 14289 28574 14289 
14290 28575 28575 14290 
28576 14291 28576 14291 
28577 14292 28577 14292 
28578 14293 28578 14293 
14294 28579 28579 14294 
28580 14295 28580 14295 
28581 14296 28581 14296 
28582 14297 28582 14297 
...

result:

ok 

Test #155:

score: 0
Accepted
time: 236ms
memory: 73188kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
28572 14287 28572 14287 
28573 14288 28573 14288 
28574 14289 28574 14289 
14290 28575 28575 14290 
28576 14291 28576 14291 
28577 14292 28577 14292 
28578 14293 28578 14293 
14294 28579 28579 14294 
28580 14295 28580 14295 
28581 14296 28581 14296 
28582 14297 28582 14297 
...

result:

ok 

Test #156:

score: 0
Accepted
time: 403ms
memory: 65448kb

input:

62496 8 62496
1 1 2 2 17857 17857 17857 17857
2 2 4 4 17858 17858 17858 17858
3 3 1 1 17859 17859 17859 17859
4 4 6 6 17860 17860 17860 17860
5 5 3 3 17861 17861 17861 17861
6 6 8 8 17862 17862 17862 17862
7 7 5 5 17863 17863 17863 17863
8 8 10 10 17864 17864 17864 17864
9 9 7 7 17865 17865 17865 17...

output:

17857 2 17857 1 17857 2 17857 1 
17858 4 17858 2 17858 4 17858 2 
17859 1 17859 3 17859 1 17859 3 
17860 6 17860 4 17860 6 17860 4 
17861 3 17861 5 17861 3 17861 5 
17862 8 17862 6 17862 8 17862 6 
17863 5 17863 7 17863 5 17863 7 
17864 10 17864 8 17864 10 17864 8 
17865 7 17865 9 17865 7 17865 9 
1...

result:

ok 

Test #157:

score: 0
Accepted
time: 375ms
memory: 66852kb

input:

62496 8 62496
1 3 2 2 2 2 1 3
35713 35713 1 1 1 1 35713 35713
3 7 4 4 4 4 3 7
35714 35714 3 3 3 3 35714 35714
5 1 6 6 6 6 5 1
35715 35715 5 5 5 5 35715 35715
7 11 8 8 8 8 7 11
35716 35716 7 7 7 7 35716 35716
9 5 10 10 10 10 9 5
35717 35717 9 9 9 9 35717 35717
11 15 12 12 12 12 11 15
35718 35718 11 1...

output:

3 2 2 1 3 2 2 1 
35713 1 1 35713 35713 1 1 35713 
7 4 4 3 7 4 4 3 
35714 3 3 35714 35714 3 3 35714 
1 6 6 5 1 6 6 5 
35715 5 5 35715 35715 5 5 35715 
11 8 8 7 11 8 8 7 
35716 7 7 35716 35716 7 7 35716 
5 10 10 9 5 10 10 9 
35717 9 9 35717 35717 9 9 35717 
15 12 12 11 15 12 12 11 
35718 11 11 35718 3...

result:

ok 

Test #158:

score: 0
Accepted
time: 108ms
memory: 51716kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

25002 53479 
63606 53479 
40735 53479 
83340 53479 
40775 53479 
11458 53479 
53479 8684 
60405 53479 
45116 53479 
67722 53479 
26014 53479 
87860 53479 
55147 53479 
22726 53479 
67769 53479 
129 53479 
14600 53479 
21514 53479 
32164 53479 
60088 53479 
25415 53479 
70946 53479 
27091 53479 
3338...

result:

ok 

Test #159:

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

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
79073 63660 
20397 41795 
84311 1296 
21178 3690 
21052 31611 
14323 51423 
82468 34208 
83835 2785 
28274 50594 
59957 10993 
34259 64334 
89407 73934 
14947 61083 
89472 53201 
61243 33351 
76632 58718 
67464 85318 
54224 45096 
76529 84552 
30697 44253 
3108 43669 
26489 64691 
85776 ...

result:

ok 

Test #160:

score: 0
Accepted
time: 137ms
memory: 47884kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

80944 83824 
26621 25208 
28836 57146 
43915 18169 
59242 47842 
78881 34224 
38791 20722 
91046 89723 
72800 40306 
94906 92681 
7263 41151 
13332 76035 
38800 93928 
86055 97168 
73623 44186 
68071 7391 
20692 72265 
44111 42596 
77687 36037 
64592 836 
43568 35187 
88539 34861 
22111 37477 
98028...

result:

ok 

Test #161:

score: 0
Accepted
time: 121ms
memory: 52764kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

92592 91980 
12359 10704 
35873 56718 
28601 20301 
55548 78422 
74736 59974 
29025 81664 
70432 55916 
47381 34185 
56168 31764 
33997 30947 
70076 9029 
67057 52532 
99273 79680 
56704 54410 
45238 71652 
6894 12615 
66478 78041 
5451 40520 
5950 58133 
70551 89237 
97551 36028 
90630 83553 
33690...

result:

ok 

Test #162:

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

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457 
40457 80634 
49074 21580 
92701 14354 
44540 70461 
47132 47637 
84954 27979 
87556 60683 
43063 22633 
63643 49914 
4494 3571 
53632 88758 
17055 50019 
49334 79039 
67659 50111 
17945 48061 
60323 84596 
72033 14629 
77184 30069 
64209 36217 
49947 35279 
44707 45866 
58484 58146 
139...

result:

ok 

Subtask #9:

score: 10
Accepted

Dependency #3:

100%
Accepted

Dependency #6:

100%
Accepted

Test #163:

score: 10
Accepted
time: 135ms
memory: 49392kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
63612 53683 
78264 70370 
76881 42647 
31741 39251 
66491 61186 
57686 65819 
53278 59145 
26052 71962 
55279 81040 
50859 51310 
46800 24546 
85013 91165 
21890 61530 
84003 29099 
86182 33573 
10639 49212 
97312 91851 
57682 14067 
69674 5243 
62508 99007 
26...

result:

ok 

Test #164:

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

input:

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

output:

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

result:

ok 

Test #165:

score: 0
Accepted
time: 84ms
memory: 52512kb

input:

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

output:

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

result:

ok 

Test #166:

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

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 3 3 2 
2 2 2 3 

result:

ok 

Test #167:

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

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

26 116 7 123 83 5 12 122 9 114 76 86 36 125 145 95 102 72 128 36 92 151 101 60 80 66 33 29 19 155 89 109 93 123 122 132 140 97 155 3 57 119 62 154 19 14 145 125 55 102 36 125 97 19 62 29 13 109 123 89 104 4 60 89 
113 148 33 84 71 75 4 109 127 13 27 55 154 97 47 93 63 78 150 21 10 25 122 3 93 104 30...

result:

ok 

Test #168:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 8 4 6 6 1 8 1 8 6 4 1 8 6 1 1 4 5 8 6 6 1 8 1 5 6 4 8 8 1 1 1 5 8 4 1 8 6 6 1 5 8 6 1 4 8 6 1 4 5 8 1 6 1 6 1 4 8 6 1 8 1 1 1 8 6 4 1 5 4 8 1 5 8 6 1 4 6 8 1 5 6 8 1 4 1 6 1 8 6 4 1 8 1 6 1 5 4 8 6 6 1 8 1 4 8 6 1 6 8 1 1 5 4 6 1 8 1 8 1 8 6 4 1 6 1 1 1 5 4 6 8 8 6 1 1 4 8 6 1 5 8 6 1 4 8 6 1 5 6 ...

result:

ok 

Test #169:

score: 0
Accepted
time: 8ms
memory: 5288kb

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

967 595 1986 1326 
2187 19 880 173 
1645 1179 961 843 
1225 1102 1566 177 
961 1553 354 1065 
625 611 1814 1276 
572 1097 1110 845 
2041 780 2178 1291 
1138 1531 2390 415 
1649 499 584 1131 
1982 752 1296 754 
2295 1627 1853 498 
1647 1282 1628 974 
2321 1271 265 2097 
2252 123 1776 1161 
723 487 43...

result:

ok 

Test #170:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

2 1 
2 2 
1 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 2 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
1 1 
2 2 
1 1 
2 1 
2 2 
1 2 
1 1 
2 1 
1 1 
2 2 
1 2 
2 1 
1 2 
2 2 
2 1 
2 2 
1 1 
1 2 
2 1 
1 2 
2 1 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
2 2 
2 2 
1 2 
...

result:

ok 

Test #171:

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

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
1208 2674 
4977 2674 
3028 2674 
36 2674 
1712 2674 
3561 2674 
3033 2674 
4699 2674 
1785 2674 
4345 2674 
3302 2674 
2493 2674 
4280 2674 
3999 2674 
4850 2674 
4508 2674 
3742 2674 
2718 2674 
3461 2674 
260 2674 
4223 2674 
2069 2674 
1144 2674 
1975 2674 
527 2674 
3260 2674 
2806 26...

result:

ok 

Test #172:

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

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 317 793 417 
1237 1990 507 1460 
1155 1030 1744 1114 
486 1284 2376 868 
2391 1441 704 665 
1283 1607 173 789 
2192 1309 1045 1466 
734 284 254 766 
1752 1181 1814 937 
1638 2346 1329 1459 
1205 1744 1155 443 
1098 1096 1050 430 
1622 2224 186 930 
2196 1772 1833 1916 
757 739 2066 114 
1180 996...

result:

ok 

Test #173:

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

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

926 833 788 67 830 795 580 861 
701 227 566 768 421 582 113 823 
981 868 494 76 745 910 644 188 
409 742 771 572 210 751 665 875 
151 131 455 298 387 145 442 3 
550 672 118 74 250 694 85 78 
857 855 695 533 944 977 431 807 
787 432 881 615 523 649 789 742 
538 159 114 894 42 29 942 619 
355 558 834 ...

result:

ok 

Test #174:

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

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

59126 27085 
75021 23663 
67175 78883 
90698 3919 
67504 20718 
49374 44011 
1660 3236 
71971 79270 
24502 90540 
54202 9732 
88659 14395 
52635 56600 
21912 17986 
56526 92420 
40254 3472 
64330 20431 
9381 56003 
57750 45529 
45230 9388 
83797 53437 
75562 47526 
45219 63126 
87437 71020 
50298 20...

result:

ok 

Test #175:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

161 969 1246 981 374 598 761 131 
257 674 658 837 826 749 119 163 
863 1166 891 929 733 564 802 207 
964 202 400 311 507 314 233 77 
445 1247 376 709 388 1093 408 71 
48 1020 468 19 581 566 966 403 
479 946 1201 730 822 703 132 785 
37 861 188 183 349 1202 18 731 
882 1226 896 648 523 333 614 126 
9...

result:

ok 

Test #176:

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

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

2334 540 1156 475 
1328 2439 2421 750 
471 2007 1792 1051 
2269 1776 786 705 
1674 1277 755 1622 
1217 590 1378 603 
1920 239 967 1658 
2307 78 857 1589 
2172 2322 861 1634 
2077 2179 2021 1381 
1547 1126 2126 345 
994 1477 412 1214 
1857 831 2085 978 
2406 1844 281 2174 
1779 521 2334 2254 
1508 19...

result:

ok 

Test #177:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

2 3 2 1 
1429 1 1 1429 
4 7 4 3 
3 1430 3 1430 
1 6 6 5 
5 1431 5 1431 
8 11 8 7 
7 1432 7 1432 
10 5 10 9 
1433 9 9 1433 
12 15 12 11 
11 1434 11 1434 
9 14 14 13 
13 1435 13 1435 
16 19 16 15 
15 1436 15 1436 
18 13 18 17 
1437 17 17 1437 
20 23 20 19 
19 1438 19 1438 
17 22 22 21 
21 1439 21 1439...

result:

ok 

Test #178:

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

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #179:

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

input:

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

output:

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

result:

ok 

Test #180:

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

input:

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

output:

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

result:

ok 

Test #181:

score: 0
Accepted
time: 927ms
memory: 73496kb

input:

62400 8 62400
617 61873 50005 41067 20321 15682 32071 28672
22133 8305 52336 45992 33172 47471 17329 39927
42134 45570 15289 42551 55858 19194 10715 10649
8176 5735 13244 20965 61861 7073 12818 5527
21000 8783 29108 17636 58752 9701 42134 11867
35793 5665 25545 53912 41719 7606 30422 4734
6540 43594...

output:

20321 617 28672 50005 61873 32071 41067 15682 
33172 8305 52336 39927 47471 22133 45992 17329 
55858 45570 42551 10715 19194 15289 10649 42134 
13244 12818 7073 8176 61861 5735 5527 20965 
11867 8783 17636 58752 21000 42134 9701 29108 
30422 25545 35793 7606 41719 53912 5665 4734 
6540 20671 4918 77...

result:

ok 

Test #182:

score: 0
Accepted
time: 1187ms
memory: 44396kb

input:

488 1024 488
437 386 352 3 204 235 111 327 270 195 436 108 324 319 398 484 177 270 133 272 484 202 67 380 1 215 36 327 104 412 432 67 157 455 286 196 62 262 437 4 289 108 272 402 136 265 291 48 135 182 385 319 112 186 70 50 273 196 231 195 17 319 178 270 132 424 78 406 324 346 57 71 97 186 396 422 3...

output:

300 69 341 277 129 476 398 426 368 125 466 236 93 396 350 357 18 134 467 271 353 339 418 383 100 174 456 297 262 356 30 414 97 179 483 301 168 187 470 255 358 198 55 113 215 158 90 189 385 471 147 308 445 366 86 440 306 229 439 404 447 355 78 130 22 172 160 9 184 269 415 486 319 167 107 329 441 402 ...

result:

ok 

Test #183:

score: 0
Accepted
time: 163ms
memory: 11340kb

input:

6 16384 6
2 5 1 6 5 2 5 1 6 1 5 5 6 5 5 6 2 6 2 1 6 6 5 5 6 5 2 2 1 1 1 6 5 1 5 6 6 2 6 1 2 6 6 2 2 1 6 6 6 1 5 5 1 5 5 6 2 5 1 5 1 5 1 2 5 1 1 6 5 6 5 2 1 1 6 1 6 6 5 5 5 1 5 6 2 5 6 5 5 6 6 6 2 5 5 6 2 5 6 1 5 6 6 2 2 5 1 2 5 5 6 5 6 6 1 1 2 2 5 5 6 5 6 5 5 1 6 6 6 6 1 6 5 6 5 2 6 6 6 5 5 6 6 6 6 ...

output:

6 2 6 5 2 6 5 1 2 5 6 5 6 5 6 1 2 6 6 5 2 6 5 1 2 6 5 1 6 5 5 1 2 6 6 5 2 6 5 1 2 5 6 5 6 5 6 1 2 6 6 5 6 5 5 1 2 6 5 1 6 5 5 1 2 5 6 5 2 6 5 1 2 6 6 5 6 5 5 1 2 5 6 5 6 5 6 1 2 6 5 1 6 5 6 1 2 5 6 5 2 6 5 1 2 6 5 1 6 5 6 1 2 6 6 5 6 5 5 1 2 6 5 1 6 5 5 1 2 6 6 5 2 6 5 1 2 6 6 5 6 5 5 1 2 6 6 5 2 6 ...

result:

ok 

Test #184:

score: 0
Accepted
time: 288ms
memory: 20912kb

input:

6035 32 3126
2384 1507 1419 2790 466 3034 613 391 1142 1913 2728 1770 1249 2719 457 1720 2670 541 568 1711 1147 1498 2929 1920 2067 351 2089 1076 3001 2562 2615 1630
1719 1848 849 3098 1026 1016 2612 2228 526 2395 1808 1898 1626 2249 2857 1473 2360 2448 1450 1045 55 2166 2597 1586 1181 540 789 612 1...

output:

1249 1498 1076 2384 466 2670 2728 2615 391 351 1920 1720 2790 1711 3001 1142 1419 2929 457 1630 2089 613 1770 568 541 2719 3034 2067 1147 1913 1507 2562 
2448 2395 612 1719 1026 335 55 2857 2612 1579 1626 1045 1586 1808 849 540 1848 1450 1898 2828 2597 1473 789 2228 1016 2166 526 1181 2360 3098 2249...

result:

ok 

Test #185:

score: 0
Accepted
time: 118ms
memory: 45204kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

13223 16598 
18759 19981 
8681 2642 
18080 4102 
16749 11473 
15290 690 
16229 17900 
10684 17481 
12171 6328 
9417 1150 
5689 7185 
17102 10346 
17958 9727 
13756 2117 
13157 10955 
2840 245 
5257 5337 
6429 16622 
17516 10772 
13007 19349 
2821 11359 
14341 8897 
2482 3974 
16241 17966 
15458 1814...

result:

ok 

Test #186:

score: 0
Accepted
time: 994ms
memory: 42300kb

input:

442 1024 442
204 189 272 54 225 232 246 111 211 39 140 31 133 213 40 172 5 229 225 147 176 81 31 108 40 148 128 210 21 262 105 163 228 247 259 161 184 211 3 211 261 277 70 186 27 195 89 282 233 258 169 215 154 267 21 239 264 213 91 131 295 39 163 282 254 63 286 282 9 116 139 285 76 206 85 233 73 180...

output:

109 70 12 51 116 43 261 18 209 127 147 169 190 39 36 121 233 144 180 142 22 15 146 75 3 242 226 94 21 41 273 225 250 11 172 113 27 272 110 56 246 220 266 251 6 294 173 7 134 249 9 211 295 60 44 92 288 50 255 52 84 187 126 129 285 258 271 208 160 112 245 241 106 161 171 184 117 196 132 55 123 118 119...

result:

ok 

Test #187:

score: 0
Accepted
time: 818ms
memory: 69204kb

input:

59767 8 50000
14021 37442 6924 2683 26908 28108 49331 4157
37602 8443 19287 12234 4215 29554 33860 1201
2453 34206 48003 47930 30310 48979 24906 2040
19079 30112 42351 26155 23394 37361 37618 35224
18576 29106 48671 22449 25578 19435 4011 7931
7174 13442 3382 24117 23309 31964 19031 45122
33083 3854...

output:

26908 2683 37442 49331 28108 14021 4157 6924 
4215 12234 8443 1201 37602 33860 19287 29554 
48003 30310 2453 2040 34206 24906 48979 47930 
37618 42351 30112 23394 37361 26155 19079 35224 
29106 25578 7931 48671 18576 19435 22449 4011 
23309 24117 7174 19031 13442 45122 3382 31964 
16358 5388 33083 4...

result:

ok 

Test #188:

score: 0
Accepted
time: 912ms
memory: 73936kb

input:

62500 8 62500
51504 53517 18444 47810 55743 52115 39033 39945
39582 40153 48723 405 57762 57932 38589 34957
46544 29639 46926 5502 36080 4497 12837 5415
40364 54270 15841 56968 20512 49512 23271 29535
32613 29997 43963 8109 43144 40423 38621 31273
32431 16718 11192 30443 19278 38857 30834 60796
1958...

output:

39033 51504 18444 55743 52115 47810 39945 53517 
38589 405 57932 39582 48723 57762 34957 40153 
4497 29639 5502 12837 5415 46926 36080 46544 
20512 54270 29535 56968 15841 49512 40364 23271 
43963 38621 43144 32613 8109 31273 40423 29997 
11192 38857 16718 60796 30834 30443 19278 32431 
48478 44729 ...

result:

ok 

Test #189:

score: 0
Accepted
time: 1137ms
memory: 44196kb

input:

61 8192 61
47 47 47 47 47 36 36 47 36 36 36 47 36 47 36 47 47 36 36 36 47 36 36 36 47 36 47 47 47 36 47 36 36 47 47 36 47 47 47 47 47 47 36 36 36 47 47 21 36 36 36 36 47 47 36 47 36 47 47 47 36 47 47 47 47 36 36 47 36 47 36 47 47 36 47 47 36 47 47 36 36 36 36 36 47 36 36 36 36 47 36 47 36 47 47 36 3...

output:

25 36 36 47 47 32 47 36 36 47 45 36 36 47 36 47 47 36 36 47 36 47 36 47 36 47 36 47 47 19 47 36 36 43 36 47 13 47 47 36 18 36 47 36 36 47 47 36 36 47 36 47 36 47 47 36 47 36 36 47 36 47 47 36 47 4 36 36 36 47 36 20 36 47 47 36 47 36 36 47 36 47 36 47 36 47 47 36 47 26 36 47 36 47 47 36 47 36 36 47 4...

result:

ok 

Test #190:

score: 0
Accepted
time: 900ms
memory: 36708kb

input:

50 8192 50
40 29 20 40 40 40 20 40 40 40 40 49 20 20 40 40 20 40 40 20 20 20 40 20 40 40 20 20 40 40 40 40 40 20 40 40 40 40 40 40 20 40 20 40 20 40 40 20 40 40 20 20 40 20 40 40 20 40 40 40 20 19 40 40 40 40 20 40 20 40 20 20 20 20 20 20 20 40 20 40 20 20 20 40 40 40 40 40 40 40 20 20 40 20 20 40 4...

output:

20 15 20 36 41 40 40 20 27 40 20 40 20 18 20 40 40 20 20 40 28 20 20 40 20 40 20 40 40 20 20 40 40 48 20 44 9 40 20 40 20 40 20 40 20 40 40 20 19 40 20 40 20 40 40 20 20 40 20 40 20 40 20 40 20 40 40 20 40 21 20 40 20 40 20 40 40 22 20 40 20 40 7 40 40 20 20 40 20 40 40 20 20 40 40 20 20 40 20 40 20...

result:

ok 

Test #191:

score: 0
Accepted
time: 712ms
memory: 60776kb

input:

56000 8 50000
38540 29053 29109 38746 29288 38450 43383 32332
14057 662 19282 8910 49216 18920 32722 25913
4461 24280 3328 17870 569 37854 3246 27991
35958 21836 18035 12840 25641 36792 21982 33634
6456 49901 35635 42812 24541 44145 8939 11926
29442 26462 18739 27152 42797 5777 15117 19193
40156 501...

output:

29288 38540 32332 29109 29053 43383 38746 38450 
25913 8910 49216 14057 19282 18920 32722 662 
37854 4461 27991 17870 24280 3246 3328 569 
35958 21982 36792 18035 21836 33634 12840 25641 
11926 42812 49901 24541 44145 35635 6456 8939 
29442 42797 15117 18739 27152 19193 26462 5777 
40156 44159 36892...

result:

ok 

Test #192:

score: 0
Accepted
time: 916ms
memory: 71476kb

input:

61952 8 61952
31143 31143 3756 34556 4617 49727 3756 48229
48054 10150 10150 1113 46750 1113 11148 44687
18150 50774 34447 50642 31286 44185 50642 18150
18803 8000 20838 21039 20764 18803 20764 56246
59196 9154 49057 7963 47927 59196 59996 7963
27925 33037 27925 25590 4557 12519 33037 21779
9336 551...

output:

3756 48229 31143 4617 49727 34556 31143 3756 
44687 1113 10150 46750 1113 10150 48054 11148 
31286 34447 18150 50642 44185 50774 18150 50642 
20838 20764 18803 56246 21039 18803 20764 8000 
59196 7963 47927 49057 59196 9154 7963 59996 
21779 25590 33037 12519 27925 33037 27925 4557 
56435 9336 28094...

result:

ok 

Test #193:

score: 0
Accepted
time: 228ms
memory: 73680kb

input:

99995 4 99995
1 2 28571 28571
2 4 28572 28572
3 1 28573 28573
4 6 28574 28574
5 3 28575 28575
6 8 28576 28576
7 5 28577 28577
8 10 28578 28578
9 7 28579 28579
10 12 28580 28580
11 9 28581 28581
12 14 28582 28582
13 11 28583 28583
14 16 28584 28584
15 13 28585 28585
16 18 28586 28586
17 15 28587 2858...

output:

2 28571 28571 1 
4 28572 28572 2 
28573 1 28573 3 
6 28574 28574 4 
3 28575 28575 5 
8 28576 28576 6 
28577 5 28577 7 
10 28578 28578 8 
7 28579 28579 9 
12 28580 28580 10 
28581 9 28581 11 
14 28582 28582 12 
11 28583 28583 13 
16 28584 28584 14 
28585 13 28585 15 
18 28586 28586 16 
15 28587 28587...

result:

ok 

Test #194:

score: 0
Accepted
time: 225ms
memory: 75700kb

input:

99995 4 99995
1 2 2 3
57141 1 1 57141
3 4 4 7
57142 3 3 57142
5 6 6 1
57143 5 5 57143
7 8 8 11
57144 7 7 57144
9 10 10 5
57145 9 9 57145
11 12 12 15
57146 11 11 57146
13 14 14 9
57147 13 13 57147
15 16 16 19
57148 15 15 57148
17 18 18 13
57149 17 17 57149
19 20 20 23
57150 19 19 57150
21 22 22 17
57...

output:

2 3 2 1 
57141 1 1 57141 
4 7 4 3 
3 57142 3 57142 
1 6 6 5 
5 57143 5 57143 
8 11 8 7 
7 57144 7 57144 
10 5 10 9 
57145 9 9 57145 
12 15 12 11 
11 57146 11 57146 
9 14 14 13 
13 57147 13 57147 
16 19 16 15 
15 57148 15 57148 
18 13 18 17 
57149 17 17 57149 
20 23 20 19 
19 57150 19 57150 
17 22 22...

result:

ok 

Test #195:

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

input:

99995 4 99995
71425 71425 99994 99995
71424 71424 99992 99994
71423 71423 99995 99993
71422 71422 99990 99992
71421 71421 99993 99991
71420 71420 99988 99990
71419 71419 99991 99989
71418 71418 99986 99988
71417 71417 99989 99987
71416 71416 99984 99986
71415 71415 99987 99985
71414 71414 99982 9998...

output:

99995 71425 99994 71425 
99994 71424 99992 71424 
99993 71423 71423 99995 
99992 71422 99990 71422 
99991 71421 99993 71421 
99990 71420 99988 71420 
99989 71419 71419 99991 
99988 71418 99986 71418 
99987 71417 99989 71417 
99986 71416 99984 71416 
99985 71415 71415 99987 
99984 71414 99982 71414 
...

result:

ok 

Test #196:

score: 0
Accepted
time: 68ms
memory: 48600kb

input:

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

output:

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

result:

ok 

Test #197:

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

input:

99995 4 99995
99993 99994 99994 99995
42855 99995 99995 42855
99989 99992 99992 99993
42854 99993 99993 42854
99995 99990 99990 99991
42853 99991 99991 42853
99985 99988 99988 99989
42852 99989 99989 42852
99991 99986 99986 99987
42851 99987 99987 42851
99981 99984 99984 99985
42850 99985 99985 4285...

output:

99993 99994 99995 99994 
99995 42855 42855 99995 
99989 99992 99993 99992 
42854 99993 42854 99993 
99990 99995 99991 99990 
42853 99991 42853 99991 
99985 99988 99989 99988 
42852 99989 42852 99989 
99991 99986 99987 99986 
99987 42851 42851 99987 
99981 99984 99985 99984 
42850 99985 42850 99985 
...

result:

ok 

Test #198:

score: 0
Accepted
time: 253ms
memory: 73092kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 85710 71425 
85709 71424 71424 85709 
85708 71423 71423 85708 
85707 71422 71422 85707 
85706 71421 85706 71421 
85705 71420 71420 85705 
85704 71419 71419 85704 
85703 71418 71418 85703 
85702 71417 85702 71417 
85701 71416 71416 85701 
85700 71415 71415 85700 
85699 71414 71414 85699 
...

result:

ok 

Test #199:

score: 0
Accepted
time: 242ms
memory: 73100kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 71425 85710 
85709 71424 85709 71424 
85708 71423 85708 71423 
85707 71422 85707 71422 
85706 71421 71421 85706 
85705 71420 85705 71420 
85704 71419 85704 71419 
85703 71418 85703 71418 
85702 71417 71417 85702 
85701 71416 85701 71416 
85700 71415 85700 71415 
85699 71414 85699 71414 
...

result:

ok 

Test #200:

score: 0
Accepted
time: 251ms
memory: 73084kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
28572 14287 28572 14287 
28573 14288 28573 14288 
28574 14289 28574 14289 
14290 28575 28575 14290 
28576 14291 28576 14291 
28577 14292 28577 14292 
28578 14293 28578 14293 
14294 28579 28579 14294 
28580 14295 28580 14295 
28581 14296 28581 14296 
28582 14297 28582 14297 
...

result:

ok 

Test #201:

score: 0
Accepted
time: 227ms
memory: 73144kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
28572 14287 28572 14287 
28573 14288 28573 14288 
28574 14289 28574 14289 
14290 28575 28575 14290 
28576 14291 28576 14291 
28577 14292 28577 14292 
28578 14293 28578 14293 
14294 28579 28579 14294 
28580 14295 28580 14295 
28581 14296 28581 14296 
28582 14297 28582 14297 
...

result:

ok 

Test #202:

score: 0
Accepted
time: 392ms
memory: 65284kb

input:

62496 8 62496
1 1 2 2 17857 17857 17857 17857
2 2 4 4 17858 17858 17858 17858
3 3 1 1 17859 17859 17859 17859
4 4 6 6 17860 17860 17860 17860
5 5 3 3 17861 17861 17861 17861
6 6 8 8 17862 17862 17862 17862
7 7 5 5 17863 17863 17863 17863
8 8 10 10 17864 17864 17864 17864
9 9 7 7 17865 17865 17865 17...

output:

17857 2 17857 1 17857 2 17857 1 
17858 4 17858 2 17858 4 17858 2 
17859 1 17859 3 17859 1 17859 3 
17860 6 17860 4 17860 6 17860 4 
17861 3 17861 5 17861 3 17861 5 
17862 8 17862 6 17862 8 17862 6 
17863 5 17863 7 17863 5 17863 7 
17864 10 17864 8 17864 10 17864 8 
17865 7 17865 9 17865 7 17865 9 
1...

result:

ok 

Test #203:

score: 0
Accepted
time: 378ms
memory: 66796kb

input:

62496 8 62496
1 3 2 2 2 2 1 3
35713 35713 1 1 1 1 35713 35713
3 7 4 4 4 4 3 7
35714 35714 3 3 3 3 35714 35714
5 1 6 6 6 6 5 1
35715 35715 5 5 5 5 35715 35715
7 11 8 8 8 8 7 11
35716 35716 7 7 7 7 35716 35716
9 5 10 10 10 10 9 5
35717 35717 9 9 9 9 35717 35717
11 15 12 12 12 12 11 15
35718 35718 11 1...

output:

3 2 2 1 3 2 2 1 
35713 1 1 35713 35713 1 1 35713 
7 4 4 3 7 4 4 3 
35714 3 3 35714 35714 3 3 35714 
1 6 6 5 1 6 6 5 
35715 5 5 35715 35715 5 5 35715 
11 8 8 7 11 8 8 7 
35716 7 7 35716 35716 7 7 35716 
5 10 10 9 5 10 10 9 
35717 9 9 35717 35717 9 9 35717 
15 12 12 11 15 12 12 11 
35718 11 11 35718 3...

result:

ok 

Test #204:

score: 0
Accepted
time: 136ms
memory: 48208kb

input:

100000 2 100000
47641 2360
32311 27712
96580 5576
74432 69601
5497 90724
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
35990 98338
39222 14744
65183 72902
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
65669 53200
74170 53434
44590 79062
45816 66321
37251 32926
26433 58003
...

output:

2360 47641 
27712 32311 
5576 96580 
69601 74432 
5497 90724 
61408 72215 
23207 86499 
29593 43465 
20236 49534 
95890 83680 
35990 98338 
14744 39222 
65183 72902 
73553 76527 
40936 27695 
96356 68239 
66861 20211 
59817 9499 
53200 65669 
53434 74170 
44590 79062 
66321 45816 
32926 37251 
26433...

result:

ok 

Test #205:

score: 0
Accepted
time: 80ms
memory: 50256kb

input:

99000 2 100
50 76
35 53
70 8
48 61
12 98
81 72
62 87
10 6
61 83
63 42
66 10
7 46
35 66
47 52
30 60
70 33
27 16
32 82
8 28
85 83
95 21
63 84
47 57
89 86
73 69
52 60
72 78
78 61
61 36
3 73
31 50
47 20
69 28
74 34
100 79
99 56
51 43
86 15
38 28
3 94
63 76
19 56
31 90
79 97
3 23
14 44
78 63
99 85
14 50
...

output:

50 76 
53 35 
70 8 
48 61 
12 98 
81 72 
62 87 
6 10 
61 83 
42 63 
10 66 
46 7 
66 35 
52 47 
30 60 
33 70 
16 27 
32 82 
8 28 
83 85 
21 95 
63 84 
47 57 
89 86 
69 73 
60 52 
78 72 
61 78 
36 61 
73 3 
31 50 
20 47 
69 28 
34 74 
79 100 
56 99 
43 51 
86 15 
28 38 
3 94 
76 63 
19 56 
90 31 
97 7...

result:

ok 

Test #206:

score: 0
Accepted
time: 128ms
memory: 46048kb

input:

99000 2 40000
13317 12923
15159 469
15225 23585
11180 1824
7967 39735
13852 38886
33137 27292
21697 28740
9887 13116
25732 33405
9156 39496
24569 31286
12900 32138
2345 1862
18626 2824
19382 25016
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
39650 14279
8842 1957
15206 22521
1...

output:

13317 12923 
469 15159 
15225 23585 
11180 1824 
7967 39735 
38886 13852 
33137 27292 
28740 21697 
9887 13116 
25732 33405 
9156 39496 
24569 31286 
12900 32138 
2345 1862 
18626 2824 
19382 25016 
11342 18721 
296 10236 
8228 37626 
10247 30418 
29998 33581 
21676 4543 
39650 14279 
8842 1957 
152...

result:

ok 

Test #207:

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

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

25002 53479 
63606 53479 
40735 53479 
83340 53479 
40775 53479 
11458 53479 
53479 8684 
60405 53479 
45116 53479 
67722 53479 
26014 53479 
87860 53479 
55147 53479 
22726 53479 
67769 53479 
129 53479 
14600 53479 
21514 53479 
32164 53479 
60088 53479 
25415 53479 
70946 53479 
27091 53479 
3338...

result:

ok 

Test #208:

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

input:

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

output:

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

result:

ok 

Test #209:

score: 0
Accepted
time: 9ms
memory: 5256kb

input:

2500 4 2500
648 780 1555 2479
544 2007 2025 186
2208 783 346 2150
462 975 240 1243
1693 1777 2390 522
1126 1859 505 1731
991 684 1608 751
1605 129 1236 1271
121 1073 2079 409
882 1636 2432 2416
2125 1519 1046 79
315 1906 679 2452
86 669 2191 1467
326 397 286 1986
1299 2409 2259 2166
854 1437 620 330...

output:

648 1555 2479 780 
544 2025 186 2007 
2150 783 346 2208 
462 1243 240 975 
1693 2390 522 1777 
1731 1126 505 1859 
751 684 991 1608 
1236 1605 129 1271 
409 1073 121 2079 
882 2416 1636 2432 
1519 79 1046 2125 
679 1906 315 2452 
86 1467 669 2191 
326 1986 286 397 
1299 2166 2409 2259 
854 620 1437 ...

result:

ok 

Test #210:

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

input:

1250 8 1250
1143 47 853 56 15 316 165 820
768 1167 447 1006 696 621 491 431
301 1068 674 1050 1107 235 256 499
702 264 364 1158 959 489 450 966
972 83 910 399 944 744 202 196
433 893 553 1010 13 847 917 296
199 788 380 1018 442 1066 1064 1059
1206 686 399 975 298 730 439 781
964 398 283 449 241 788 ...

output:

56 165 47 15 1143 820 316 853 
431 447 621 1167 768 491 1006 696 
301 256 674 1107 499 1050 1068 235 
450 1158 264 489 966 702 959 364 
944 910 196 972 83 202 399 744 
296 433 553 13 893 847 1010 917 
199 1059 380 442 788 1066 1064 1018 
686 730 399 439 781 1206 298 975 
788 964 283 788 398 241 449 ...

result:

ok 

Test #211:

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

input:

2500 4 2500
11 34 1064 1548
2120 1668 2 1223
1208 390 12 1204
482 830 1427 2204
312 1940 1551 1432
2282 1122 2271 1334
1702 344 623 224
258 20 288 1335
262 308 1502 992
474 345 2403 2254
1466 930 1281 1642
2151 434 786 1345
64 464 2265 51
2054 274 435 2007
171 867 395 544
1766 358 872 1478
345 474 2...

output:

34 1064 11 1548 
1223 2120 2 1668 
12 390 1204 1208 
830 1427 482 2204 
1551 1940 312 1432 
1334 2282 1122 2271 
224 344 1702 623 
288 258 20 1335 
262 992 308 1502 
474 2254 345 2403 
1281 930 1642 1466 
434 1345 2151 786 
51 64 2265 464 
2007 2054 435 274 
395 867 171 544 
358 872 1766 1478 
345 2...

result:

ok 

Test #212:

score: 0
Accepted
time: 977ms
memory: 63912kb

input:

62400 8 62400
5188 33581 46727 35079 3348 8641 17498 61564
1499 10536 5260 46927 42257 15268 36883 24071
31082 61126 59908 2546 59816 3061 37827 42689
23810 46627 29196 43959 32642 46947 37580 52853
5006 31921 23183 24255 36324 28016 9897 60742
23751 8953 4221 30097 16775 29090 56313 39890
51318 481...

output:

33581 3348 17498 35079 8641 5188 46727 61564 
15268 5260 1499 24071 10536 36883 42257 46927 
59908 37827 3061 31082 2546 59816 61126 42689 
32642 23810 52853 43959 37580 29196 46947 46627 
5006 36324 24255 9897 28016 31921 23183 60742 
16775 8953 30097 56313 4221 29090 39890 23751 
51318 61171 20415...

result:

ok 

Test #213:

score: 0
Accepted
time: 1231ms
memory: 47588kb

input:

488 1024 488
361 52 274 408 68 408 418 219 150 132 313 90 10 252 93 305 248 282 313 92 89 288 275 145 132 418 40 109 120 478 12 422 307 116 20 349 73 61 397 448 170 243 146 114 339 399 219 409 479 263 324 485 355 78 250 54 250 91 177 466 469 91 237 128 329 390 97 265 279 52 274 172 11 108 436 182 48...

output:

174 143 64 454 311 32 34 114 11 435 48 132 117 63 134 214 99 5 302 308 365 41 377 62 125 16 122 161 220 92 20 346 93 190 56 293 66 138 70 98 111 167 30 59 91 101 393 69 250 463 213 149 128 44 230 120 28 223 305 164 227 478 234 349 4 264 109 246 247 110 2 241 81 263 77 274 113 388 52 176 116 72 242 1...

result:

ok 

Test #214:

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

input:

3125 32 500
188 390 285 364 119 368 262 180 41 62 258 496 127 290 336 432 311 497 117 169 172 53 163 87 342 412 465 289 25 437 485 193
261 209 264 96 96 379 114 262 157 150 158 483 237 397 469 124 365 376 446 467 253 50 495 212 15 39 312 239 243 144 441 244
140 250 154 190 141 44 190 420 158 245 115...

output:

127 342 390 53 117 62 119 25 289 432 180 163 496 193 311 285 41 87 188 465 290 497 368 437 172 364 258 485 412 262 169 336 
144 150 114 376 39 237 212 264 158 239 379 253 467 124 209 441 15 261 446 157 243 397 96 50 312 96 495 469 262 244 365 483 
174 190 137 112 109 115 180 250 41 273 44 141 63 190...

result:

ok 

Test #215:

score: 0
Accepted
time: 1001ms
memory: 64248kb

input:

62500 8 62500
46488 52402 21194 39212 48030 31027 19457 19667
28217 23438 19249 49763 2901 28183 50603 11194
12227 36765 49103 12181 16487 48688 49739 61678
51394 13263 45768 56681 1581 48948 46469 40968
41220 28651 46739 56642 31209 20995 20092 15482
20680 8170 6057 46079 30434 58927 39166 24658
54...

output:

39212 31027 52402 19457 21194 19667 48030 46488 
28183 23438 19249 50603 2901 28217 11194 49763 
12227 49739 48688 12181 16487 36765 61678 49103 
40968 13263 1581 45768 46469 51394 48948 56681 
28651 20995 20092 46739 41220 15482 31209 56642 
24658 6057 30434 8170 46079 39166 20680 58927 
31106 5007...

result:

ok 

Test #216:

score: 0
Accepted
time: 962ms
memory: 64636kb

input:

62500 8 62500
5352 15707 5368 54933 21632 60466 37351 23799
46948 9283 34675 19763 9959 24375 51015 61792
13241 51137 21151 47696 38988 34663 29805 49112
31589 24811 28603 33429 38151 53298 52012 14937
25429 45252 47376 61770 59450 30664 10556 55337
16471 49621 21903 37035 17113 46640 47306 30894
45...

output:

5352 23799 5368 21632 15707 37351 54933 60466 
19763 51015 9959 46948 24375 34675 61792 9283 
29805 51137 34663 21151 13241 38988 47696 49112 
14937 31589 33429 53298 28603 38151 52012 24811 
30664 47376 25429 10556 45252 55337 59450 61770 
21903 17113 16471 30894 37035 46640 47306 49621 
4518 22399...

result:

ok 

Test #217:

score: 0
Accepted
time: 1153ms
memory: 45880kb

input:

61 8192 61
60 37 60 38 60 42 60 59 14 29 60 55 60 60 13 60 41 29 15 60 60 4 60 31 60 51 60 13 60 60 27 60 60 60 50 60 60 61 29 60 27 60 60 60 43 60 60 49 38 60 60 59 60 48 4 27 29 54 1 61 60 60 34 59 60 37 13 23 60 22 11 60 26 10 60 40 61 60 38 33 60 22 23 60 60 60 23 57 60 60 43 60 42 43 3 37 46 60...

output:

1 9 36 4 3 32 10 60 56 30 8 28 60 9 60 14 5 6 20 12 7 60 60 41 60 11 60 17 60 20 14 60 6 60 40 60 60 22 60 26 23 60 60 29 15 60 37 60 30 60 49 60 60 28 60 40 60 35 60 42 60 48 60 51 1 34 60 4 31 60 25 60 44 7 60 17 60 18 60 46 60 6 60 11 21 60 35 60 60 19 13 60 45 42 60 49 16 60 22 60 32 60 60 33 60...

result:

ok 

Test #218:

score: 0
Accepted
time: 147ms
memory: 49636kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
79073 63660 
20397 41795 
84311 1296 
21178 3690 
21052 31611 
14323 51423 
82468 34208 
83835 2785 
28274 50594 
59957 10993 
34259 64334 
89407 73934 
14947 61083 
89472 53201 
61243 33351 
76632 58718 
67464 85318 
54224 45096 
76529 84552 
30697 44253 
3108 43669 
26489 64691 
85776 ...

result:

ok 

Test #219:

score: 0
Accepted
time: 851ms
memory: 64384kb

input:

62500 8 62500
1631 47668 41265 13185 25144 29997 4807 14330
44766 52903 23537 27686 25928 49599 20552 27102
46072 43971 2883 50670 5227 40537 5360 31935
21192 11606 4682 7186 27459 22911 7051 53129
31978 41143 24464 48853 55408 7134 15223 54130
41468 35600 14315 7487 13955 12966 27899 22216
14216 84...

output:

1631 4807 13185 29997 14330 41265 25144 47668 
20552 23537 25928 44766 27686 49599 27102 52903 
2883 5360 40537 46072 5227 43971 31935 50670 
4682 7051 21192 22911 7186 27459 11606 53129 
7134 31978 48853 54130 15223 41143 24464 55408 
12966 14315 27899 35600 7487 13955 22216 41468 
14216 45278 4801...

result:

ok 

Test #220:

score: 0
Accepted
time: 144ms
memory: 47728kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

80944 83824 
26621 25208 
28836 57146 
43915 18169 
59242 47842 
78881 34224 
38791 20722 
91046 89723 
72800 40306 
94906 92681 
7263 41151 
13332 76035 
38800 93928 
86055 97168 
73623 44186 
68071 7391 
20692 72265 
44111 42596 
77687 36037 
64592 836 
43568 35187 
88539 34861 
22111 37477 
98028...

result:

ok 

Test #221:

score: 0
Accepted
time: 115ms
memory: 52844kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

92592 91980 
12359 10704 
35873 56718 
28601 20301 
55548 78422 
74736 59974 
29025 81664 
70432 55916 
47381 34185 
56168 31764 
33997 30947 
70076 9029 
67057 52532 
99273 79680 
56704 54410 
45238 71652 
6894 12615 
66478 78041 
5451 40520 
5950 58133 
70551 89237 
97551 36028 
90630 83553 
33690...

result:

ok 

Test #222:

score: 0
Accepted
time: 111ms
memory: 52460kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457 
40457 80634 
49074 21580 
92701 14354 
44540 70461 
47132 47637 
84954 27979 
87556 60683 
43063 22633 
63643 49914 
4494 3571 
53632 88758 
17055 50019 
49334 79039 
67659 50111 
17945 48061 
60323 84596 
72033 14629 
77184 30069 
64209 36217 
49947 35279 
44707 45866 
58484 58146 
139...

result:

ok 

Subtask #10:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Dependency #9:

100%
Accepted

Test #223:

score: 10
Accepted
time: 140ms
memory: 49540kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894 
90327 32116 
63866 29061 
63612 53683 
78264 70370 
76881 42647 
31741 39251 
66491 61186 
57686 65819 
53278 59145 
26052 71962 
55279 81040 
50859 51310 
46800 24546 
85013 91165 
21890 61530 
84003 29099 
86182 33573 
10639 49212 
97312 91851 
57682 14067 
69674 5243 
62508 99007 
26...

result:

ok 

Test #224:

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

input:

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

output:

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

result:

ok 

Test #225:

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

input:

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

output:

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

result:

ok 

Test #226:

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

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

3 2 2 2 
2 3 3 2 
2 2 2 3 

result:

ok 

Test #227:

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

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

26 116 7 123 83 5 12 122 9 114 76 86 36 125 145 95 102 72 128 36 92 151 101 60 80 66 33 29 19 155 89 109 93 123 122 132 140 97 155 3 57 119 62 154 19 14 145 125 55 102 36 125 97 19 62 29 13 109 123 89 104 4 60 89 
113 148 33 84 71 75 4 109 127 13 27 55 154 97 47 93 63 78 150 21 10 25 122 3 93 104 30...

result:

ok 

Test #228:

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

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

5 8 4 6 6 1 8 1 8 6 4 1 8 6 1 1 4 5 8 6 6 1 8 1 5 6 4 8 8 1 1 1 5 8 4 1 8 6 6 1 5 8 6 1 4 8 6 1 4 5 8 1 6 1 6 1 4 8 6 1 8 1 1 1 8 6 4 1 5 4 8 1 5 8 6 1 4 6 8 1 5 6 8 1 4 1 6 1 8 6 4 1 8 1 6 1 5 4 8 6 6 1 8 1 4 8 6 1 6 8 1 1 5 4 6 1 8 1 8 1 8 6 4 1 6 1 1 1 5 4 6 8 8 6 1 1 4 8 6 1 5 8 6 1 4 8 6 1 5 6 ...

result:

ok 

Test #229:

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

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

967 595 1986 1326 
2187 19 880 173 
1645 1179 961 843 
1225 1102 1566 177 
961 1553 354 1065 
625 611 1814 1276 
572 1097 1110 845 
2041 780 2178 1291 
1138 1531 2390 415 
1649 499 584 1131 
1982 752 1296 754 
2295 1627 1853 498 
1647 1282 1628 974 
2321 1271 265 2097 
2252 123 1776 1161 
723 487 43...

result:

ok 

Test #230:

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

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

2 1 
2 2 
1 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 2 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
2 1 
1 1 
1 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
1 1 
2 2 
1 1 
2 1 
2 2 
1 2 
1 1 
2 1 
1 1 
2 2 
1 2 
2 1 
1 2 
2 2 
2 1 
2 2 
1 1 
1 2 
2 1 
1 2 
2 1 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
1 1 
2 2 
1 2 
2 1 
2 2 
2 2 
1 2 
...

result:

ok 

Test #231:

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

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2970 2674 
1208 2674 
4977 2674 
3028 2674 
36 2674 
1712 2674 
3561 2674 
3033 2674 
4699 2674 
1785 2674 
4345 2674 
3302 2674 
2493 2674 
4280 2674 
3999 2674 
4850 2674 
4508 2674 
3742 2674 
2718 2674 
3461 2674 
260 2674 
4223 2674 
2069 2674 
1144 2674 
1975 2674 
527 2674 
3260 2674 
2806 26...

result:

ok 

Test #232:

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

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

657 317 793 417 
1237 1990 507 1460 
1155 1030 1744 1114 
486 1284 2376 868 
2391 1441 704 665 
1283 1607 173 789 
2192 1309 1045 1466 
734 284 254 766 
1752 1181 1814 937 
1638 2346 1329 1459 
1205 1744 1155 443 
1098 1096 1050 430 
1622 2224 186 930 
2196 1772 1833 1916 
757 739 2066 114 
1180 996...

result:

ok 

Test #233:

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

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

926 833 788 67 830 795 580 861 
701 227 566 768 421 582 113 823 
981 868 494 76 745 910 644 188 
409 742 771 572 210 751 665 875 
151 131 455 298 387 145 442 3 
550 672 118 74 250 694 85 78 
857 855 695 533 944 977 431 807 
787 432 881 615 523 649 789 742 
538 159 114 894 42 29 942 619 
355 558 834 ...

result:

ok 

Test #234:

score: 0
Accepted
time: 132ms
memory: 49372kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

59126 27085 
75021 23663 
67175 78883 
90698 3919 
67504 20718 
49374 44011 
1660 3236 
71971 79270 
24502 90540 
54202 9732 
88659 14395 
52635 56600 
21912 17986 
56526 92420 
40254 3472 
64330 20431 
9381 56003 
57750 45529 
45230 9388 
83797 53437 
75562 47526 
45219 63126 
87437 71020 
50298 20...

result:

ok 

Test #235:

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

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

161 969 1246 981 374 598 761 131 
257 674 658 837 826 749 119 163 
863 1166 891 929 733 564 802 207 
964 202 400 311 507 314 233 77 
445 1247 376 709 388 1093 408 71 
48 1020 468 19 581 566 966 403 
479 946 1201 730 822 703 132 785 
37 861 188 183 349 1202 18 731 
882 1226 896 648 523 333 614 126 
9...

result:

ok 

Test #236:

score: 0
Accepted
time: 8ms
memory: 7416kb

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

2334 540 1156 475 
1328 2439 2421 750 
471 2007 1792 1051 
2269 1776 786 705 
1674 1277 755 1622 
1217 590 1378 603 
1920 239 967 1658 
2307 78 857 1589 
2172 2322 861 1634 
2077 2179 2021 1381 
1547 1126 2126 345 
994 1477 412 1214 
1857 831 2085 978 
2406 1844 281 2174 
1779 521 2334 2254 
1508 19...

result:

ok 

Test #237:

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

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

2 3 2 1 
1429 1 1 1429 
4 7 4 3 
3 1430 3 1430 
1 6 6 5 
5 1431 5 1431 
8 11 8 7 
7 1432 7 1432 
10 5 10 9 
1433 9 9 1433 
12 15 12 11 
11 1434 11 1434 
9 14 14 13 
13 1435 13 1435 
16 19 16 15 
15 1436 15 1436 
18 13 18 17 
1437 17 17 1437 
20 23 20 19 
19 1438 19 1438 
17 22 22 21 
21 1439 21 1439...

result:

ok 

Test #238:

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

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773 
1582 462 
208 1171 
74 4865 
1018 10 
1962 2532 
578 1491 
4567 1140 
3640 4785 
1051 3325 
4545 2135 
286 1152 
4874 309 
1953 3646 
1794 234 
1223 3529 
1002 3751 
3427 4740 
2554 4638 
1988 933 
1846 3177 
2440 2671 
3502 1315 
2669 1382 
3145 443 
2418 438 
1154 420 
671 3875 
1807 31...

result:

ok 

Test #239:

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

input:

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

output:

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

result:

ok 

Test #240:

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

input:

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

output:

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

result:

ok 

Test #241:

score: 0
Accepted
time: 875ms
memory: 73524kb

input:

62400 8 62400
617 61873 50005 41067 20321 15682 32071 28672
22133 8305 52336 45992 33172 47471 17329 39927
42134 45570 15289 42551 55858 19194 10715 10649
8176 5735 13244 20965 61861 7073 12818 5527
21000 8783 29108 17636 58752 9701 42134 11867
35793 5665 25545 53912 41719 7606 30422 4734
6540 43594...

output:

20321 617 28672 50005 61873 32071 41067 15682 
33172 8305 52336 39927 47471 22133 45992 17329 
55858 45570 42551 10715 19194 15289 10649 42134 
13244 12818 7073 8176 61861 5735 5527 20965 
11867 8783 17636 58752 21000 42134 9701 29108 
30422 25545 35793 7606 41719 53912 5665 4734 
6540 20671 4918 77...

result:

ok 

Test #242:

score: 0
Accepted
time: 1192ms
memory: 44364kb

input:

488 1024 488
437 386 352 3 204 235 111 327 270 195 436 108 324 319 398 484 177 270 133 272 484 202 67 380 1 215 36 327 104 412 432 67 157 455 286 196 62 262 437 4 289 108 272 402 136 265 291 48 135 182 385 319 112 186 70 50 273 196 231 195 17 319 178 270 132 424 78 406 324 346 57 71 97 186 396 422 3...

output:

300 69 341 277 129 476 398 426 368 125 466 236 93 396 350 357 18 134 467 271 353 339 418 383 100 174 456 297 262 356 30 414 97 179 483 301 168 187 470 255 358 198 55 113 215 158 90 189 385 471 147 308 445 366 86 440 306 229 439 404 447 355 78 130 22 172 160 9 184 269 415 486 319 167 107 329 441 402 ...

result:

ok 

Test #243:

score: 0
Accepted
time: 166ms
memory: 11208kb

input:

6 16384 6
2 5 1 6 5 2 5 1 6 1 5 5 6 5 5 6 2 6 2 1 6 6 5 5 6 5 2 2 1 1 1 6 5 1 5 6 6 2 6 1 2 6 6 2 2 1 6 6 6 1 5 5 1 5 5 6 2 5 1 5 1 5 1 2 5 1 1 6 5 6 5 2 1 1 6 1 6 6 5 5 5 1 5 6 2 5 6 5 5 6 6 6 2 5 5 6 2 5 6 1 5 6 6 2 2 5 1 2 5 5 6 5 6 6 1 1 2 2 5 5 6 5 6 5 5 1 6 6 6 6 1 6 5 6 5 2 6 6 6 5 5 6 6 6 6 ...

output:

6 2 6 5 2 6 5 1 2 5 6 5 6 5 6 1 2 6 6 5 2 6 5 1 2 6 5 1 6 5 5 1 2 6 6 5 2 6 5 1 2 5 6 5 6 5 6 1 2 6 6 5 6 5 5 1 2 6 5 1 6 5 5 1 2 5 6 5 2 6 5 1 2 6 6 5 6 5 5 1 2 5 6 5 6 5 6 1 2 6 5 1 6 5 6 1 2 5 6 5 2 6 5 1 2 6 5 1 6 5 6 1 2 6 6 5 6 5 5 1 2 6 5 1 6 5 5 1 2 6 6 5 2 6 5 1 2 6 6 5 6 5 5 1 2 6 6 5 2 6 ...

result:

ok 

Test #244:

score: 0
Accepted
time: 288ms
memory: 20744kb

input:

6035 32 3126
2384 1507 1419 2790 466 3034 613 391 1142 1913 2728 1770 1249 2719 457 1720 2670 541 568 1711 1147 1498 2929 1920 2067 351 2089 1076 3001 2562 2615 1630
1719 1848 849 3098 1026 1016 2612 2228 526 2395 1808 1898 1626 2249 2857 1473 2360 2448 1450 1045 55 2166 2597 1586 1181 540 789 612 1...

output:

1249 1498 1076 2384 466 2670 2728 2615 391 351 1920 1720 2790 1711 3001 1142 1419 2929 457 1630 2089 613 1770 568 541 2719 3034 2067 1147 1913 1507 2562 
2448 2395 612 1719 1026 335 55 2857 2612 1579 1626 1045 1586 1808 849 540 1848 1450 1898 2828 2597 1473 789 2228 1016 2166 526 1181 2360 3098 2249...

result:

ok 

Test #245:

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

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

13223 16598 
18759 19981 
8681 2642 
18080 4102 
16749 11473 
15290 690 
16229 17900 
10684 17481 
12171 6328 
9417 1150 
5689 7185 
17102 10346 
17958 9727 
13756 2117 
13157 10955 
2840 245 
5257 5337 
6429 16622 
17516 10772 
13007 19349 
2821 11359 
14341 8897 
2482 3974 
16241 17966 
15458 1814...

result:

ok 

Test #246:

score: 0
Accepted
time: 1007ms
memory: 40196kb

input:

442 1024 442
204 189 272 54 225 232 246 111 211 39 140 31 133 213 40 172 5 229 225 147 176 81 31 108 40 148 128 210 21 262 105 163 228 247 259 161 184 211 3 211 261 277 70 186 27 195 89 282 233 258 169 215 154 267 21 239 264 213 91 131 295 39 163 282 254 63 286 282 9 116 139 285 76 206 85 233 73 180...

output:

109 70 12 51 116 43 261 18 209 127 147 169 190 39 36 121 233 144 180 142 22 15 146 75 3 242 226 94 21 41 273 225 250 11 172 113 27 272 110 56 246 220 266 251 6 294 173 7 134 249 9 211 295 60 44 92 288 50 255 52 84 187 126 129 285 258 271 208 160 112 245 241 106 161 171 184 117 196 132 55 123 118 119...

result:

ok 

Test #247:

score: 0
Accepted
time: 877ms
memory: 69116kb

input:

59767 8 50000
14021 37442 6924 2683 26908 28108 49331 4157
37602 8443 19287 12234 4215 29554 33860 1201
2453 34206 48003 47930 30310 48979 24906 2040
19079 30112 42351 26155 23394 37361 37618 35224
18576 29106 48671 22449 25578 19435 4011 7931
7174 13442 3382 24117 23309 31964 19031 45122
33083 3854...

output:

26908 2683 37442 49331 28108 14021 4157 6924 
4215 12234 8443 1201 37602 33860 19287 29554 
48003 30310 2453 2040 34206 24906 48979 47930 
37618 42351 30112 23394 37361 26155 19079 35224 
29106 25578 7931 48671 18576 19435 22449 4011 
23309 24117 7174 19031 13442 45122 3382 31964 
16358 5388 33083 4...

result:

ok 

Test #248:

score: 0
Accepted
time: 1087ms
memory: 73788kb

input:

62500 8 62500
51504 53517 18444 47810 55743 52115 39033 39945
39582 40153 48723 405 57762 57932 38589 34957
46544 29639 46926 5502 36080 4497 12837 5415
40364 54270 15841 56968 20512 49512 23271 29535
32613 29997 43963 8109 43144 40423 38621 31273
32431 16718 11192 30443 19278 38857 30834 60796
1958...

output:

39033 51504 18444 55743 52115 47810 39945 53517 
38589 405 57932 39582 48723 57762 34957 40153 
4497 29639 5502 12837 5415 46926 36080 46544 
20512 54270 29535 56968 15841 49512 40364 23271 
43963 38621 43144 32613 8109 31273 40423 29997 
11192 38857 16718 60796 30834 30443 19278 32431 
48478 44729 ...

result:

ok 

Test #249:

score: 0
Accepted
time: 1155ms
memory: 46096kb

input:

61 8192 61
47 47 47 47 47 36 36 47 36 36 36 47 36 47 36 47 47 36 36 36 47 36 36 36 47 36 47 47 47 36 47 36 36 47 47 36 47 47 47 47 47 47 36 36 36 47 47 21 36 36 36 36 47 47 36 47 36 47 47 47 36 47 47 47 47 36 36 47 36 47 36 47 47 36 47 47 36 47 47 36 36 36 36 36 47 36 36 36 36 47 36 47 36 47 47 36 3...

output:

25 36 36 47 47 32 47 36 36 47 45 36 36 47 36 47 47 36 36 47 36 47 36 47 36 47 36 47 47 19 47 36 36 43 36 47 13 47 47 36 18 36 47 36 36 47 47 36 36 47 36 47 36 47 47 36 47 36 36 47 36 47 47 36 47 4 36 36 36 47 36 20 36 47 47 36 47 36 36 47 36 47 36 47 36 47 47 36 47 26 36 47 36 47 47 36 47 36 36 47 4...

result:

ok 

Test #250:

score: 0
Accepted
time: 891ms
memory: 36736kb

input:

50 8192 50
40 29 20 40 40 40 20 40 40 40 40 49 20 20 40 40 20 40 40 20 20 20 40 20 40 40 20 20 40 40 40 40 40 20 40 40 40 40 40 40 20 40 20 40 20 40 40 20 40 40 20 20 40 20 40 40 20 40 40 40 20 19 40 40 40 40 20 40 20 40 20 20 20 20 20 20 20 40 20 40 20 20 20 40 40 40 40 40 40 40 20 20 40 20 20 40 4...

output:

20 15 20 36 41 40 40 20 27 40 20 40 20 18 20 40 40 20 20 40 28 20 20 40 20 40 20 40 40 20 20 40 40 48 20 44 9 40 20 40 20 40 20 40 20 40 40 20 19 40 20 40 20 40 40 20 20 40 20 40 20 40 20 40 20 40 40 20 40 21 20 40 20 40 20 40 40 22 20 40 20 40 7 40 40 20 20 40 20 40 40 20 20 40 40 20 20 40 20 40 20...

result:

ok 

Test #251:

score: 0
Accepted
time: 747ms
memory: 60772kb

input:

56000 8 50000
38540 29053 29109 38746 29288 38450 43383 32332
14057 662 19282 8910 49216 18920 32722 25913
4461 24280 3328 17870 569 37854 3246 27991
35958 21836 18035 12840 25641 36792 21982 33634
6456 49901 35635 42812 24541 44145 8939 11926
29442 26462 18739 27152 42797 5777 15117 19193
40156 501...

output:

29288 38540 32332 29109 29053 43383 38746 38450 
25913 8910 49216 14057 19282 18920 32722 662 
37854 4461 27991 17870 24280 3246 3328 569 
35958 21982 36792 18035 21836 33634 12840 25641 
11926 42812 49901 24541 44145 35635 6456 8939 
29442 42797 15117 18739 27152 19193 26462 5777 
40156 44159 36892...

result:

ok 

Test #252:

score: 0
Accepted
time: 929ms
memory: 71480kb

input:

61952 8 61952
31143 31143 3756 34556 4617 49727 3756 48229
48054 10150 10150 1113 46750 1113 11148 44687
18150 50774 34447 50642 31286 44185 50642 18150
18803 8000 20838 21039 20764 18803 20764 56246
59196 9154 49057 7963 47927 59196 59996 7963
27925 33037 27925 25590 4557 12519 33037 21779
9336 551...

output:

3756 48229 31143 4617 49727 34556 31143 3756 
44687 1113 10150 46750 1113 10150 48054 11148 
31286 34447 18150 50642 44185 50774 18150 50642 
20838 20764 18803 56246 21039 18803 20764 8000 
59196 7963 47927 49057 59196 9154 7963 59996 
21779 25590 33037 12519 27925 33037 27925 4557 
56435 9336 28094...

result:

ok 

Test #253:

score: 0
Accepted
time: 232ms
memory: 73836kb

input:

99995 4 99995
1 2 28571 28571
2 4 28572 28572
3 1 28573 28573
4 6 28574 28574
5 3 28575 28575
6 8 28576 28576
7 5 28577 28577
8 10 28578 28578
9 7 28579 28579
10 12 28580 28580
11 9 28581 28581
12 14 28582 28582
13 11 28583 28583
14 16 28584 28584
15 13 28585 28585
16 18 28586 28586
17 15 28587 2858...

output:

2 28571 28571 1 
4 28572 28572 2 
28573 1 28573 3 
6 28574 28574 4 
3 28575 28575 5 
8 28576 28576 6 
28577 5 28577 7 
10 28578 28578 8 
7 28579 28579 9 
12 28580 28580 10 
28581 9 28581 11 
14 28582 28582 12 
11 28583 28583 13 
16 28584 28584 14 
28585 13 28585 15 
18 28586 28586 16 
15 28587 28587...

result:

ok 

Test #254:

score: 0
Accepted
time: 242ms
memory: 75728kb

input:

99995 4 99995
1 2 2 3
57141 1 1 57141
3 4 4 7
57142 3 3 57142
5 6 6 1
57143 5 5 57143
7 8 8 11
57144 7 7 57144
9 10 10 5
57145 9 9 57145
11 12 12 15
57146 11 11 57146
13 14 14 9
57147 13 13 57147
15 16 16 19
57148 15 15 57148
17 18 18 13
57149 17 17 57149
19 20 20 23
57150 19 19 57150
21 22 22 17
57...

output:

2 3 2 1 
57141 1 1 57141 
4 7 4 3 
3 57142 3 57142 
1 6 6 5 
5 57143 5 57143 
8 11 8 7 
7 57144 7 57144 
10 5 10 9 
57145 9 9 57145 
12 15 12 11 
11 57146 11 57146 
9 14 14 13 
13 57147 13 57147 
16 19 16 15 
15 57148 15 57148 
18 13 18 17 
57149 17 17 57149 
20 23 20 19 
19 57150 19 57150 
17 22 22...

result:

ok 

Test #255:

score: 0
Accepted
time: 249ms
memory: 73040kb

input:

99995 4 99995
71425 71425 99994 99995
71424 71424 99992 99994
71423 71423 99995 99993
71422 71422 99990 99992
71421 71421 99993 99991
71420 71420 99988 99990
71419 71419 99991 99989
71418 71418 99986 99988
71417 71417 99989 99987
71416 71416 99984 99986
71415 71415 99987 99985
71414 71414 99982 9998...

output:

99995 71425 99994 71425 
99994 71424 99992 71424 
99993 71423 71423 99995 
99992 71422 99990 71422 
99991 71421 99993 71421 
99990 71420 99988 71420 
99989 71419 71419 99991 
99988 71418 99986 71418 
99987 71417 99989 71417 
99986 71416 99984 71416 
99985 71415 71415 99987 
99984 71414 99982 71414 
...

result:

ok 

Test #256:

score: 0
Accepted
time: 73ms
memory: 50632kb

input:

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

output:

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

result:

ok 

Test #257:

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

input:

99995 4 99995
99993 99994 99994 99995
42855 99995 99995 42855
99989 99992 99992 99993
42854 99993 99993 42854
99995 99990 99990 99991
42853 99991 99991 42853
99985 99988 99988 99989
42852 99989 99989 42852
99991 99986 99986 99987
42851 99987 99987 42851
99981 99984 99984 99985
42850 99985 99985 4285...

output:

99993 99994 99995 99994 
99995 42855 42855 99995 
99989 99992 99993 99992 
42854 99993 42854 99993 
99990 99995 99991 99990 
42853 99991 42853 99991 
99985 99988 99989 99988 
42852 99989 42852 99989 
99991 99986 99987 99986 
99987 42851 42851 99987 
99981 99984 99985 99984 
42850 99985 42850 99985 
...

result:

ok 

Test #258:

score: 0
Accepted
time: 269ms
memory: 73076kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 85710 71425 
85709 71424 71424 85709 
85708 71423 71423 85708 
85707 71422 71422 85707 
85706 71421 85706 71421 
85705 71420 71420 85705 
85704 71419 71419 85704 
85703 71418 71418 85703 
85702 71417 85702 71417 
85701 71416 71416 85701 
85700 71415 71415 85700 
85699 71414 71414 85699 
...

result:

ok 

Test #259:

score: 0
Accepted
time: 245ms
memory: 73152kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 71425 85710 
85709 71424 85709 71424 
85708 71423 85708 71423 
85707 71422 85707 71422 
85706 71421 71421 85706 
85705 71420 85705 71420 
85704 71419 85704 71419 
85703 71418 85703 71418 
85702 71417 71417 85702 
85701 71416 85701 71416 
85700 71415 85700 71415 
85699 71414 85699 71414 
...

result:

ok 

Test #260:

score: 0
Accepted
time: 232ms
memory: 73168kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
28572 14287 28572 14287 
28573 14288 28573 14288 
28574 14289 28574 14289 
14290 28575 28575 14290 
28576 14291 28576 14291 
28577 14292 28577 14292 
28578 14293 28578 14293 
14294 28579 28579 14294 
28580 14295 28580 14295 
28581 14296 28581 14296 
28582 14297 28582 14297 
...

result:

ok 

Test #261:

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

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
28572 14287 28572 14287 
28573 14288 28573 14288 
28574 14289 28574 14289 
14290 28575 28575 14290 
28576 14291 28576 14291 
28577 14292 28577 14292 
28578 14293 28578 14293 
14294 28579 28579 14294 
28580 14295 28580 14295 
28581 14296 28581 14296 
28582 14297 28582 14297 
...

result:

ok 

Test #262:

score: 0
Accepted
time: 378ms
memory: 65700kb

input:

62496 8 62496
1 1 2 2 17857 17857 17857 17857
2 2 4 4 17858 17858 17858 17858
3 3 1 1 17859 17859 17859 17859
4 4 6 6 17860 17860 17860 17860
5 5 3 3 17861 17861 17861 17861
6 6 8 8 17862 17862 17862 17862
7 7 5 5 17863 17863 17863 17863
8 8 10 10 17864 17864 17864 17864
9 9 7 7 17865 17865 17865 17...

output:

17857 2 17857 1 17857 2 17857 1 
17858 4 17858 2 17858 4 17858 2 
17859 1 17859 3 17859 1 17859 3 
17860 6 17860 4 17860 6 17860 4 
17861 3 17861 5 17861 3 17861 5 
17862 8 17862 6 17862 8 17862 6 
17863 5 17863 7 17863 5 17863 7 
17864 10 17864 8 17864 10 17864 8 
17865 7 17865 9 17865 7 17865 9 
1...

result:

ok 

Test #263:

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

input:

62496 8 62496
1 3 2 2 2 2 1 3
35713 35713 1 1 1 1 35713 35713
3 7 4 4 4 4 3 7
35714 35714 3 3 3 3 35714 35714
5 1 6 6 6 6 5 1
35715 35715 5 5 5 5 35715 35715
7 11 8 8 8 8 7 11
35716 35716 7 7 7 7 35716 35716
9 5 10 10 10 10 9 5
35717 35717 9 9 9 9 35717 35717
11 15 12 12 12 12 11 15
35718 35718 11 1...

output:

3 2 2 1 3 2 2 1 
35713 1 1 35713 35713 1 1 35713 
7 4 4 3 7 4 4 3 
35714 3 3 35714 35714 3 3 35714 
1 6 6 5 1 6 6 5 
35715 5 5 35715 35715 5 5 35715 
11 8 8 7 11 8 8 7 
35716 7 7 35716 35716 7 7 35716 
5 10 10 9 5 10 10 9 
35717 9 9 35717 35717 9 9 35717 
15 12 12 11 15 12 12 11 
35718 11 11 35718 3...

result:

ok 

Test #264:

score: 0
Accepted
time: 147ms
memory: 48384kb

input:

100000 2 100000
47641 2360
32311 27712
96580 5576
74432 69601
5497 90724
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
35990 98338
39222 14744
65183 72902
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
65669 53200
74170 53434
44590 79062
45816 66321
37251 32926
26433 58003
...

output:

2360 47641 
27712 32311 
5576 96580 
69601 74432 
5497 90724 
61408 72215 
23207 86499 
29593 43465 
20236 49534 
95890 83680 
35990 98338 
14744 39222 
65183 72902 
73553 76527 
40936 27695 
96356 68239 
66861 20211 
59817 9499 
53200 65669 
53434 74170 
44590 79062 
66321 45816 
32926 37251 
26433...

result:

ok 

Test #265:

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

input:

99000 2 100
50 76
35 53
70 8
48 61
12 98
81 72
62 87
10 6
61 83
63 42
66 10
7 46
35 66
47 52
30 60
70 33
27 16
32 82
8 28
85 83
95 21
63 84
47 57
89 86
73 69
52 60
72 78
78 61
61 36
3 73
31 50
47 20
69 28
74 34
100 79
99 56
51 43
86 15
38 28
3 94
63 76
19 56
31 90
79 97
3 23
14 44
78 63
99 85
14 50
...

output:

50 76 
53 35 
70 8 
48 61 
12 98 
81 72 
62 87 
6 10 
61 83 
42 63 
10 66 
46 7 
66 35 
52 47 
30 60 
33 70 
16 27 
32 82 
8 28 
83 85 
21 95 
63 84 
47 57 
89 86 
69 73 
60 52 
78 72 
61 78 
36 61 
73 3 
31 50 
20 47 
69 28 
34 74 
79 100 
56 99 
43 51 
86 15 
28 38 
3 94 
76 63 
19 56 
90 31 
97 7...

result:

ok 

Test #266:

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

input:

99000 2 40000
13317 12923
15159 469
15225 23585
11180 1824
7967 39735
13852 38886
33137 27292
21697 28740
9887 13116
25732 33405
9156 39496
24569 31286
12900 32138
2345 1862
18626 2824
19382 25016
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
39650 14279
8842 1957
15206 22521
1...

output:

13317 12923 
469 15159 
15225 23585 
11180 1824 
7967 39735 
38886 13852 
33137 27292 
28740 21697 
9887 13116 
25732 33405 
9156 39496 
24569 31286 
12900 32138 
2345 1862 
18626 2824 
19382 25016 
11342 18721 
296 10236 
8228 37626 
10247 30418 
29998 33581 
21676 4543 
39650 14279 
8842 1957 
152...

result:

ok 

Test #267:

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

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

25002 53479 
63606 53479 
40735 53479 
83340 53479 
40775 53479 
11458 53479 
53479 8684 
60405 53479 
45116 53479 
67722 53479 
26014 53479 
87860 53479 
55147 53479 
22726 53479 
67769 53479 
129 53479 
14600 53479 
21514 53479 
32164 53479 
60088 53479 
25415 53479 
70946 53479 
27091 53479 
3338...

result:

ok 

Test #268:

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

input:

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

output:

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

result:

ok 

Test #269:

score: 0
Accepted
time: 9ms
memory: 7452kb

input:

2500 4 2500
648 780 1555 2479
544 2007 2025 186
2208 783 346 2150
462 975 240 1243
1693 1777 2390 522
1126 1859 505 1731
991 684 1608 751
1605 129 1236 1271
121 1073 2079 409
882 1636 2432 2416
2125 1519 1046 79
315 1906 679 2452
86 669 2191 1467
326 397 286 1986
1299 2409 2259 2166
854 1437 620 330...

output:

648 1555 2479 780 
544 2025 186 2007 
2150 783 346 2208 
462 1243 240 975 
1693 2390 522 1777 
1731 1126 505 1859 
751 684 991 1608 
1236 1605 129 1271 
409 1073 121 2079 
882 2416 1636 2432 
1519 79 1046 2125 
679 1906 315 2452 
86 1467 669 2191 
326 1986 286 397 
1299 2166 2409 2259 
854 620 1437 ...

result:

ok 

Test #270:

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

input:

1250 8 1250
1143 47 853 56 15 316 165 820
768 1167 447 1006 696 621 491 431
301 1068 674 1050 1107 235 256 499
702 264 364 1158 959 489 450 966
972 83 910 399 944 744 202 196
433 893 553 1010 13 847 917 296
199 788 380 1018 442 1066 1064 1059
1206 686 399 975 298 730 439 781
964 398 283 449 241 788 ...

output:

56 165 47 15 1143 820 316 853 
431 447 621 1167 768 491 1006 696 
301 256 674 1107 499 1050 1068 235 
450 1158 264 489 966 702 959 364 
944 910 196 972 83 202 399 744 
296 433 553 13 893 847 1010 917 
199 1059 380 442 788 1066 1064 1018 
686 730 399 439 781 1206 298 975 
788 964 283 788 398 241 449 ...

result:

ok 

Test #271:

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

input:

2500 4 2500
11 34 1064 1548
2120 1668 2 1223
1208 390 12 1204
482 830 1427 2204
312 1940 1551 1432
2282 1122 2271 1334
1702 344 623 224
258 20 288 1335
262 308 1502 992
474 345 2403 2254
1466 930 1281 1642
2151 434 786 1345
64 464 2265 51
2054 274 435 2007
171 867 395 544
1766 358 872 1478
345 474 2...

output:

34 1064 11 1548 
1223 2120 2 1668 
12 390 1204 1208 
830 1427 482 2204 
1551 1940 312 1432 
1334 2282 1122 2271 
224 344 1702 623 
288 258 20 1335 
262 992 308 1502 
474 2254 345 2403 
1281 930 1642 1466 
434 1345 2151 786 
51 64 2265 464 
2007 2054 435 274 
395 867 171 544 
358 872 1766 1478 
345 2...

result:

ok 

Test #272:

score: 0
Accepted
time: 1074ms
memory: 63780kb

input:

62400 8 62400
5188 33581 46727 35079 3348 8641 17498 61564
1499 10536 5260 46927 42257 15268 36883 24071
31082 61126 59908 2546 59816 3061 37827 42689
23810 46627 29196 43959 32642 46947 37580 52853
5006 31921 23183 24255 36324 28016 9897 60742
23751 8953 4221 30097 16775 29090 56313 39890
51318 481...

output:

33581 3348 17498 35079 8641 5188 46727 61564 
15268 5260 1499 24071 10536 36883 42257 46927 
59908 37827 3061 31082 2546 59816 61126 42689 
32642 23810 52853 43959 37580 29196 46947 46627 
5006 36324 24255 9897 28016 31921 23183 60742 
16775 8953 30097 56313 4221 29090 39890 23751 
51318 61171 20415...

result:

ok 

Test #273:

score: 0
Accepted
time: 1229ms
memory: 45536kb

input:

488 1024 488
361 52 274 408 68 408 418 219 150 132 313 90 10 252 93 305 248 282 313 92 89 288 275 145 132 418 40 109 120 478 12 422 307 116 20 349 73 61 397 448 170 243 146 114 339 399 219 409 479 263 324 485 355 78 250 54 250 91 177 466 469 91 237 128 329 390 97 265 279 52 274 172 11 108 436 182 48...

output:

174 143 64 454 311 32 34 114 11 435 48 132 117 63 134 214 99 5 302 308 365 41 377 62 125 16 122 161 220 92 20 346 93 190 56 293 66 138 70 98 111 167 30 59 91 101 393 69 250 463 213 149 128 44 230 120 28 223 305 164 227 478 234 349 4 264 109 246 247 110 2 241 81 263 77 274 113 388 52 176 116 72 242 1...

result:

ok 

Test #274:

score: 0
Accepted
time: 131ms
memory: 14564kb

input:

3125 32 500
188 390 285 364 119 368 262 180 41 62 258 496 127 290 336 432 311 497 117 169 172 53 163 87 342 412 465 289 25 437 485 193
261 209 264 96 96 379 114 262 157 150 158 483 237 397 469 124 365 376 446 467 253 50 495 212 15 39 312 239 243 144 441 244
140 250 154 190 141 44 190 420 158 245 115...

output:

127 342 390 53 117 62 119 25 289 432 180 163 496 193 311 285 41 87 188 465 290 497 368 437 172 364 258 485 412 262 169 336 
144 150 114 376 39 237 212 264 158 239 379 253 467 124 209 441 15 261 446 157 243 397 96 50 312 96 495 469 262 244 365 483 
174 190 137 112 109 115 180 250 41 273 44 141 63 190...

result:

ok 

Test #275:

score: 0
Accepted
time: 1141ms
memory: 64400kb

input:

62500 8 62500
46488 52402 21194 39212 48030 31027 19457 19667
28217 23438 19249 49763 2901 28183 50603 11194
12227 36765 49103 12181 16487 48688 49739 61678
51394 13263 45768 56681 1581 48948 46469 40968
41220 28651 46739 56642 31209 20995 20092 15482
20680 8170 6057 46079 30434 58927 39166 24658
54...

output:

39212 31027 52402 19457 21194 19667 48030 46488 
28183 23438 19249 50603 2901 28217 11194 49763 
12227 49739 48688 12181 16487 36765 61678 49103 
40968 13263 1581 45768 46469 51394 48948 56681 
28651 20995 20092 46739 41220 15482 31209 56642 
24658 6057 30434 8170 46079 39166 20680 58927 
31106 5007...

result:

ok 

Test #276:

score: 0
Accepted
time: 1064ms
memory: 64992kb

input:

62500 8 62500
5352 15707 5368 54933 21632 60466 37351 23799
46948 9283 34675 19763 9959 24375 51015 61792
13241 51137 21151 47696 38988 34663 29805 49112
31589 24811 28603 33429 38151 53298 52012 14937
25429 45252 47376 61770 59450 30664 10556 55337
16471 49621 21903 37035 17113 46640 47306 30894
45...

output:

5352 23799 5368 21632 15707 37351 54933 60466 
19763 51015 9959 46948 24375 34675 61792 9283 
29805 51137 34663 21151 13241 38988 47696 49112 
14937 31589 33429 53298 28603 38151 52012 24811 
30664 47376 25429 10556 45252 55337 59450 61770 
21903 17113 16471 30894 37035 46640 47306 49621 
4518 22399...

result:

ok 

Test #277:

score: 0
Accepted
time: 1160ms
memory: 46044kb

input:

61 8192 61
60 37 60 38 60 42 60 59 14 29 60 55 60 60 13 60 41 29 15 60 60 4 60 31 60 51 60 13 60 60 27 60 60 60 50 60 60 61 29 60 27 60 60 60 43 60 60 49 38 60 60 59 60 48 4 27 29 54 1 61 60 60 34 59 60 37 13 23 60 22 11 60 26 10 60 40 61 60 38 33 60 22 23 60 60 60 23 57 60 60 43 60 42 43 3 37 46 60...

output:

1 9 36 4 3 32 10 60 56 30 8 28 60 9 60 14 5 6 20 12 7 60 60 41 60 11 60 17 60 20 14 60 6 60 40 60 60 22 60 26 23 60 60 29 15 60 37 60 30 60 49 60 60 28 60 40 60 35 60 42 60 48 60 51 1 34 60 4 31 60 25 60 44 7 60 17 60 18 60 46 60 6 60 11 21 60 35 60 60 19 13 60 45 42 60 49 16 60 22 60 32 60 60 33 60...

result:

ok 

Test #278:

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

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
79073 63660 
20397 41795 
84311 1296 
21178 3690 
21052 31611 
14323 51423 
82468 34208 
83835 2785 
28274 50594 
59957 10993 
34259 64334 
89407 73934 
14947 61083 
89472 53201 
61243 33351 
76632 58718 
67464 85318 
54224 45096 
76529 84552 
30697 44253 
3108 43669 
26489 64691 
85776 ...

result:

ok 

Test #279:

score: 0
Accepted
time: 926ms
memory: 64412kb

input:

62500 8 62500
1631 47668 41265 13185 25144 29997 4807 14330
44766 52903 23537 27686 25928 49599 20552 27102
46072 43971 2883 50670 5227 40537 5360 31935
21192 11606 4682 7186 27459 22911 7051 53129
31978 41143 24464 48853 55408 7134 15223 54130
41468 35600 14315 7487 13955 12966 27899 22216
14216 84...

output:

1631 4807 13185 29997 14330 41265 25144 47668 
20552 23537 25928 44766 27686 49599 27102 52903 
2883 5360 40537 46072 5227 43971 31935 50670 
4682 7051 21192 22911 7186 27459 11606 53129 
7134 31978 48853 54130 15223 41143 24464 55408 
12966 14315 27899 35600 7487 13955 22216 41468 
14216 45278 4801...

result:

ok 

Test #280:

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

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
3 2 
2 3 

result:

ok 

Test #281:

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

input:

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

output:

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

result:

ok 

Test #282:

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

input:

20 2 12
12 11
1 9
12 12
3 4
3 9
8 3
8 11
10 9
4 3
6 7
11 6
11 3
7 10
12 10
11 10
11 11
11 2
1 12
6 12
2 7

output:

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

result:

ok 

Test #283:

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

input:

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

output:

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

result:

ok 

Test #284:

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

input:

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

output:

13 1 
4 14 
14 13 
1 17 
8 15 
14 5 
3 7 
20 6 
1 9 
11 19 
6 20 
13 11 

result:

ok 

Test #285:

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

input:

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

output:

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

result:

ok 

Test #286:

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

input:

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

output:

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

result:

ok 

Test #287:

score: 0
Accepted
time: 69ms
memory: 27612kb

input:

50000 2 100000
98362 76208
42505 92719
18460 89381
66596 99759
12116 82137
92591 4043
134 72622
43432 47060
48543 74386
24648 12398
15658 30807
44636 99813
53782 10967
99129 43783
31224 17380
1594 90445
4363 11935
83427 79197
57698 64946
55536 76058
25332 10458
66313 31325
77601 43931
23727 27286
38...

output:

76208 98362 
42505 92719 
89381 18460 
66596 99759 
12116 82137 
4043 92591 
134 72622 
47060 43432 
48543 74386 
12398 24648 
15658 30807 
44636 99813 
10967 53782 
43783 99129 
17380 31224 
1594 90445 
11935 4363 
83427 79197 
57698 64946 
55536 76058 
10458 25332 
31325 66313 
77601 43931 
23727 ...

result:

ok 

Test #288:

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

input:

1000 2 90000
23815 25217
6968 45020
4010 7431
26939 4476
2589 64334
32215 84328
8428 78626
15793 9319
30520 48129
73647 7113
69869 35054
2118 65562
13093 15772
66586 74609
2641 56451
80789 47288
35419 63553
4412 70594
45845 37418
71587 74602
19228 59932
53972 84459
7561 23333
29074 12664
26734 61072...

output:

23815 25217 
6968 45020 
4010 7431 
4476 26939 
2589 64334 
32215 84328 
8428 78626 
9319 15793 
30520 48129 
7113 73647 
35054 69869 
2118 65562 
13093 15772 
66586 74609 
2641 56451 
47288 80789 
35419 63553 
4412 70594 
37418 45845 
71587 74602 
19228 59932 
53972 84459 
7561 23333 
12664 29074 
...

result:

ok 

Test #289:

score: 0
Accepted
time: 173ms
memory: 47880kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

80944 83824 
26621 25208 
28836 57146 
43915 18169 
59242 47842 
78881 34224 
38791 20722 
91046 89723 
72800 40306 
94906 92681 
7263 41151 
13332 76035 
38800 93928 
86055 97168 
73623 44186 
68071 7391 
20692 72265 
44111 42596 
77687 36037 
64592 836 
43568 35187 
88539 34861 
22111 37477 
98028...

result:

ok 

Test #290:

score: 0
Accepted
time: 16ms
memory: 7468kb

input:

78 128 100000
81808 77744 77980 20344 56544 50739 70835 39983 68165 34656 3072 42835 82535 82728 67410 26960 83125 8567 68716 87268 1041 55994 57260 55232 2311 39201 31839 52222 97649 77452 99484 9817 25951 19307 89403 41701 29144 21015 97490 47889 80786 38025 80518 41671 15279 15331 14598 14750 388...

output:

1041 3038 6989 11423 3072 8223 14413 14598 2311 13035 19307 20263 19500 20344 21831 27780 8567 13160 19232 21015 19722 26960 22413 28260 9817 24377 30768 38025 38811 56770 39983 72373 15279 25807 30384 31839 25161 30001 31796 34656 39136 41701 41130 50739 47154 53954 52468 55232 28172 41671 41572 68...

result:

ok 

Test #291:

score: 0
Accepted
time: 16ms
memory: 6792kb

input:

4 2048 95000
38783 19709 71675 15481 45011 21868 31035 86793 51119 32657 89325 16883 19411 82169 55236 12196 70200 53239 39110 1874 74802 92295 14936 39296 33336 21076 44167 41683 70853 46547 4147 92052 23634 43406 21048 62597 37396 48811 32118 56333 72463 15734 84750 74354 93564 26993 34448 9656 49...

output:

2 110 197 355 44 137 670 1239 191 700 402 1397 720 999 1196 2153 131 728 1236 1244 1132 1506 1861 2267 1368 3161 1680 3246 2954 3496 3312 3619 812 1489 1569 1668 1782 2599 2964 4289 1874 2019 2081 2809 2846 5593 5727 7644 3324 3938 3545 4523 3673 6294 7410 8862 5077 9953 7963 11478 10307 13928 11691...

result:

ok 

Test #292:

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

input:

1250 8 8000
1142 5185 4039 4187 6143 3133 1453 6322
2826 1179 6307 4164 4163 1381 6393 5987
165 7650 2235 6199 1828 7154 1702 6555
1924 5298 6688 3890 2158 6145 6260 1593
6582 7121 595 566 1943 1749 498 4850
1658 2980 77 1807 19 5771 1887 1851
6975 6093 5956 6901 7876 3172 4955 7840
6805 5280 991 89...

output:

1453 4187 1142 6143 3133 4039 5185 6322 
1179 4163 5987 6307 1381 4164 2826 6393 
1828 2235 1702 7650 165 7154 6199 6555 
1593 3890 2158 5298 1924 6145 6260 6688 
595 1749 498 6582 566 4850 1943 7121 
19 1658 1807 1851 77 1887 2980 5771 
4955 6093 3172 6901 5956 7840 6975 7876 
991 1888 6805 7036 40...

result:

ok 

Test #293:

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

input:

1250 8 100000
33559 35032 86872 2746 93799 19407 3978 35031
45242 19554 51244 7095 76508 73954 58274 17339
33768 22747 28465 45940 68882 8649 47192 74009
85827 61438 15635 42263 10935 25322 70609 29138
89239 2604 35343 91233 24911 24596 24352 4723
61239 30122 86493 3193 95509 53433 14784 66391
97818...

output:

2746 3978 19407 33559 35032 35031 86872 93799 
17339 7095 19554 73954 45242 58274 51244 76508 
22747 8649 47192 28465 68882 33768 74009 45940 
25322 15635 61438 29138 10935 42263 70609 85827 
2604 4723 24596 35343 89239 24911 24352 91233 
14784 3193 53433 30122 61239 66391 86493 95509 
8896 6555 519...

result:

ok 

Test #294:

score: 0
Accepted
time: 1123ms
memory: 64760kb

input:

62400 8 100000
7324 34007 89967 39540 19251 93843 18929 39731
47872 52435 11015 51213 36149 92229 79678 8542
68819 93790 26712 81439 16048 748 28856 44128
83761 80415 55213 58021 26346 26581 43271 52217
62896 62612 84933 73003 39705 52869 89876 35829
50243 95931 95455 39446 31424 11301 5835 65363
21...

output:

18929 7324 39540 19251 34007 39731 89967 93843 
8542 47872 51213 92229 52435 79678 11015 36149 
28856 26712 748 93790 16048 81439 68819 44128 
26581 55213 52217 80415 43271 58021 26346 83761 
73003 89876 39705 62896 52869 62612 35829 84933 
5835 95455 31424 50243 11301 39446 95931 65363 
13375 39881...

result:

ok 

Test #295:

score: 0
Accepted
time: 1442ms
memory: 45352kb

input:

488 1024 2000
681 1638 782 301 1645 521 1389 150 1560 38 597 1423 1415 755 1392 1386 467 1209 1131 1897 71 449 1862 642 218 1691 1323 1598 437 721 535 484 244 1505 1914 30 64 387 1458 372 1995 1284 529 339 245 556 539 976 1933 1357 211 780 1894 684 1512 479 1356 1882 1981 1586 1467 1219 205 1296 178...

output:

388 775 744 1186 128 628 732 1052 467 631 544 736 8 260 223 444 58 437 90 653 362 470 1002 1020 64 252 279 351 408 480 696 699 150 1183 565 1514 175 929 342 1274 187 1446 832 1142 406 1106 535 1374 178 473 228 1189 217 766 479 1693 208 368 607 1449 420 1512 1034 1877 126 259 295 504 114 186 484 842 ...

result:

ok 

Test #296:

score: 0
Accepted
time: 1117ms
memory: 45440kb

input:

61 8192 200
99 170 170 170 170 99 99 170 170 170 99 170 99 170 170 99 99 170 170 170 99 99 99 170 99 99 99 104 170 170 162 170 99 170 170 170 170 99 170 99 170 99 99 170 99 170 170 99 170 99 99 99 170 99 170 99 99 99 170 99 170 99 170 170 170 99 99 170 170 170 99 99 99 170 170 170 99 170 170 99 99 9...

output:

170 10 19 170 11 99 30 99 170 99 65 99 170 99 85 170 99 170 99 99 170 99 170 99 170 99 170 99 170 99 170 99 25 99 55 170 170 99 170 99 99 170 89 170 170 99 99 170 170 99 99 170 170 99 170 99 170 99 170 99 99 170 99 170 170 44 51 170 170 99 170 99 99 170 170 99 170 99 170 99 170 99 170 99 99 170 170 ...

result:

ok 

Test #297:

score: 0
Accepted
time: 1153ms
memory: 44844kb

input:

61 8192 70
11 67 11 65 65 65 11 11 65 11 65 11 11 65 65 11 11 11 11 11 65 65 65 11 11 11 11 65 11 65 65 11 6 11 65 65 11 65 65 65 65 11 65 11 65 11 65 65 65 11 65 65 11 11 65 65 11 65 11 11 65 65 65 11 52 20 11 11 11 11 11 65 11 65 61 65 65 65 65 11 65 11 65 11 11 65 65 11 11 65 65 11 40 65 11 65 11...

output:

11 9 65 11 14 65 11 65 31 11 11 65 19 65 65 11 11 17 11 65 65 65 11 65 65 24 11 65 65 11 11 65 11 26 65 11 65 11 21 65 11 65 65 11 11 65 65 11 11 65 11 65 65 11 11 65 11 65 65 11 65 11 7 65 8 11 65 11 11 65 65 11 6 65 11 65 11 65 11 65 65 11 11 65 11 65 33 11 11 65 65 11 11 65 11 65 11 65 65 11 65 1...

result:

ok 

Test #298:

score: 0
Accepted
time: 1155ms
memory: 46132kb

input:

61 8192 80
74 74 74 44 74 74 74 74 44 74 74 74 44 44 74 74 74 44 74 74 74 44 74 74 44 44 74 74 44 74 44 44 4 74 44 44 44 74 74 74 44 33 74 74 74 44 74 44 74 74 74 74 74 74 74 44 44 74 74 74 44 44 44 74 16 44 44 74 74 44 74 44 44 74 44 74 74 44 74 44 44 44 74 37 44 44 74 74 44 74 44 44 74 74 44 74 74...

output:

18 31 44 74 74 3 44 74 44 74 44 2 74 44 74 44 74 44 74 44 74 44 74 44 22 44 74 44 74 44 44 74 6 74 74 44 46 44 74 44 44 74 74 23 74 44 74 44 44 74 74 44 74 44 74 44 44 74 74 44 74 44 74 44 14 44 74 44 74 44 44 74 33 74 74 44 74 44 44 74 44 19 24 44 74 44 44 74 74 44 44 74 74 44 74 44 44 74 44 74 74 ...

result:

ok 

Test #299:

score: 0
Accepted
time: 1064ms
memory: 64296kb

input:

62500 8 70000
64472 41906 37052 44464 53555 58131 329 22786
55165 43943 64063 32035 22052 52983 35450 47115
42348 48425 22268 3633 15516 28887 32636 48547
20247 30100 44729 17574 13491 8828 14663 64636
7335 62796 54561 19353 43316 65390 9000 30320
8335 56377 6106 55566 36702 57785 11840 23320
3230 4...

output:

37052 329 53555 41906 64472 58131 22786 44464 
32035 47115 52983 43943 22052 55165 35450 64063 
22268 15516 48425 32636 42348 28887 48547 3633 
17574 8828 20247 14663 13491 44729 64636 30100 
43316 7335 54561 30320 9000 19353 65390 62796 
6106 23320 8335 57785 36702 56377 55566 11840 
46318 45296 59...

result:

ok 

Test #300:

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

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

92592 91980 
12359 10704 
35873 56718 
28601 20301 
55548 78422 
74736 59974 
29025 81664 
70432 55916 
47381 34185 
56168 31764 
33997 30947 
70076 9029 
67057 52532 
99273 79680 
56704 54410 
45238 71652 
6894 12615 
66478 78041 
5451 40520 
5950 58133 
70551 89237 
97551 36028 
90630 83553 
33690...

result:

ok 

Test #301:

score: 0
Accepted
time: 953ms
memory: 66236kb

input:

62500 8 100000
47172 98715 32573 10450 57470 57785 14618 26881
82542 14477 54747 90100 28448 58443 38091 88923
35476 3812 18616 40241 37528 97066 63939 99345
89936 22796 3166 12257 68822 862 51368 1274
3728 15897 5024 77108 47176 30543 68911 16457
3043 71632 92951 31443 88863 88950 41175 10918
13709...

output:

14618 10450 57470 47172 32573 57785 26881 98715 
28448 14477 54747 38091 58443 82542 88923 90100 
3812 37528 18616 63939 97066 35476 99345 40241 
862 3166 1274 22796 51368 12257 89936 68822 
16457 5024 3728 30543 47176 15897 68911 77108 
3043 10918 88863 31443 71632 41175 92951 88950 
13709 20862 50...

result:

ok 

Test #302:

score: 0
Accepted
time: 983ms
memory: 66256kb

input:

62496 8 100000
92424 32969 88476 83157 26937 10720 48350 99360
85305 23955 10048 64444 63891 12816 29853 71331
61936 49932 48976 6234 77639 33648 36768 3193
12060 69101 59074 35029 63097 76282 44013 93083
46256 39387 91809 14571 23462 21416 49200 22090
57525 95911 66504 79489 59895 59787 19475 1477
...

output:

10720 32969 48350 83157 88476 26937 92424 99360 
12816 10048 29853 23955 63891 64444 85305 71331 
48976 3193 33648 49932 6234 36768 61936 77639 
44013 12060 35029 63097 59074 76282 93083 69101 
21416 14571 39387 22090 23462 46256 49200 91809 
57525 1477 66504 59787 79489 19475 59895 95911 
30589 318...

result:

ok 

Test #303:

score: 0
Accepted
time: 1131ms
memory: 52420kb

input:

31250 16 100000
38541 93204 27590 15361 66717 47252 45666 97504 23510 29022 67421 9583 26198 14461 95157 20540
68091 37113 17290 88353 39292 67411 26393 92637 14252 31217 88721 63983 36434 66431 61347 83636
55923 37831 35042 64077 54372 60464 29813 33353 98528 15152 15477 78600 29076 27693 13281 239...

output:

9583 15361 45666 14461 20540 38541 23510 47252 67421 27590 26198 66717 93204 29022 97504 95157 
31217 17290 36434 26393 37113 61347 39292 63983 14252 67411 68091 66431 88353 83636 88721 92637 
29813 15152 35042 23908 37831 15477 54372 27693 13281 33353 78600 55923 29076 60464 98528 64077 
21844 3688...

result:

ok 

Test #304:

score: 0
Accepted
time: 945ms
memory: 63576kb

input:

62500 8 100000
99332 49767 67282 81878 81878 90800 57079 57079
83482 30201 63213 77987 74799 98108 98108 83482
38347 91232 62597 68142 81727 30450 91232 81727
84080 54724 20495 44364 38865 54724 20495 96039
21322 14652 50336 99451 40 14652 70644 70644
73656 50229 50229 66534 27734 25964 27734 59412
...

output:

57079 49767 67282 81878 57079 81878 99332 90800 
63213 74799 83482 98108 83482 77987 30201 98108 
68142 30450 91232 81727 81727 38347 91232 62597 
96039 84080 20495 54724 54724 20495 38865 44364 
40 14652 70644 50336 21322 14652 70644 99451 
73656 27734 25964 50229 59412 66534 27734 50229 
38799 156...

result:

ok 

Test #305:

score: 0
Accepted
time: 133ms
memory: 52452kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457 
40457 80634 
49074 21580 
92701 14354 
44540 70461 
47132 47637 
84954 27979 
87556 60683 
43063 22633 
63643 49914 
4494 3571 
53632 88758 
17055 50019 
49334 79039 
67659 50111 
17945 48061 
60323 84596 
72033 14629 
77184 30069 
64209 36217 
49947 35279 
44707 45866 
58484 58146 
139...

result:

ok 

Extra Test:

score: 0
Extra Test Passed