QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#61224#4818. Inverse Line GraphzhangfangwenAC ✓1314ms61392kbC++144.1kb2022-11-11 16:15:542022-11-11 16:15:57

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-11 16:15:57]
  • 评测
  • 测评结果:AC
  • 用时:1314ms
  • 内存:61392kb
  • [2022-11-11 16:15:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
vector<int>g[300005];
int vist[300005];
int tt;
int a1[300005],a2[300005];
vector<int>vc;
int v[300005],tms=0;
void getall(int x){
	++tms;
	queue<int>q;
	q.emplace(x);
	v[x]=tms;
	while(q.size()){
		int x=q.front();
		vist[x]=1;
		q.pop();
		vc.emplace_back(x);
		for(auto cu:g[x]){
			if(v[cu]==tms)continue;
			v[cu]=tms;
			q.emplace(cu);
		}
	}
}
int cc[300005];
bool ranse(int x){
	if(a2[x])return 1;
	a2[x]=++tt;
	vector<int>lj;
	for(auto cu:g[x]){
		if(a1[cu]==a1[x]||a2[cu])continue;
		lj.emplace_back(cu);
	}
	for(auto cu:lj)++cc[cu];
	int gs=0,vv=0;
	for(auto cu:lj){
		for(auto uc:g[cu]){
			if(cc[uc])++gs;
			if(cc[uc]&&a1[cu]&&a1[uc]&&a1[cu]==a1[uc])vv=1;
		}
	}
	for(auto cu:lj)--cc[cu];
	int sz=lj.size();
	if(gs!=1ll*sz*(sz-1))return 0;
	if(vv)return 0;
	for(auto cu:lj){
		if(a1[cu])a2[cu]=tt;
		else a1[cu]=tt;
	}
	for(auto cu:lj){
		if(!a2[cu]){
			if(!ranse(cu))return 0;
		}
	}
	return 1;
}
bool test(int x,auto vc,auto s1,auto s2){
	for(auto cu:s1)cc[cu]=1;
	for(auto cu:s2)cc[cu]=2;
	int zh=0,mx=0;
	for(auto cu:s1){
		int gs=0;
		for(auto uc:g[cu]){
			if(cc[uc]==1)++zh;
			else if(cc[uc]==2)++gs;
		}
		mx=max(mx,gs);
	}
	for(auto cu:s2){
		int gs=0;
		for(auto uc:g[cu]){
			if(cc[uc]==2)++zh;
			else if(cc[uc]==1)++gs;
		}
		mx=max(mx,gs);
	}
	for(auto cu:s1)cc[cu]=0;
	for(auto cu:s2)cc[cu]=0;
	int n1=s1.size(),n2=s2.size();
	if(zh!=1ll*n1*(n1-1)+1ll*n2*(n2-1))return 0;
	if(mx>1)return 0;
	for(auto cu:vc)a1[cu]=a2[cu]=0;
	a1[x]=++tt,a2[x]=++tt;
	for(auto cu:s1)a1[cu]=a1[x];
	for(auto cu:s2)a1[cu]=a2[x];
	for(auto cu:s1)if(!ranse(cu))return 0;
	for(auto cu:s2)if(!ranse(cu))return 0;
	for(auto cu:vc){
		for(auto uc:g[cu]){
			if(a1[cu]!=a1[uc]){
				if(a1[cu]!=a2[uc]){
					if(a2[cu]!=a1[uc]){
						if(a2[cu]!=a2[uc]){
							return 0;
						}
					}
				}
			}
		}
	}
	return 1;
}
int bb[300005];
bool check(int x){
	vc.clear();
	getall(x);
	if((signed)vc.size()==1){
		a1[x]=++tt,a2[x]=++tt;
		return 1;
	}
	int p=g[x][0];
	vector<int>s1,s2;
	for(auto cu:g[x]){
		if(cu==p)s1.emplace_back(cu);
		else s2.emplace_back(cu);
	}
	if(test(x,vc,s1,s2))return 1;
	for(auto cu:g[x])++bb[cu];
	int q=0;
	for(auto cu:g[p]){
		if(bb[cu]){
			q=cu;
			break;
		}
	}
	for(auto cu:g[x])--bb[cu];
	if(!q)return 0;
	s1.clear(),s2.clear();
	for(auto cu:g[p])++bb[cu];
	for(auto cu:g[q])++bb[cu];
	for(auto cu:g[x]){
		if(cu==p||cu==q)s1.emplace_back(cu);
		else if(bb[cu]==2)s1.emplace_back(cu);
		else s2.emplace_back(cu);
	}
	for(auto cu:g[p])--bb[cu];
	for(auto cu:g[q])--bb[cu];
	if(test(x,vc,s1,s2))return 1;
	s1.clear(),s2.clear();
	int flag=1;
	for(auto cu:g[p])bb[cu]^=1;
	for(auto cu:g[q])bb[cu]^=2;
	for(auto cu:g[x]){
		if(cu==p)s1.emplace_back(cu);
		else if(cu==q)s2.emplace_back(cu);
		else if(bb[cu]==1)s1.emplace_back(cu);
		else if(bb[cu]==2)s2.emplace_back(cu);
		else{
			flag=0;
			break;
		}
	}
	for(auto cu:g[p])bb[cu]^=1;
	for(auto cu:g[q])bb[cu]^=2;
	if(!flag)return 0;
	if(test(x,vc,s1,s2))return 1;
	return 0;
}
int lg[600005];
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
		int n,m;
		scanf("%d%d",&n,&m);
		for(int i=1;i<=n;++i)g[i].clear();
		for(int i=1;i<=m;++i){
			int u,v;
			scanf("%d%d",&u,&v);
			g[u].emplace_back(v);
			g[v].emplace_back(u);
		}
		for(int i=1;i<=n;++i)vist[i]=0;
		tt=0;
		int flag=1;
		for(int i=1;i<=n;++i)if(!vist[i]){
			if(!check(i)){
				flag=0;
				break;
			}
		}
		/*
		if(T>60070)continue;
		if(T==60070){
			printf("%d %d\n",n,m);
			for(int i=1;i<=n;++i){
				for(auto cu:g[i]){
					if(cu>i)printf("%d %d\n",i,cu);
				}
			}
		}
		*/
		if(!flag)puts("No");
		else{
			puts("Yes");
			int l=0;
			for(int i=1;i<=n;++i){
				lg[++l]=a1[i],lg[++l]=a2[i];
			}
			sort(lg+1,lg+l+1);
			l=unique(lg+1,lg+l+1)-lg-1;
			printf("%d %d\n",l,n);
			for(int i=1;i<=n;++i){
				int A1=lower_bound(lg+1,lg+l+1,a1[i])-lg;
				int A2=lower_bound(lg+1,lg+l+1,a2[i])-lg;
				printf("%d %d\n",A1,A2);
			}
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

Yes
5 5
1 2
1 3
2 5
2 4
3 4
Yes
2 1
1 2
Yes
3 2
1 2
1 3
Yes
3 3
1 2
1 3
2 3
No
Yes
5 5
1 2
1 3
3 4
3 5
4 5

result:

ok that's great! (sum n = 20, sum m = 19) (6 test cases)

Test #2:

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

input:

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

output:

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

result:

ok that's great! (sum n = 20, sum m = 12) (5 test cases)

Test #3:

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

input:

14
5 3
2 5
1 5
1 2
4 3
2 4
1 2
1 3
5 6
2 3
1 5
4 5
2 4
1 2
1 3
3 0
6 5
3 4
1 5
2 6
5 6
2 3
4 4
1 2
3 4
1 4
2 3
6 7
1 3
5 6
3 6
1 2
3 5
1 6
2 6
1 0
5 5
1 2
2 4
2 5
3 5
4 5
4 0
2 0
3 0
1 0
1 0

output:

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

result:

ok that's great! (sum n = 50, sum m = 33) (14 test cases)

Test #4:

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

input:

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

output:

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

result:

ok that's great! (sum n = 23, sum m = 19) (5 test cases)

Test #5:

score: 0
Accepted
time: 113ms
memory: 19488kb

input:

61395
7 0
1 0
5 1
1 2
3 1
1 3
7 11
2 4
2 5
1 6
5 7
1 4
1 5
2 7
3 7
1 2
3 5
4 5
9 10
2 7
4 5
5 9
1 8
1 3
2 6
6 7
2 4
3 7
6 8
1 0
8 10
2 6
6 8
1 4
1 8
4 6
2 4
2 3
1 2
4 8
1 3
9 12
3 7
4 7
7 9
1 6
3 8
2 5
5 9
3 4
4 6
4 8
5 7
7 8
6 5
2 6
1 2
4 5
2 3
1 3
3 1
1 2
2 0
1 0
4 2
1 2
2 4
3 3
1 2
2 3
1 3
1 0
9 ...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 223451) (61395 test cases)

Test #6:

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

input:

38520
8 8
1 2
3 5
3 7
4 8
1 4
7 8
2 5
1 8
11 18
4 5
1 5
1 6
1 9
7 8
10 11
6 9
7 10
4 9
2 11
4 6
1 4
8 10
3 6
2 9
3 5
7 11
3 4
12 26
10 11
1 2
5 11
2 10
6 8
1 7
2 12
2 7
6 9
3 6
5 8
8 10
5 9
4 11
1 11
5 6
1 4
5 12
8 11
7 12
3 8
6 12
1 12
5 10
9 12
3 4
4 2
3 4
1 4
14 30
4 9
9 10
4 6
3 11
11 13
12 14
6...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 439705) (38520 test cases)

Test #7:

score: 0
Accepted
time: 191ms
memory: 18992kb

input:

29408
2 0
10 20
7 9
3 4
3 10
7 10
4 8
4 5
5 8
6 9
3 5
1 3
8 9
4 7
4 10
1 10
6 7
4 6
1 2
7 8
3 8
6 10
4 2
1 3
2 4
8 6
3 8
5 6
2 5
1 5
2 7
4 6
14 35
9 10
8 13
5 7
3 13
2 7
4 5
8 11
11 12
6 12
1 13
1 12
2 5
5 10
4 10
2 12
4 7
5 9
8 9
1 3
4 9
5 12
2 10
3 10
9 11
1 11
2 8
2 3
7 12
6 11
8 10
3 8
9 13
11 1...

output:

Yes
4 2
1 2
3 4
Yes
8 10
1 2
2 8
1 3
3 4
3 7
4 6
4 5
3 5
5 6
1 4
Yes
6 4
1 2
4 5
1 3
4 6
No
Yes
9 14
1 2
4 5
1 4
6 7
5 7
2 8
5 6
3 4
3 7
4 7
2 3
2 5
1 3
8 9
Yes
10 14
1 2
1 3
2 5
1 8
4 5
8 9
6 7
5 8
4 8
5 6
9 10
7 8
4 6
3 4
Yes
10 17
1 2
2 3
5 9
1 3
3 9
6 7
8 10
5 6
3 4
6 9
7 8
2 9
5 7
1 9
8 9
3 5
6...

result:

ok that's great! (sum n = 300000, sum m = 602206) (29408 test cases)

Test #8:

score: 0
Accepted
time: 241ms
memory: 17800kb

input:

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

output:

Yes
8 5
1 2
4 5
7 8
4 6
1 3
Yes
10 23
1 2
5 9
2 7
5 6
3 7
2 4
7 9
7 8
3 9
2 5
6 8
2 9
2 8
1 3
3 4
6 7
1 10
4 5
6 10
4 7
4 8
4 6
1 4
No
Yes
9 11
1 2
3 4
4 7
1 6
6 7
3 9
7 8
3 6
5 6
4 5
1 3
Yes
9 12
1 2
5 6
1 3
3 4
2 6
4 7
7 8
2 9
1 8
2 5
6 7
4 5
Yes
14 7
1 2
3 4
5 6
7 8
9 10
11 12
13 14
Yes
10 14
1 2...

result:

ok that's great! (sum n = 300000, sum m = 917019) (19907 test cases)

Test #9:

score: 0
Accepted
time: 316ms
memory: 18248kb

input:

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

output:

Yes
10 39
1 2
4 7
7 8
3 4
1 7
4 9
5 10
5 7
2 9
2 10
4 5
2 7
1 10
2 4
4 8
1 8
5 6
6 7
1 6
3 8
5 8
2 5
2 6
4 6
3 9
3 6
6 8
3 7
8 10
9 10
7 9
1 5
6 9
1 3
8 9
5 9
2 8
1 4
3 5
Yes
6 3
1 2
3 4
5 6
No
Yes
10 22
1 2
5 6
1 9
4 8
3 4
8 9
3 5
4 6
4 9
8 10
1 10
4 5
6 7
1 3
6 10
3 9
1 4
1 5
3 7
7 8
2 8
2 7
Yes
2...

result:

ok that's great! (sum n = 300000, sum m = 1507380) (12137 test cases)

Test #10:

score: 0
Accepted
time: 365ms
memory: 18240kb

input:

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

output:

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

result:

ok that's great! (sum n = 300000, sum m = 1741177) (10112 test cases)

Test #11:

score: 0
Accepted
time: 478ms
memory: 19008kb

input:

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

output:

Yes
10 19
1 2
6 8
4 6
6 7
2 4
1 9
1 3
3 4
2 7
5 6
4 7
4 5
1 5
8 9
2 10
2 8
3 5
4 8
5 7
Yes
15 81
1 2
12 13
6 9
2 4
3 8
12 14
7 10
8 13
11 12
8 9
7 12
2 8
4 14
2 6
7 13
10 14
5 7
5 15
5 10
8 10
8 15
2 7
10 11
3 4
4 12
2 5
1 3
3 10
13 14
3 9
6 11
5 12
5 9
1 11
2 12
9 12
2 15
5 13
5 11
1 13
2 13
9 13
1...

result:

ok that's great! (sum n = 300000, sum m = 2530246) (6175 test cases)

Test #12:

score: 0
Accepted
time: 515ms
memory: 18280kb

input:

5039
111 1318
69 97
72 104
34 107
89 108
6 74
36 40
58 96
50 100
20 32
8 35
24 109
5 43
60 104
21 80
58 94
76 99
88 111
27 58
4 110
3 37
81 96
71 89
102 103
98 102
43 54
13 52
23 107
33 84
70 98
31 92
19 43
68 93
28 96
65 77
96 108
30 82
17 36
40 47
26 102
45 48
30 89
70 90
73 96
13 108
10 85
19 75
...

output:

Yes
22 111
1 2
1 20
2 7
5 16
2 17
1 5
2 8
18 20
8 9
2 6
6 13
6 16
6 11
7 10
1 6
3 16
11 13
6 8
5 17
6 17
3 12
3 11
10 17
7 17
3 14
5 10
3 9
4 5
1 13
10 15
2 9
13 17
11 16
1 17
8 20
3 13
2 16
6 12
9 14
13 16
10 12
17 18
11 17
9 12
5 7
2 14
9 16
7 9
2 3
16 17
1 8
5 11
8 11
12 17
7 16
6 15
3 22
3 8
2 1...

result:

ok that's great! (sum n = 300000, sum m = 2937547) (5039 test cases)

Test #13:

score: 0
Accepted
time: 521ms
memory: 18764kb

input:

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

output:

Yes
7 5
1 2
3 4
3 5
6 7
4 6
No
Yes
15 81
1 2
6 11
4 12
3 4
1 6
5 6
6 10
11 13
4 15
1 10
5 12
2 6
5 8
10 13
3 13
8 9
4 6
6 13
7 9
1 8
4 11
1 15
3 9
2 8
7 10
6 12
5 14
1 12
3 6
9 14
2 15
3 15
6 7
2 5
9 13
5 9
3 5
1 13
12 13
11 12
2 14
4 5
2 9
2 13
5 11
3 10
14 15
1 3
3 11
8 12
10 15
4 7
2 7
10 14
2 4
...

result:

ok that's great! (sum n = 278099, sum m = 3000000) (4021 test cases)

Test #14:

score: 0
Accepted
time: 584ms
memory: 18484kb

input:

3705
130 1346
38 108
28 45
89 123
19 93
24 50
21 42
29 61
14 28
48 116
26 71
101 113
18 80
70 92
106 108
1 4
17 71
5 65
84 92
6 121
71 129
83 126
5 77
48 123
94 104
20 58
3 128
13 65
111 128
113 118
5 116
80 129
10 15
84 107
55 89
75 100
119 122
19 99
60 87
1 18
102 128
25 80
104 128
49 79
5 115
74 ...

output:

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

result:

ok that's great! (sum n = 264646, sum m = 3000000) (3705 test cases)

Test #15:

score: 0
Accepted
time: 505ms
memory: 18908kb

input:

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

output:

Yes
8 7
1 2
4 5
2 8
1 4
6 7
1 3
5 6
Yes
10 43
1 2
6 10
1 3
2 7
3 5
7 8
2 3
7 9
1 8
2 5
4 7
5 9
5 10
1 9
8 9
3 10
4 10
4 6
1 7
2 4
3 7
2 9
9 10
6 9
3 6
3 9
4 8
5 6
1 10
4 5
5 7
2 10
3 4
6 7
8 10
1 4
1 6
2 6
3 8
2 8
1 5
5 8
6 8
Yes
22 126
1 2
3 10
9 18
11 16
4 6
12 14
1 3
12 13
10 11
3 6
10 15
3 13
10...

result:

ok that's great! (sum n = 272523, sum m = 3000000) (3784 test cases)

Test #16:

score: 0
Accepted
time: 544ms
memory: 19260kb

input:

3162
137 1468
72 136
53 128
14 22
51 105
28 137
23 32
49 66
24 56
28 89
2 101
8 62
68 104
21 90
69 136
37 114
50 127
56 67
10 129
60 63
134 135
16 78
77 102
103 106
5 68
14 95
4 72
42 137
19 93
72 110
73 92
6 61
56 85
4 69
18 83
53 126
73 136
30 35
6 25
71 106
14 129
77 131
60 92
37 49
69 91
77 78
1...

output:

Yes
59 137
1 2
5 6
5 12
10 13
3 13
17 19
6 20
19 21
13 22
3 12
3 4
9 10
5 23
2 5
24 25
4 20
3 6
7 14
12 19
4 15
3 14
5 15
3 22
7 10
17 18
26 27
1 20
10 20
5 11
4 6
4 7
9 22
14 20
28 29
4 11
4 10
3 19
11 12
2 12
13 20
3 7
3 20
4 13
10 11
1 11
30 31
4 19
32 33
15 19
5 13
4 12
34 35
7 19
2 23
1 10
10 1...

result:

ok that's great! (sum n = 249028, sum m = 3000000) (3162 test cases)

Test #17:

score: 0
Accepted
time: 567ms
memory: 19600kb

input:

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

output:

Yes
14 54
1 2
4 13
8 9
3 9
5 10
4 6
7 9
8 13
3 7
1 7
2 5
8 12
5 9
4 11
2 6
4 5
1 8
3 14
8 10
5 8
2 3
2 10
9 10
6 9
6 12
6 8
1 10
2 7
2 4
3 4
4 8
3 8
6 7
1 4
4 9
3 6
5 7
10 12
1 6
4 12
1 5
10 11
3 5
5 6
1 3
2 8
3 10
2 9
1 9
6 10
7 10
7 8
4 10
4 7
Yes
13 34
1 2
3 5
1 4
3 10
1 10
5 9
1 8
1 7
2 6
6 7
1 ...

result:

ok that's great! (sum n = 260516, sum m = 3000000) (3356 test cases)

Test #18:

score: 0
Accepted
time: 558ms
memory: 17824kb

input:

3325
68 615
24 59
7 41
20 27
31 53
45 48
40 65
48 53
39 44
35 53
23 53
25 67
12 36
8 61
35 65
59 67
12 49
46 67
4 31
28 39
6 49
5 28
20 24
53 57
52 60
32 47
19 38
12 25
26 56
4 45
27 34
38 53
15 21
7 57
2 11
6 12
11 41
14 55
7 24
21 23
38 57
13 34
29 43
45 51
17 44
30 67
20 23
46 63
31 34
31 47
6 47...

output:

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

result:

ok that's great! (sum n = 261664, sum m = 3000000) (3325 test cases)

Test #19:

score: 0
Accepted
time: 584ms
memory: 19708kb

input:

2871
163 712
160 162
26 128
15 120
147 153
99 144
33 137
30 69
107 115
12 15
9 61
82 102
50 161
156 163
48 161
73 118
110 152
2 32
3 136
36 72
99 139
34 85
3 99
26 124
33 43
135 145
4 160
8 87
64 94
29 113
125 131
80 88
17 84
103 108
80 125
45 57
31 55
64 89
46 58
97 157
136 148
69 159
9 149
16 89
6...

output:

No
Yes
9 14
1 2
2 5
1 6
1 5
2 4
3 5
5 9
5 6
6 7
7 8
1 3
6 9
3 4
4 5
Yes
56 159
1 2
24 25
14 20
10 12
3 12
8 23
7 8
5 9
15 18
20 21
8 15
2 12
3 11
5 13
7 19
3 4
5 6
2 5
7 21
12 19
9 19
1 20
6 18
7 15
4 14
3 15
4 9
1 4
13 14
12 13
9 13
5 12
6 8
2 19
20 22
3 19
1 14
9 21
2 7
6 9
26 27
5 20
2 8
3 13
2 1...

result:

ok that's great! (sum n = 244676, sum m = 3000000) (2871 test cases)

Test #20:

score: 0
Accepted
time: 541ms
memory: 17908kb

input:

3036
72 655
16 64
10 27
24 72
1 67
17 53
7 46
35 66
21 24
9 24
4 58
24 62
19 63
11 34
11 64
13 64
23 41
20 70
21 65
10 72
38 42
5 25
4 12
11 16
61 66
21 60
9 72
25 34
28 40
34 48
42 54
45 60
34 64
12 53
5 22
8 30
15 42
35 54
42 53
15 27
21 37
7 48
19 24
17 33
14 65
27 48
61 70
8 13
28 37
62 65
2 14
...

output:

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

result:

ok that's great! (sum n = 252869, sum m = 3000000) (3036 test cases)

Test #21:

score: 0
Accepted
time: 554ms
memory: 18804kb

input:

3032
10 13
1 2
5 7
1 9
3 4
8 10
6 9
1 4
6 10
3 5
2 7
9 10
4 9
1 7
73 703
9 46
52 62
38 73
10 39
41 44
11 35
51 68
1 19
2 67
7 63
30 36
60 63
29 61
13 67
33 64
12 18
18 51
29 46
55 61
18 57
13 26
17 64
3 15
5 20
8 19
35 45
3 18
15 27
30 37
66 69
45 46
36 37
33 35
48 68
46 55
30 32
15 23
25 36
46 64
3...

output:

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

result:

ok that's great! (sum n = 254049, sum m = 3000000) (3032 test cases)

Test #22:

score: 0
Accepted
time: 548ms
memory: 19840kb

input:

2640
89 987
53 55
23 65
14 71
11 87
62 71
15 72
57 70
47 61
29 54
51 89
79 83
46 54
44 79
9 63
14 41
49 61
19 83
20 89
43 77
41 89
6 68
29 75
15 81
21 63
37 78
52 58
42 44
36 45
40 60
14 78
64 74
22 80
21 46
39 57
25 87
54 76
50 84
46 80
47 51
65 80
6 28
30 89
26 39
5 55
9 14
30 44
26 61
41 62
36 50...

output:

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

result:

ok that's great! (sum n = 233919, sum m = 3000000) (2640 test cases)

Test #23:

score: 0
Accepted
time: 545ms
memory: 18648kb

input:

2697
131 1677
35 128
39 47
13 84
19 67
39 127
81 102
8 65
116 117
55 65
16 97
1 26
10 95
85 93
5 130
78 87
10 18
47 49
121 131
36 120
71 122
38 116
27 111
53 59
11 121
83 109
4 31
21 71
15 19
22 58
13 64
68 99
5 110
33 115
41 96
60 63
110 127
28 78
82 127
85 114
35 90
66 106
58 99
79 99
102 115
71 1...

output:

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

result:

ok that's great! (sum n = 240904, sum m = 3000000) (2697 test cases)

Test #24:

score: 0
Accepted
time: 565ms
memory: 19028kb

input:

2742
164 1280
105 111
70 144
12 32
35 65
106 144
25 26
1 11
12 56
19 160
149 151
20 53
92 155
117 155
40 154
30 151
100 141
64 152
105 118
103 132
25 62
17 67
48 136
45 160
91 116
68 109
120 124
54 125
30 128
33 102
105 149
136 161
106 120
30 92
98 136
24 81
24 140
90 133
62 162
73 90
62 140
21 45
2...

output:

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

result:

ok that's great! (sum n = 246601, sum m = 3000000) (2742 test cases)

Test #25:

score: 0
Accepted
time: 557ms
memory: 19364kb

input:

845
116 3941
2 90
96 116
21 57
47 87
101 113
13 55
63 75
4 79
30 93
33 68
35 69
55 56
34 46
80 111
49 68
14 71
21 101
38 107
78 92
106 115
19 25
18 115
39 78
19 55
74 79
2 72
70 105
35 94
88 110
6 80
38 116
21 39
94 101
3 65
30 81
84 115
24 30
67 84
25 75
6 31
64 109
30 39
14 50
41 104
1 53
56 108
1...

output:

No
Yes
277 358
1 2
10 16
9 22
19 20
4 9
6 14
18 22
32 33
10 23
34 35
8 15
36 37
38 39
40 41
42 43
11 20
14 23
3 11
3 21
8 9
44 45
46 47
20 21
4 16
5 22
48 49
50 51
13 16
13 22
52 53
54 55
56 57
2 20
5 9
4 19
10 13
58 59
12 23
3 9
10 11
60 61
62 63
17 19
64 65
66 67
68 69
25 26
4 6
70 71
12 19
72 73
...

result:

ok that's great! (sum n = 255437, sum m = 3000000) (845 test cases)

Test #26:

score: 0
Accepted
time: 566ms
memory: 18740kb

input:

851
213 3934
40 201
12 160
8 175
20 60
117 172
18 143
70 188
36 54
48 61
165 210
32 159
32 132
72 173
72 122
32 62
152 201
151 197
13 28
150 191
5 135
89 101
103 196
16 125
68 140
98 188
11 184
3 38
153 180
12 129
12 201
35 177
41 50
157 170
25 131
144 186
77 159
40 144
131 196
82 90
50 79
42 157
47...

output:

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

result:

ok that's great! (sum n = 249106, sum m = 3000000) (851 test cases)

Test #27:

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

input:

865
202 3535
125 155
156 174
28 122
34 154
87 163
2 119
139 171
119 197
48 107
17 71
7 108
9 152
130 182
103 108
34 102
124 178
43 74
70 118
20 194
59 136
89 95
117 153
47 93
69 183
48 84
39 56
37 135
36 201
61 197
70 187
82 86
128 140
26 184
59 132
184 200
3 183
93 165
20 81
79 103
38 52
15 54
10 1...

output:

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

result:

ok that's great! (sum n = 260611, sum m = 3000000) (865 test cases)

Test #28:

score: 0
Accepted
time: 584ms
memory: 19968kb

input:

763
90 1002
39 87
16 76
59 81
41 50
9 66
24 36
6 35
62 89
48 87
1 56
5 80
13 21
5 26
12 38
2 57
78 84
53 59
44 63
9 39
11 49
59 71
17 39
22 42
45 70
24 43
48 58
5 77
15 44
34 86
62 87
5 10
57 60
24 41
20 52
45 53
18 41
72 75
26 71
28 52
13 48
28 63
53 81
24 50
38 42
47 82
53 86
64 81
1 25
25 28
46 7...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 2932020) (763 test cases)

Test #29:

score: 0
Accepted
time: 595ms
memory: 19392kb

input:

787
552 5078
68 114
107 123
182 385
17 376
255 534
302 525
147 447
6 513
147 533
239 503
102 466
345 395
33 501
287 407
248 415
79 451
224 253
196 202
315 393
164 374
17 432
64 281
345 455
2 467
107 258
217 331
106 363
154 429
293 536
211 548
9 282
258 364
100 338
278 366
321 393
48 284
72 382
2 231...

output:

No
Yes
949 752
1 2
3 4
36 37
7 25
38 39
40 41
42 43
5 34
10 11
44 45
46 47
48 49
7 24
50 51
11 12
52 53
10 24
13 21
54 55
56 57
58 59
60 61
62 63
3 27
64 65
11 14
66 67
68 69
70 71
6 15
72 73
21 31
11 30
74 75
3 24
76 77
27 31
20 29
78 79
80 81
13 32
82 83
84 85
86 87
13 30
19 21
14 19
88 89
90 91
1...

result:

ok that's great! (sum n = 300000, sum m = 2988551) (787 test cases)

Test #30:

score: 0
Accepted
time: 602ms
memory: 19448kb

input:

793
233 4455
32 50
67 169
45 106
116 179
113 225
35 72
40 139
161 222
14 76
135 213
47 228
26 27
86 229
160 187
13 185
27 117
135 147
29 189
220 229
64 205
16 222
88 137
61 107
59 217
160 228
34 71
49 184
46 127
65 152
24 133
73 208
51 196
201 213
189 216
157 190
40 64
46 95
48 174
172 177
174 223
1...

output:

Yes
31 233
1 2
15 21
4 7
2 15
1 11
14 26
6 18
5 18
12 18
8 13
1 7
5 8
13 19
9 22
1 13
8 16
19 22
9 13
2 12
7 11
19 23
8 29
6 19
21 22
1 14
7 16
7 22
19 20
4 15
28 29
11 14
5 10
4 13
1 12
3 15
3 8
9 14
11 21
14 21
14 18
9 16
3 11
2 7
16 21
12 20
2 16
8 15
11 13
6 17
5 11
6 13
15 22
5 22
1 9
3 19
7 10...

result:

ok that's great! (sum n = 300000, sum m = 2918149) (793 test cases)

Test #31:

score: 0
Accepted
time: 557ms
memory: 19776kb

input:

618
482 4657
114 226
85 115
16 226
13 22
186 414
4 246
30 296
331 473
210 458
399 402
399 449
102 338
196 267
95 196
3 267
205 305
95 424
111 135
53 154
20 234
416 432
307 355
69 458
18 315
74 180
30 443
163 307
159 313
401 454
104 109
32 300
136 355
245 408
258 420
408 478
115 274
451 454
9 63
292 ...

output:

Yes
506 482
1 2
3 4
12 27
16 29
37 38
39 40
41 42
43 44
14 28
9 14
45 46
10 11
3 5
47 48
49 50
24 26
51 52
19 22
3 16
15 16
53 54
5 6
55 56
57 58
59 60
5 26
4 6
4 10
61 62
5 16
7 19
11 23
11 27
12 16
63 64
65 66
67 68
7 24
7 9
69 70
71 72
9 11
73 74
7 10
75 76
77 78
7 16
5 12
79 80
8 14
8 19
81 82
1...

result:

ok that's great! (sum n = 300000, sum m = 2878189) (618 test cases)

Test #32:

score: 0
Accepted
time: 579ms
memory: 18600kb

input:

584
699 11313
219 483
233 432
23 76
540 544
247 623
269 687
433 637
238 295
11 652
460 627
228 382
72 462
197 556
38 609
370 681
214 215
210 501
594 666
106 427
331 605
111 175
141 693
386 491
386 639
65 548
76 156
428 475
237 297
307 573
279 472
247 463
164 512
5 126
400 428
268 462
131 445
74 469
...

output:

Yes
557 699
1 2
14 27
35 36
37 38
13 32
10 25
12 33
39 40
11 31
41 42
18 24
14 17
43 44
45 46
23 24
47 48
25 31
49 50
3 13
51 52
6 32
3 32
9 32
16 26
3 7
53 54
7 24
17 23
17 33
26 31
18 23
13 20
13 25
55 56
57 58
10 18
59 60
22 32
24 33
61 62
63 64
65 66
67 68
8 15
10 17
18 21
69 70
24 28
14 16
22 2...

result:

ok that's great! (sum n = 292591, sum m = 3000000) (584 test cases)

Test #33:

score: 0
Accepted
time: 576ms
memory: 19656kb

input:

572
559 9457
200 397
36 528
50 511
459 527
50 430
27 134
56 243
353 550
60 549
173 372
8 382
156 335
161 539
480 520
194 356
97 508
66 144
329 438
383 511
47 401
472 514
27 316
305 453
68 90
58 276
178 557
313 502
137 441
74 178
74 458
22 68
244 435
524 554
59 245
82 285
315 395
185 497
429 493
39 5...

output:

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

result:

ok that's great! (sum n = 277820, sum m = 3000000) (572 test cases)

Test #34:

score: 0
Accepted
time: 560ms
memory: 25400kb

input:

47
3291 67320
254 1488
111 2438
322 2365
689 1652
368 2650
94 2670
1233 2593
1784 3200
1296 1679
1234 3149
1828 2222
2418 3042
1988 3065
94 1275
394 2968
1328 2585
1132 3055
487 2947
2873 2975
1853 2499
216 477
1052 2382
553 1762
1938 2697
1698 2043
403 2274
35 1030
348 400
1086 1389
1616 3288
1186 ...

output:

Yes
3694 3291
1 2
11 23
24 48
75 76
26 49
77 78
6 67
79 80
15 19
81 82
83 84
21 61
21 27
85 86
87 88
23 59
89 90
91 92
19 32
93 94
95 96
19 45
97 98
99 100
101 102
23 40
7 58
103 104
105 106
107 108
25 32
16 26
109 110
111 112
32 57
113 114
115 116
117 118
119 120
121 122
12 47
2 22
123 124
4 12
125...

result:

ok that's great! (sum n = 98829, sum m = 3000000) (47 test cases)

Test #35:

score: 0
Accepted
time: 666ms
memory: 22524kb

input:

52
2688 8
453 829
353 453
453 2363
750 2363
797 938
750 2612
797 2612
353 829
226 4143
72 116
94 156
8 205
13 15
44 101
54 101
26 146
2 161
114 139
123 134
24 62
30 153
157 178
65 191
101 139
33 57
148 193
146 159
29 74
70 121
109 136
45 112
112 180
67 215
18 59
82 143
8 155
181 202
55 194
128 174
1...

output:

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

result:

ok that's great! (sum n = 107778, sum m = 3000000) (52 test cases)

Test #36:

score: 0
Accepted
time: 636ms
memory: 25420kb

input:

41
918 34485
302 692
486 663
461 780
198 810
239 330
272 347
229 769
148 238
144 472
26 837
375 856
220 487
60 561
27 460
10 556
362 666
339 790
608 742
223 830
25 898
640 847
262 311
204 465
328 494
101 344
156 207
621 910
234 726
82 225
51 300
230 615
102 761
82 569
875 901
355 810
271 843
59 841
...

output:

Yes
49 918
1 2
47 48
36 41
28 45
30 36
20 28
6 9
10 16
6 14
12 30
2 44
35 39
4 7
2 8
6 47
27 36
10 19
10 11
29 31
12 44
4 14
37 45
36 43
23 48
14 33
40 43
35 44
2 26
14 30
14 38
1 4
19 40
7 10
22 48
17 26
11 15
2 43
10 13
19 30
13 49
13 39
8 20
2 7
10 26
3 31
20 45
12 31
32 48
8 25
14 25
1 14
6 33
1...

result:

ok that's great! (sum n = 130911, sum m = 3000000) (41 test cases)

Test #37:

score: 0
Accepted
time: 653ms
memory: 26036kb

input:

38
9054 4
1330 5030
273 6005
6005 6814
5030 7284
7641 169509
4533 6988
3960 4941
1016 5421
5007 7497
3490 5354
3370 6111
1373 6006
727 7194
108 5316
3162 6320
1096 7111
4970 6219
3490 6172
2955 6081
2270 3017
4313 6751
2341 2730
1780 6172
5197 6137
2316 7208
140 3999
820 5815
2471 6288
152 6771
2319...

output:

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

result:

ok that's great! (sum n = 207979, sum m = 3000000) (38 test cases)

Test #38:

score: 0
Accepted
time: 701ms
memory: 27732kb

input:

32
9549 184425
3769 8881
3816 7958
2297 5867
5145 9032
3315 5678
6600 8732
8312 8352
3642 9494
5897 7519
1460 9427
1225 6410
1453 5982
1050 7961
649 1897
5873 8095
3907 5533
4687 5272
4464 9432
8738 8848
5347 7853
6529 8852
3947 7530
3319 5086
5177 8403
4198 5137
5201 8602
2370 4742
3136 4068
349 22...

output:

Yes
13712 9549
1 2
3 4
5 6
67 107
115 116
117 118
17 107
119 120
121 122
18 24
123 124
125 126
13 78
127 128
129 130
131 132
20 66
133 134
135 136
54 98
137 138
139 140
141 142
27 31
143 144
145 146
43 98
147 148
149 150
151 152
39 58
77 79
153 154
155 156
52 107
22 91
157 158
159 160
161 162
163 16...

result:

ok that's great! (sum n = 179588, sum m = 3000000) (32 test cases)

Test #39:

score: 0
Accepted
time: 662ms
memory: 28100kb

input:

36
5235 159223
259 858
2592 3667
116 3140
2119 3478
1539 4429
1980 2410
186 1570
2337 4303
206 2332
1894 2176
2177 2258
281 2667
1017 1147
2061 3106
1410 1475
366 2888
845 874
4156 5147
252 4232
735 789
2278 3385
420 5119
1650 3680
472 1868
2647 3843
256 1363
226 3474
473 1770
2901 4580
2113 2119
20...

output:

Yes
5624 5235
1 2
14 24
111 112
39 83
57 70
66 83
32 38
113 114
115 116
13 18
5 62
117 118
119 120
49 103
27 84
23 28
67 88
121 122
123 124
125 126
127 128
129 130
56 71
52 57
51 71
131 132
10 50
35 45
133 134
135 136
35 67
21 39
137 138
24 38
139 140
141 142
143 144
39 66
4 62
145 146
39 55
147 148...

result:

ok that's great! (sum n = 198942, sum m = 3000000) (36 test cases)

Test #40:

score: 0
Accepted
time: 708ms
memory: 33168kb

input:

33
12395 0
4142 167625
245 1626
547 3180
837 1244
193 1081
347 844
2125 2499
1833 3933
2296 4001
1162 3552
3002 3708
1454 1725
922 3895
534 1546
1424 2540
2866 3320
860 2132
3209 4130
830 3834
17 3451
655 2168
2822 3688
647 3323
3740 3751
3752 3814
1956 2497
2410 3863
2344 3761
2866 3472
535 3064
33...

output:

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

result:

ok that's great! (sum n = 293242, sum m = 3000000) (33 test cases)

Test #41:

score: 0
Accepted
time: 744ms
memory: 33024kb

input:

37
17600 17242
5505 11380
8075 14278
8477 9369
10240 15385
2654 2863
455 9691
12743 16046
12233 16046
8443 11799
62 10414
3295 15778
11143 12290
260 14136
690 5234
6810 16213
9430 10076
7842 11399
8088 10996
1200 14422
7456 16712
11811 13685
7861 10076
12872 15026
4876 13677
5749 8088
8339 16610
57 ...

output:

Yes
34098 17600
1 2
3 4
5 6
7 8
9 10
11 12
61 62
63 64
30 41
65 66
67 68
69 70
71 72
73 74
75 76
77 78
79 80
81 82
83 84
85 86
87 88
89 90
91 92
93 94
95 96
97 98
22 31
99 100
101 102
103 104
105 106
107 108
109 110
111 112
113 114
115 116
117 118
13 58
119 120
121 122
123 124
125 126
127 128
129 13...

result:

ok that's great! (sum n = 299984, sum m = 3000000) (37 test cases)

Test #42:

score: 0
Accepted
time: 889ms
memory: 33992kb

input:

33
19845 230274
11728 15986
257 4596
503 15990
15022 16543
732 12728
8104 15865
3121 17470
13607 15882
1879 16851
142 2057
10673 11877
9190 14659
11219 18119
7672 14190
266 11912
5651 6060
347 17125
12401 16504
9879 11119
12443 17722
204 12533
13477 14564
5500 11722
5430 15904
6659 11478
18362 18839...

output:

Yes
33170 19845
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
61 70
135 136
137 138
139 140
39 107
141 142
143 144
145 146
147 148
149 150
151 152
153 154
155 156
157 158
159 160
161 162
163 164
165 166
167 168
169 170
40 109
70 85
171 172
173 174
175 176
177 178
179 180
181 1...

result:

ok that's great! (sum n = 299797, sum m = 3000000) (33 test cases)

Test #43:

score: 0
Accepted
time: 707ms
memory: 34480kb

input:

32
335 3799
141 214
145 310
103 188
174 269
69 315
261 268
134 257
270 327
9 27
258 307
218 228
307 334
229 250
8 197
61 121
186 232
9 174
67 91
64 174
43 185
58 179
24 92
58 217
16 278
120 240
221 251
27 196
5 160
8 56
161 185
120 222
121 196
187 255
221 228
255 268
114 305
36 306
83 225
223 327
22...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 2847258) (32 test cases)

Test #44:

score: 0
Accepted
time: 805ms
memory: 36496kb

input:

30
8141 47416
3603 7546
486 5336
4017 7215
1964 5816
1307 4468
3782 5938
2958 7408
4526 5973
3203 7403
6623 7215
3407 7844
816 4367
1382 2555
3508 5938
3407 5817
1580 8017
3546 7352
357 1645
289 5655
4105 7383
3014 7887
4792 6411
167 1719
3125 6237
3014 5488
5740 5796
2928 5655
1368 2048
2697 5945
5...

output:

Yes
14128 8141
1 2
50 51
7 31
52 53
54 55
56 57
58 59
60 61
1 42
62 63
64 65
66 67
68 69
70 71
72 73
74 75
76 77
78 79
80 81
10 29
6 19
82 83
84 85
86 87
88 89
90 91
92 93
94 95
96 97
98 99
15 22
100 101
102 103
104 105
106 107
108 109
33 40
110 111
112 113
6 13
114 115
116 117
118 119
12 35
120 121...

result:

ok that's great! (sum n = 300000, sum m = 2974703) (30 test cases)

Test #45:

score: 0
Accepted
time: 684ms
memory: 35264kb

input:

31
27511 200045
14431 27486
3637 20331
868 5552
21451 24334
601 4128
22649 27094
1928 17970
21075 27086
4561 10937
4461 22784
6343 10532
10253 20400
12295 21168
15949 17377
14845 14979
4914 6552
918 27316
19656 20534
4102 15245
5138 16859
1450 11548
13163 19936
6984 7458
13292 16196
3739 5161
20053 ...

output:

No
No
Yes
25854 14399
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
45 46
47 48
49 50
51 52
53 54
126 127
128 129
130 131
57 91
132 133
134 135
136 137
96 106
138 139
140 141
142 143
144 145
146 147
72 77
85 100
148 149
150...

result:

ok that's great! (sum n = 300000, sum m = 2998405) (31 test cases)

Test #46:

score: 0
Accepted
time: 617ms
memory: 19380kb

input:

3450
73 667
1 60
29 55
11 59
20 25
15 47
13 47
15 35
28 71
22 44
7 64
11 49
7 19
11 50
49 53
23 62
36 59
2 3
5 41
10 55
4 38
62 65
30 48
14 25
6 33
22 69
10 11
56 73
4 63
57 65
26 43
22 26
51 56
9 15
61 64
39 67
31 45
23 34
13 50
12 17
14 20
35 48
29 56
24 25
47 57
39 51
43 50
66 73
5 36
35 53
3 15
...

output:

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

result:

ok that's great! (sum n = 285800, sum m = 3000000) (3450 test cases)

Test #47:

score: 0
Accepted
time: 594ms
memory: 19604kb

input:

2638
32 184
18 22
15 17
5 30
2 17
17 25
10 28
6 30
11 22
19 22
23 27
6 13
15 25
6 12
11 25
2 4
5 11
18 28
12 25
13 27
3 27
11 21
5 7
6 28
17 23
24 25
24 31
11 15
17 26
3 13
9 30
6 29
26 29
4 17
8 14
17 24
15 23
1 29
3 28
9 18
13 32
8 22
5 15
12 24
12 29
3 18
1 9
13 31
27 31
4 23
1 14
3 26
14 15
1 10...

output:

Yes
10 32
1 2
5 7
4 5
1 7
5 8
1 5
1 8
2 10
2 8
2 4
8 9
3 5
5 9
2 7
7 8
4 7
3 7
4 8
6 10
2 9
4 9
8 10
6 7
3 9
3 8
3 4
5 6
1 4
1 3
2 5
6 9
5 10
Yes
4 2
1 2
3 4
Yes
18 75
1 2
2 9
8 12
4 9
2 5
1 14
1 7
5 8
9 13
1 15
7 8
5 7
1 11
7 11
1 8
6 9
5 9
8 11
1 3
11 13
4 11
6 11
4 14
5 14
10 11
4 8
9 15
15 16
7 ...

result:

ok that's great! (sum n = 257395, sum m = 3000000) (2638 test cases)

Test #48:

score: 0
Accepted
time: 584ms
memory: 18040kb

input:

2037
83 114
24 82
24 31
24 54
32 57
30 74
24 28
50 74
40 44
15 60
60 67
44 65
44 66
28 53
2 78
28 40
50 69
22 60
69 82
40 57
24 40
65 67
31 82
22 69
53 69
22 74
35 38
69 74
65 66
66 74
44 69
66 78
22 57
37 78
22 50
40 53
2 32
2 37
35 60
32 60
35 57
32 35
15 24
15 57
57 60
2 50
15 32
54 75
30 37
15 3...

output:

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

result:

ok that's great! (sum n = 233764, sum m = 3000000) (2037 test cases)

Test #49:

score: 0
Accepted
time: 595ms
memory: 18976kb

input:

1813
197 3378
8 132
25 75
156 169
96 148
30 87
81 185
66 177
118 131
50 103
48 135
85 145
105 133
46 173
69 110
122 181
28 108
69 181
43 195
101 155
26 51
117 190
165 171
5 157
31 183
51 195
135 159
44 124
30 74
129 147
49 172
72 159
4 29
142 162
72 76
13 182
18 182
16 161
174 182
20 103
123 191
8 5...

output:

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

result:

ok that's great! (sum n = 225372, sum m = 3000000) (1813 test cases)

Test #50:

score: 0
Accepted
time: 422ms
memory: 32472kb

input:

27
16686 64795
3765 7749
226 12234
2556 8932
9341 11404
2025 2717
14273 14800
965 2597
5472 11735
3544 9444
12013 15899
2869 14399
1323 12802
12339 12406
12328 16285
5393 12245
4415 8977
9332 11214
11717 13913
3034 6699
469 1039
11096 11886
1810 3038
9676 12933
1718 8436
8958 10152
6167 14713
2629 1...

output:

Yes
30581 16686
1 2
3 4
5 6
7 8
81 82
83 84
85 86
87 88
89 90
91 92
93 94
95 96
56 64
97 98
99 100
101 102
103 104
105 106
31 52
107 108
109 110
111 112
113 114
115 116
117 118
119 120
121 122
123 124
125 126
127 128
129 130
131 132
133 134
135 136
137 138
139 140
141 142
143 144
145 146
21 34
147 1...

result:

ok that's great! (sum n = 300000, sum m = 1562874) (27 test cases)

Test #51:

score: 0
Accepted
time: 821ms
memory: 38008kb

input:

24
1516 1694
556 1219
751 1341
1015 1140
394 1253
890 972
34 976
557 913
186 1209
590 1018
647 1140
1405 1460
134 1341
590 1003
169 273
11 140
110 390
489 689
405 1157
286 913
444 751
459 1419
518 1018
518 643
374 848
110 950
932 1102
1296 1392
647 1209
472 1109
74 913
369 950
154 932
74 1157
19 751...

output:

Yes
2800 1516
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
43 44
45 46
47 48
49 50
51 52
53 54
55 56
25 27
57 58
59 60
61 62
63 64
65 66
67 68
69 70
71 72
73 74
75 76
28 33
77 78
79 80
81 82
23 28
83 84
85 86
87 88
89 90
91 92
93 94
95 96
97 98
99 100
101 102
103 104
105 106
29 35
107 10...

result:

ok that's great! (sum n = 299927, sum m = 3000000) (24 test cases)

Test #52:

score: 0
Accepted
time: 783ms
memory: 42248kb

input:

16
10582 199186
22 1980
1828 7051
288 634
4837 7875
2746 5374
803 4917
8342 9735
2917 6927
5307 9477
5227 6693
4567 6881
4240 10211
103 5626
758 8631
2110 8886
7748 9392
2880 7898
3889 9234
146 1435
530 3758
1548 2972
827 8682
10104 10444
1523 7670
4965 7408
2479 5640
4449 7206
886 5048
6052 7171
39...

output:

Yes
15250 10582
1 2
3 4
113 114
115 116
117 118
27 45
119 120
60 76
121 122
71 98
123 124
28 46
125 126
70 93
127 128
36 47
129 130
131 132
25 77
133 134
135 136
11 12
137 138
139 140
141 142
143 144
40 60
145 146
147 148
54 56
149 150
17 54
151 152
153 154
155 156
157 158
159 160
161 162
163 164
31...

result:

ok that's great! (sum n = 300000, sum m = 2961875) (16 test cases)

Test #53:

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

input:

11
21566 516221
6909 17836
10230 21242
114 6607
9127 11384
2716 7314
4443 19172
4649 7485
15656 18157
1182 11931
8997 12637
11709 15455
6655 7695
3377 9063
363 10459
2942 6445
13108 21241
7960 10624
2013 11871
18654 20058
148 15436
12363 21455
2234 15005
499 8082
320 1549
9158 15817
11687 16811
8430...

output:

Yes
32578 21566
1 2
3 4
114 115
33 34
116 117
52 101
118 119
120 121
122 123
124 125
126 127
128 129
130 131
132 133
13 60
134 135
136 137
60 78
38 54
29 47
138 139
29 86
140 141
20 73
142 143
144 145
146 147
148 149
27 83
150 151
152 153
154 155
156 157
49 61
96 111
158 159
160 161
162 163
164 165
...

result:

ok that's great! (sum n = 265250, sum m = 3000000) (11 test cases)

Test #54:

score: 0
Accepted
time: 932ms
memory: 54200kb

input:

14
7801 88
153 2675
316 5402
997 3521
3328 5565
316 7475
6572 6833
997 3345
6459 6891
456 5402
997 5545
2711 6891
6459 6833
2675 3328
2711 5402
316 2685
6459 6572
2711 7761
1262 6833
153 2753
2753 5565
2685 3328
3355 6459
997 2711
456 3345
6572 6891
1262 2675
2711 3345
3328 6833
3540 7475
3345 5545
...

output:

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

result:

ok that's great! (sum n = 299941, sum m = 3000000) (14 test cases)

Test #55:

score: 0
Accepted
time: 872ms
memory: 44084kb

input:

21
9463 3482
4249 5310
191 2099
3889 5020
2199 3361
4737 7177
7296 8615
528 8642
1348 1417
2624 5832
2936 8502
4737 7915
1933 8468
2930 6106
5996 8437
859 2273
528 7406
5830 6553
3070 8832
856 7469
1388 6528
461 3907
5742 7920
6206 7892
1180 9229
7296 7915
6946 7177
236 7959
5027 7469
3889 7959
4216...

output:

Yes
18548 9463
1 2
3 4
5 6
7 8
9 10
11 12
35 36
37 38
39 40
41 42
43 44
45 46
47 48
49 50
51 52
53 54
55 56
57 58
59 60
61 62
63 64
65 66
67 68
69 70
71 72
73 74
75 76
77 78
79 80
81 82
83 84
85 86
87 88
12 29
89 90
91 92
93 94
95 96
97 98
99 100
101 102
103 104
105 106
107 108
109 110
111 112
113 1...

result:

ok that's great! (sum n = 300000, sum m = 2999999) (21 test cases)

Test #56:

score: 0
Accepted
time: 953ms
memory: 51964kb

input:

20
19878 32
3893 16147
10823 14133
3893 6914
5384 17268
8902 15983
438 3669
3893 5384
3893 15983
14133 17268
6914 16147
8902 10823
12005 14133
11691 16147
8902 16147
15983 17268
3669 6914
11691 15983
8902 13770
3893 17268
8902 11691
10823 11691
5384 15983
10823 16147
438 13770
12005 17268
13770 1614...

output:

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

result:

ok that's great! (sum n = 299996, sum m = 3000000) (20 test cases)

Test #57:

score: 0
Accepted
time: 923ms
memory: 51780kb

input:

18
462 12605
129 462
19 68
88 307
101 140
140 318
347 360
86 193
68 155
377 416
257 328
383 400
390 444
46 320
396 398
86 237
211 403
56 397
294 422
34 114
95 175
268 394
217 369
14 411
71 277
154 442
85 413
64 400
94 350
280 352
107 310
273 319
40 167
80 424
6 39
238 334
249 428
248 346
185 259
202...

output:

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

result:

ok that's great! (sum n = 299987, sum m = 3000000) (18 test cases)

Test #58:

score: 0
Accepted
time: 919ms
memory: 56032kb

input:

17
50097 200421
17256 37403
10923 36257
7188 49287
7680 22079
1233 42840
29920 48596
19390 47941
37717 44604
3768 48253
37598 44224
21756 24145
32625 33796
28533 48253
18784 36476
18918 21060
11551 36875
1473 35053
38575 48184
24646 28868
8155 45473
29952 36440
18711 36337
30688 43015
10902 35194
21...

output:

Yes
94286 50097
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
45 46
47 48
49 50
51 52
160 161
162 163
164 165
166 167
168 169
170 171
172 173
174 175
176 177
178 179
180 181
182 183
184 185
186 187
188 189
190 191
192 193
1...

result:

ok that's great! (sum n = 300000, sum m = 2991933) (17 test cases)

Test #59:

score: 0
Accepted
time: 943ms
memory: 49460kb

input:

18
12119 1247
6217 8133
6771 7404
3345 7816
7682 11857
1847 8528
627 8578
5241 9426
6814 7840
726 9100
3864 11634
6999 11221
3209 11410
3966 10478
6771 7100
3738 11297
1732 5829
5241 8896
7841 11634
4280 9776
2959 5642
5642 8628
3891 8209
6051 7443
7898 11033
4039 5689
4442 5439
2256 3521
4607 11578...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 2999999) (18 test cases)

Test #60:

score: 0
Accepted
time: 933ms
memory: 53604kb

input:

11
11 24
9 10
5 6
1 7
1 2
4 10
4 7
6 11
7 8
6 10
10 11
1 4
5 10
4 9
5 11
1 3
7 11
2 7
2 4
3 7
5 9
4 11
3 8
1 11
2 11
77622 390427
19664 67006
27296 52166
59603 69655
19776 52166
40360 50475
51555 53913
45852 50025
20741 61112
6626 59877
28135 40844
37061 65119
19472 69173
3045 59950
66200 73719
1202...

output:

Yes
9 11
1 2
1 5
2 3
1 6
7 9
7 8
1 3
3 4
6 9
6 7
1 7
Yes
146154 77622
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
142 143
144 145
35 88
146 147
148 149
150 151
152 153
154 155
156 157
158 159
160 161
162 163
164 165
166 167
168 169
170 171
172 173
174...

result:

ok that's great! (sum n = 300000, sum m = 2999852) (11 test cases)

Test #61:

score: 0
Accepted
time: 941ms
memory: 61392kb

input:

14
14 31
7 13
3 14
12 14
4 9
3 9
4 11
11 13
4 7
5 14
2 10
10 14
6 8
2 14
4 13
7 10
2 12
10 12
7 9
7 12
5 12
1 8
7 14
2 3
3 5
6 11
10 13
9 13
10 11
2 7
2 9
4 6
475 13283
104 339
236 390
131 337
266 459
286 318
161 315
222 327
15 402
81 398
141 278
92 230
84 265
28 40
239 395
233 430
144 343
124 377
2...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 2999901) (14 test cases)

Test #62:

score: 0
Accepted
time: 881ms
memory: 50756kb

input:

13
5657 6666
2347 3929
2907 3432
3929 4681
1414 4927
2758 5091
87 3642
253 515
2393 3048
3569 5343
470 4358
4248 5454
847 4084
2392 3656
2721 4347
1623 4113
756 5584
1951 2700
1202 4828
4552 4565
1718 4936
1077 4059
3106 3376
671 4861
135 1466
3722 5369
1926 3504
2538 5059
500 1267
1127 3071
604 442...

output:

Yes
10697 5657
1 2
3 4
5 6
7 8
9 10
11 12
13 14
51 52
53 54
55 56
57 58
59 60
61 62
63 64
65 66
67 68
14 33
69 70
71 72
73 74
75 76
77 78
79 80
81 82
16 18
83 84
85 86
87 88
89 90
91 92
93 94
95 96
34 38
97 98
99 100
101 102
103 104
105 106
107 108
109 110
111 112
113 114
115 116
117 118
119 120
121...

result:

ok that's great! (sum n = 300000, sum m = 2999904) (13 test cases)

Test #63:

score: 0
Accepted
time: 894ms
memory: 50488kb

input:

16
1030 68
366 901
366 393
31 84
142 803
640 901
568 863
393 803
366 803
568 640
184 803
574 803
568 803
84 224
224 863
31 411
31 224
342 574
393 607
184 977
142 692
692 977
84 366
313 640
607 901
253 393
803 977
142 977
313 574
142 574
313 411
84 568
84 253
253 607
31 142
342 411
84 142
224 253
184...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 2999941) (16 test cases)

Test #64:

score: 0
Accepted
time: 971ms
memory: 49552kb

input:

21
128830 194705
2707 21887
96471 109999
17543 72201
32975 109831
14568 93566
37840 80840
112962 121466
49785 70320
65358 113338
9272 41267
39569 121414
29764 117123
83116 105486
32383 97753
59725 82053
2707 49079
76894 121836
69814 78799
106885 115539
446 124699
102142 103139
24261 37014
47453 5293...

output:

Yes
251815 128830
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
136 137
138 139
140 141
142 143
144 145
146 147
148 149
150 151
152 153
154 155
156 157
158 159
160 161
162 163
164 165
166 167
168 169
170 171
172 173
174 175
176 177
178 179
180 181
182 183
184 185
186 187
188 1...

result:

ok that's great! (sum n = 300000, sum m = 2999811) (21 test cases)

Test #65:

score: 0
Accepted
time: 884ms
memory: 50032kb

input:

15
8 1
2 3
2 0
52 1
20 34
2 0
2146 838
561 848
833 1754
1343 2036
135 2029
638 647
1611 2030
459 2029
184 1061
274 1917
945 1178
135 1150
538 561
884 1732
343 833
39 144
184 2036
281 1611
184 538
449 1584
229 1369
281 1868
145 1369
229 2030
518 2075
538 1536
1190 1948
1150 1582
184 511
667 1061
1274...

output:

Yes
15 8
1 2
3 4
3 5
6 7
8 9
10 11
12 13
14 15
Yes
4 2
1 2
3 4
Yes
103 52
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
42 43
44 45
46 47
48 49
50 51
52 53
54 55
56 57
58 59
60 61
62 63
64 65
66 67
39 41
68 69
70 71
72 73
74 75
76 77
7...

result:

ok that's great! (sum n = 300000, sum m = 2999999) (15 test cases)

Test #66:

score: 0
Accepted
time: 845ms
memory: 51928kb

input:

16
1 0
25532 90615
1799 19462
593 15854
10358 12719
7127 13104
3630 19017
7744 21425
15182 25485
9074 11894
44 9485
8459 9914
3341 16988
2363 7796
6905 15487
6828 8418
257 14087
18019 22473
3144 18882
5671 10411
11169 23470
10063 20838
3758 18367
3402 21904
4266 14240
11048 23242
21511 23108
12719 1...

output:

Yes
2 1
1 2
Yes
47550 25532
1 2
3 4
5 6
78 79
80 81
82 83
84 85
86 87
88 89
90 91
92 93
94 95
96 97
98 99
100 101
102 103
104 105
106 107
108 109
110 111
38 74
112 113
114 115
116 117
118 119
120 121
122 123
124 125
126 127
128 129
130 131
132 133
134 135
136 137
138 139
140 141
142 143
144 145
146 ...

result:

ok that's great! (sum n = 300000, sum m = 2852224) (16 test cases)

Test #67:

score: 0
Accepted
time: 1041ms
memory: 53224kb

input:

11
55 237
38 53
5 30
47 55
12 30
20 21
1 54
1 26
6 55
1 38
41 55
8 33
42 43
6 12
1 20
10 22
17 34
19 38
50 51
26 38
10 52
8 25
3 43
6 10
13 50
10 30
22 40
10 25
3 5
18 42
1 8
30 45
5 31
13 42
41 54
31 33
6 40
35 47
34 42
22 55
21 22
3 19
51 53
17 38
31 45
34 35
3 17
22 30
19 34
6 34
47 50
42 45
21 4...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 2999992) (11 test cases)

Test #68:

score: 0
Accepted
time: 890ms
memory: 49952kb

input:

15
38002 1578639
25652 36001
12874 21272
3217 7981
417 29158
20168 34327
884 2535
16158 19576
5505 16571
9724 23070
23720 23926
1422 11092
9265 29283
2139 29226
13210 13803
21059 22393
9059 16256
3159 33001
17427 32151
21277 36591
28091 28432
9215 22662
7381 35295
13120 28747
2333 33148
22753 28842
...

output:

Yes
53475 38002
1 2
3 4
5 6
7 8
170 171
113 138
123 141
172 173
174 175
176 177
178 179
180 181
182 183
184 185
186 187
188 189
190 191
192 193
194 195
196 197
198 199
200 201
18 74
202 203
81 120
204 205
206 207
25 133
208 209
136 141
210 211
120 161
212 213
26 167
65 135
214 215
124 146
216 217
13...

result:

ok that's great! (sum n = 300000, sum m = 2628253) (15 test cases)

Test #69:

score: 0
Accepted
time: 953ms
memory: 51932kb

input:

12
1846 7280
770 1163
129 1280
474 909
968 1567
28 1808
288 853
7 1496
1295 1566
225 766
942 1212
28 1191
70 103
860 1106
1363 1724
261 1212
24 523
1090 1188
696 1234
24 1698
305 572
654 1177
1092 1842
1652 1675
383 698
803 1675
268 729
460 485
1051 1098
588 949
86 1719
1062 1352
819 1357
588 1712
6...

output:

Yes
3044 1846
1 2
3 4
5 6
7 8
9 10
11 12
13 14
21 33
47 48
49 50
51 52
53 54
55 56
29 30
57 58
59 60
61 62
63 64
19 36
65 66
18 26
67 68
69 70
14 22
71 72
73 74
75 76
32 41
77 78
79 80
81 82
83 84
85 86
87 88
89 90
91 92
93 94
95 96
97 98
99 100
101 102
21 41
103 104
27 30
105 106
107 108
16 32
109 ...

result:

ok that's great! (sum n = 300000, sum m = 2999572) (12 test cases)

Test #70:

score: 0
Accepted
time: 979ms
memory: 56132kb

input:

15
1 0
15 2
4 9
9 13
8682 187
23 3290
151 7904
2816 6885
481 7618
1205 2816
481 6655
4534 6841
151 6885
5837 8277
6217 6814
7618 8515
6841 7771
41 4839
481 4128
827 6885
6217 7798
3617 8277
6655 8515
6655 8580
3290 6841
1205 7771
6841 7570
41 3617
6814 7618
3617 7618
4128 4534
7798 7904
827 6245
790...

output:

Yes
2 1
1 2
Yes
28 15
1 2
3 4
5 6
7 8
11 12
13 14
15 16
17 18
7 9
19 20
21 22
23 24
9 10
25 26
27 28
Yes
17308 8682
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
45 46
55 56
57 58
59 60
61 62
63 64
65 66
67 68
69 70
71 72
7...

result:

ok that's great! (sum n = 300000, sum m = 2999998) (15 test cases)

Test #71:

score: 0
Accepted
time: 308ms
memory: 26932kb

input:

12
229 4389
17 153
51 77
17 172
95 193
32 64
10 172
73 138
60 195
98 209
24 112
9 212
82 143
3 209
14 82
97 154
163 185
7 57
47 139
38 50
105 160
37 177
65 146
87 151
20 83
39 192
87 148
6 220
107 216
18 166
161 191
5 29
35 99
46 183
85 166
4 94
31 66
13 198
171 196
199 214
29 212
10 108
25 90
75 21...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 726112) (12 test cases)

Test #72:

score: 0
Accepted
time: 903ms
memory: 56192kb

input:

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

output:

Yes
13 49
1 2
5 8
7 8
4 7
7 10
3 9
4 9
2 9
1 7
5 9
8 9
1 8
3 4
8 11
5 10
4 5
4 10
3 10
6 8
9 10
2 7
3 6
8 13
4 6
7 9
6 9
2 8
1 3
1 5
10 11
6 7
2 6
2 3
2 5
1 6
8 10
3 5
1 4
3 8
1 9
6 10
4 8
2 10
5 7
1 10
11 12
2 4
3 7
5 6
Yes
6 5
1 2
1 3
3 5
3 4
2 6
Yes
9 6
1 2
3 4
7 8
5 6
3 5
7 9
Yes
73 1734
1 2
30 ...

result:

ok that's great! (sum n = 300000, sum m = 2899616) (7 test cases)

Test #73:

score: 0
Accepted
time: 554ms
memory: 37512kb

input:

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

output:

Yes
15 50
1 2
10 11
2 10
8 11
7 8
1 7
4 7
4 15
2 8
8 10
3 7
3 11
6 10
1 10
4 5
2 9
2 7
4 9
1 9
8 12
1 11
7 10
12 14
2 3
4 6
4 11
2 6
3 6
7 9
6 8
9 10
6 9
2 4
3 9
4 10
2 11
6 7
1 3
6 11
1 6
3 8
4 8
8 9
12 13
3 4
1 4
9 11
7 11
1 8
3 10
Yes
10 37
1 2
8 9
3 5
2 7
3 9
2 9
1 6
1 3
3 4
7 8
2 4
9 10
6 8
5 8...

result:

ok that's great! (sum n = 300000, sum m = 1515620) (15 test cases)

Test #74:

score: 0
Accepted
time: 1060ms
memory: 59888kb

input:

14
6349 16835
2332 2536
220 1974
1319 1525
264 3678
658 2667
644 1329
3364 3903
996 6257
1737 4391
1531 4924
2400 4151
1555 2816
106 1467
167 730
1044 6159
1044 2624
819 3101
404 2633
1172 4066
3595 5313
2438 4483
3999 4264
503 6319
2962 3873
395 3002
1180 1510
3474 4483
1558 5503
911 3744
1905 3346...

output:

Yes
11592 6349
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
74 75
76 77
78 79
80 81
55 56
82 83
84 85
86 87
88 89
90 91
92 93
94 95
96 97
98 99
100 101
102 103
104 105
106 107
108 109
110 111
112 113
29 47
114 115
29 63
116 117
118 119
120 121
122 123
124 125
126 127
128 129
...

result:

ok that's great! (sum n = 300000, sum m = 2999825) (14 test cases)

Test #75:

score: 0
Accepted
time: 801ms
memory: 39704kb

input:

20
285 5617
141 184
21 64
126 191
14 194
36 155
55 260
8 150
79 267
82 216
15 164
18 57
110 263
21 85
33 235
54 260
133 191
162 181
40 128
176 205
87 158
114 135
189 237
42 133
72 279
156 179
160 272
61 190
67 154
13 149
67 213
21 69
92 96
222 239
247 269
163 196
148 187
21 101
174 238
15 64
72 251
...

output:

Yes
33 285
1 2
8 23
16 26
10 15
15 18
3 21
22 23
10 12
12 19
14 31
13 23
28 32
14 18
1 17
5 25
10 14
4 16
15 19
11 18
17 18
20 22
14 32
17 28
6 29
4 12
31 32
5 18
8 11
10 17
13 17
5 6
3 10
6 7
10 22
3 13
21 23
14 20
1 18
1 8
16 22
4 6
7 13
16 18
7 10
12 24
1 13
7 15
22 24
13 24
7 17
3 7
8 28
12 18
8...

result:

ok that's great! (sum n = 300000, sum m = 2844468) (20 test cases)

Test #76:

score: 0
Accepted
time: 880ms
memory: 53076kb

input:

16
20 14
11 13
12 16
11 12
1 7
10 11
12 20
7 16
8 13
11 16
10 13
2 5
10 20
8 18
1 5
81 0
2 0
9774 1735
1799 4654
7415 9367
256 2632
1641 3188
6162 9643
5876 7934
1453 6567
2360 7737
1453 2360
2360 8691
4905 6638
7156 9506
7215 8948
5915 7251
4896 5798
2943 6732
8611 9358
5851 7418
4407 7146
2857 331...

output:

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

result:

ok that's great! (sum n = 300000, sum m = 2999994) (16 test cases)

Test #77:

score: 0
Accepted
time: 1314ms
memory: 47260kb

input:

1
300000 2358937
192970 272531
122003 158946
255691 294793
51704 262865
119440 279146
225321 249954
19066 125336
14150 36379
80261 112311
141995 285858
8085 290445
229184 241830
11762 99234
100623 282678
41309 235346
56578 189172
104864 257299
53620 94547
178788 267251
193551 209443
103157 265506
94...

output:

Yes
67840 300000
1 2
11 12
21 22
31 32
41 42
51 52
61 62
71 72
81 82
91 92
101 102
111 112
121 122
131 132
141 142
151 152
161 162
171 172
181 182
191 192
201 202
211 212
221 222
231 232
241 242
251 252
261 262
271 272
281 282
291 292
301 302
311 312
321 322
331 332
341 342
351 352
361 362
371 372
3...

result:

ok that's great! (sum n = 300000, sum m = 2358937) (1 test case)

Test #78:

score: 0
Accepted
time: 1102ms
memory: 47040kb

input:

1
300000 1781686
13025 190261
84725 234810
188596 237589
38327 68414
98803 157541
279323 295616
14945 42759
243383 275922
53713 245122
204079 239143
279976 288799
83977 278200
4264 234285
93946 230838
47657 285885
34943 188576
102912 290759
131129 297261
256544 266501
117373 209052
43541 211692
5269...

output:

Yes
86592 300000
1 2
9 10
17 18
25 26
33 34
41 42
49 50
57 58
65 66
73 74
81 82
89 90
97 98
105 106
113 114
121 122
129 130
137 138
145 146
153 154
161 162
169 170
177 178
185 186
193 194
201 202
209 210
217 218
225 226
233 234
241 242
249 250
257 258
265 266
273 274
281 282
289 290
297 298
305 306
...

result:

ok that's great! (sum n = 300000, sum m = 1781686) (1 test case)

Test #79:

score: 0
Accepted
time: 911ms
memory: 47180kb

input:

1
300000 1489093
54281 161757
151437 170800
233227 262742
146464 279261
6081 267018
12408 107225
134242 239388
157334 186176
37979 271117
1869 290413
84712 229550
104055 288777
171988 194446
13644 112526
21610 92365
106034 280324
15355 277732
4610 190422
73331 172190
262301 298765
29358 178369
4787 ...

output:

Yes
100737 300000
1 2
8 9
15 16
22 23
29 30
36 37
43 44
50 51
57 58
64 65
71 72
78 79
85 86
92 93
99 100
106 107
113 114
120 121
127 128
134 135
141 142
148 149
155 156
162 163
169 170
176 177
183 184
190 191
197 198
204 205
211 212
218 219
225 226
232 233
239 240
246 247
253 254
260 261
267 268
274...

result:

ok that's great! (sum n = 300000, sum m = 1489093) (1 test case)

Test #80:

score: 0
Accepted
time: 713ms
memory: 36500kb

input:

1
300000 1194883
118485 232473
35012 138129
52888 283792
179619 232869
94054 276522
32928 235656
126988 156346
74875 146533
5421 265324
22229 130205
59894 282610
155998 287675
69677 121057
82250 186169
15887 125442
69794 169396
66423 208201
270576 274356
217125 293447
6743 143984
78141 119720
9895 2...

output:

Yes
120516 300000
1 2
7 8
13 14
19 20
25 26
31 32
37 38
43 44
49 50
55 56
61 62
67 68
73 74
79 80
85 86
91 92
97 98
103 104
109 110
115 116
121 122
127 128
133 134
139 140
145 146
151 152
157 158
163 164
169 170
175 176
181 182
187 188
193 194
199 200
205 206
211 212
217 218
223 224
229 230
235 236
...

result:

ok that's great! (sum n = 300000, sum m = 1194883) (1 test case)

Test #81:

score: 0
Accepted
time: 655ms
memory: 36740kb

input:

1
300000 898538
172285 249431
53612 187993
218182 265023
48489 129543
195702 246863
1015 253783
156535 285915
67873 148750
110331 182404
155830 260458
42677 44704
121370 194959
141338 178252
152162 195914
141544 267451
203794 259221
204923 245267
7813 154305
113610 251746
117918 196488
33018 137733
...

output:

Yes
150245 300000
1 2
6 7
11 12
16 17
21 22
26 27
31 32
36 37
41 42
46 47
51 52
56 57
61 62
66 67
71 72
76 77
81 82
86 87
91 92
96 97
101 102
106 107
111 112
116 117
121 122
126 127
131 132
136 137
141 142
146 147
151 152
156 157
161 162
166 167
171 172
176 177
181 182
186 187
191 192
196 197
201 20...

result:

ok that's great! (sum n = 300000, sum m = 898538) (1 test case)

Test #82:

score: 0
Accepted
time: 451ms
memory: 29324kb

input:

1
300000 600000
239662 259691
230742 268433
106625 186331
117262 225446
151387 188549
5891 268935
132070 167798
12164 77229
22281 213489
103176 276167
129592 138756
133869 281235
203857 268132
215749 255764
46566 256138
146949 298278
123319 267880
260179 260986
53042 296172
16501 120402
178747 18003...

output:

Yes
200000 300000
1 2
5 6
9 10
13 14
17 18
21 22
25 26
29 30
33 34
37 38
41 42
45 46
49 50
53 54
57 58
61 62
65 66
69 70
73 74
77 78
81 82
85 86
89 90
93 94
97 98
101 102
105 106
109 110
113 114
117 118
121 122
125 126
129 130
133 134
137 138
141 142
145 146
149 150
153 154
157 158
161 162
165 166
1...

result:

ok that's great! (sum n = 300000, sum m = 600000) (1 test case)

Test #83:

score: 0
Accepted
time: 549ms
memory: 51804kb

input:

1
2601 3000000
454 976
234 689
1712 2330
1272 2243
621 916
297 1877
299 870
533 1434
879 886
1058 1729
1593 1602
1000 1102
262 2505
793 1207
273 669
1213 1379
1356 1781
397 1045
154 1478
1951 2378
262 2555
1113 2359
1325 2085
267 1959
874 1154
15 1582
327 2331
665 2382
1154 1917
1951 2266
500 1520
1...

output:

Yes
2679 2601
1 2
1 687
1 188
1 868
1 1419
1 74
1 1210
1 1093
1 1815
1 118
1 1590
1 343
1 699
1 1975
1 1560
1 2187
1 1723
1 834
1 1489
1 1299
1 2394
1 2383
1 1831
1 826
1 1953
1 1518
1 2390
1 823
1 1772
1 2362
1 644
1 295
1 1977
1 39
1 2041
1 599
1 225
1 90
1 1641
2451 2452
1 694
1 2163
1 1395
1 419...

result:

ok that's great! (sum n = 2601, sum m = 3000000) (1 test case)

Test #84:

score: 0
Accepted
time: 687ms
memory: 36500kb

input:

1
300000 1199986
23493 32550
36076 221019
108969 226559
101758 232138
89276 126162
52445 298481
37211 158136
5475 298576
73063 179708
196899 222752
82191 278193
28564 299914
118062 279866
224022 264693
175733 220576
45396 126785
103885 180165
199892 275712
119150 175677
26483 259790
130288 278612
35...

output:

Yes
333334 300000
1 2
11 12
21 22
31 32
41 42
51 52
61 62
71 72
81 82
91 92
101 102
111 112
121 122
131 132
141 142
151 152
161 162
171 172
181 182
191 192
201 202
211 212
221 222
231 232
241 242
251 252
261 262
271 272
281 282
291 292
301 302
311 312
321 322
331 332
341 342
351 352
361 362
371 372
...

result:

ok that's great! (sum n = 300000, sum m = 1199986) (1 test case)

Test #85:

score: 0
Accepted
time: 623ms
memory: 36724kb

input:

1
300000 899997
83066 195271
44035 235685
57164 69859
14388 122905
14052 238855
159852 187079
173800 215504
3391 168022
118099 173989
242789 283302
94115 174482
65972 158796
35988 65246
51756 222035
134066 146499
249740 255189
97916 239217
1221 249547
195778 260085
3924 64005
133021 169075
85032 209...

output:

Yes
342858 300000
1 2
9 10
17 18
25 26
33 34
41 42
49 50
57 58
65 66
73 74
81 82
89 90
97 98
105 106
113 114
121 122
129 130
137 138
145 146
153 154
161 162
169 170
177 178
185 186
193 194
201 202
209 210
217 218
225 226
233 234
241 242
249 250
257 258
265 266
273 274
281 282
289 290
297 298
305 306...

result:

ok that's great! (sum n = 300000, sum m = 899997) (1 test case)

Test #86:

score: 0
Accepted
time: 421ms
memory: 29428kb

input:

1
300000 600000
18866 27449
67750 265792
61732 116658
63433 204041
110602 202919
85043 265195
68399 279259
72457 297321
137482 164904
16433 115336
8162 138443
282613 288657
5960 55715
114972 163995
41300 141413
77711 175290
60781 128692
75953 263491
186082 186513
59919 119242
1095 67848
31902 285092...

output:

Yes
360000 300000
1 2
7 8
13 14
19 20
25 26
31 32
37 38
43 44
49 50
55 56
61 62
67 68
73 74
79 80
85 86
91 92
97 98
103 104
109 110
115 116
121 122
127 128
133 134
139 140
145 146
151 152
157 158
163 164
169 170
175 176
181 182
187 188
193 194
199 200
205 206
211 212
217 218
223 224
229 230
235 236
...

result:

ok that's great! (sum n = 300000, sum m = 600000) (1 test case)

Test #87:

score: 0
Accepted
time: 275ms
memory: 28272kb

input:

1
300000 300000
30505 245964
33493 82262
102022 186324
82795 182598
904 177691
83940 115813
6420 286314
97982 145863
138139 153161
119685 128483
31141 248856
158109 259343
99699 157038
92610 246606
148340 162285
199598 285320
127451 267647
58072 124517
75430 133694
53195 246223
131827 144744
97612 2...

output:

Yes
300000 300000
1 2
4 5
7 8
10 11
13 14
16 17
19 20
22 23
25 26
28 29
31 32
34 35
37 38
40 41
43 44
46 47
49 50
52 53
55 56
58 59
61 62
64 65
67 68
70 71
73 74
76 77
79 80
82 83
85 86
88 89
91 92
94 95
97 98
100 101
103 104
106 107
109 110
112 113
115 116
118 119
121 122
124 125
127 128
130 131
13...

result:

ok that's great! (sum n = 300000, sum m = 300000) (1 test case)