QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#49781#4818. Inverse Line GraphQingyuAC ✓1524ms80960kbC++234.4kb2022-09-23 02:18:542022-09-23 02:18:56

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-23 02:18:56]
  • 评测
  • 测评结果:AC
  • 用时:1524ms
  • 内存:80960kb
  • [2022-09-23 02:18:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e6 + 10;
int n, m, flag, vis[N], use[N];
int cnt, ts, cur;
pair<int, int> ans[N];
vector<int> G[N];
bool con(int u, int v) {
	for(auto o1 : {ans[u].first, ans[u].second}) {
		for(auto o2 : {ans[v].first, ans[v].second}) if(o1 && o2 && o1 == o2) return true; 
	}
	return false;
}
bool is(vector<int> &nd) {
	ts ++;
	for(auto u : nd) {
		use[u] = ts;
	}
	for(auto u : nd) {
		int cnt = 0;
		for(auto v : G[u]) if(use[v] == ts && !con(u, v)) {
			cnt ++;
		}
		if(cnt != nd.size() - 1) return false;
	}
	return true;
}
void seta(int u, int k) {
	if(!ans[u].first) ans[u].first = k;
	else if(!ans[u].second) ans[u].second = k;
	else assert(false);
}
bool full(int u) {
	return ans[u].first && ans[u].second;
}
bool dfs(int u) {
	if(full(u)) return true;
	seta(u, ++ cnt);
	vector<int> ret;
	for(auto v : G[u]) if(!full(v) && ans[v].first != ans[u].first) {
		ret.emplace_back(v);
	}
	if(!is(ret)) return false;
	for(auto v : ret) seta(v, cnt);
	for(auto v : ret) {
		if(!dfs(v)) return false;
	}
	return true;
}
void init(vector<int> &nd) {
	for(auto i : nd) ans[i] = {0, 0};
}
bool check(int rt, vector<int> s1, vector<int> s2, vector<int> nd) {
	init(nd);
	cnt = cur + 2;
	ans[rt] = {cur + 1, cur + 2};
	for(auto u : s1) seta(u, cur + 1);
	for(auto u : s2) seta(u, cur + 2);
	for(auto u : s1) if(!dfs(u)) return false;
	for(auto u : s2) if(!dfs(u)) return false;
	for(auto u : nd) {
		for(auto v : G[u]) {
			if(!con(u, v)) return false;
		}
	}
	return true;
}
void print(int type = 0) {
	if(flag) return ;
	flag = 1;
	if(type) {
		cout << "No\n";
	}
	else {
		cout << "Yes\n";
		for(int i = 1; i <= n; i ++) {
			if(!ans[i].second) ans[i].second = ++ cnt;	
		}
		cout << cnt << ' ' << n << '\n';
		for(int i = 1; i <= n; i ++) {
			cout << ans[i].first << ' ' << ans[i].second << '\n';
		}
	}
}
bool solve_block(vector<int> nd, int rt) {
	if(G[rt].size() <= 4) {
		for(int s = 0; s < 1 << max(0, (int)G[rt].size() - 1); s ++) {
			vector<int> s1, s2;
			for(int i = 0; i < G[rt].size(); i ++) {
				if(s >> i & 1) {
					s1.emplace_back(G[rt][i]);
				}
				else {
					s2.emplace_back(G[rt][i]);
				}
			}
			init(nd);
			if(is(s1) && is(s2) && check(rt, s1, s2, nd)) {
				return true;
			} 
		}
	}
	else {
		int p = G[rt][0], q = 0;
		for(auto i : nd) vis[i] = 0;
		for(auto u : G[rt]) vis[u] ++;
		for(auto u : G[p]) if(vis[u]) q = u;
		for(auto i : nd) vis[i] = 0;
		for(auto u : G[p]) vis[u] ++;
		for(auto u : G[q]) vis[u] ++;
		vector<int> s1, s2;
		s1.emplace_back(p), s1.emplace_back(q);
		for(auto u : G[rt]) if(u != p && u != q) {
			if(vis[u] == 2) s1.emplace_back(u);
			else s2.emplace_back(u);
		}
		for(auto i : nd) vis[i] = 0;
		init(nd);
		if(is(s1) && is(s2) && check(rt, s1, s2, nd)) {
			return true;
		}
		else if(!s2.empty()) {		
			for(auto u : nd) vis[u] = 0;
			for(auto u : G[rt]) vis[u] ++;
			for(auto u : s2) vis[u] ++;
			for(auto u : G[p]) if(vis[u] == 2) q = u;
			for(auto u : nd) vis[u] = 0;
			for(auto u : G[p]) vis[u] ++;
			for(auto u : G[q]) vis[u] ++;
			s1.clear(), s2.clear();
			s1.emplace_back(p), s1.emplace_back(q);
			for(auto u : G[rt]) if(u != p && u != q) {
				if(vis[u] == 2) s1.emplace_back(u);
				else s2.emplace_back(u);
			}
			init(nd);
			if(is(s1) && is(s2) && check(rt, s1, s2, nd)) {
				return true;
			}
		}
		s1.clear(), s2.clear();
		s1.emplace_back(p);
		for(int i = 1; i < G[rt].size(); i ++) s2.emplace_back(G[rt][i]);
		init(nd);
		if(is(s1) && is(s2) && check(rt, s1, s2, nd)) {
			return true;
		}
	}
	return false;
}
void solve() {
	cin >> n >> m;
	vector<int> fa(n + 1);
	iota(fa.begin(), fa.end(), 0);
	function<int(int)> find = [&] (int u) {
		return fa[u] == u ? u : fa[u] = find(fa[u]);
	};
	for(int i = 1; i <= m; i ++) {
		int u, v;
		cin >> u >> v;
		fa[find(u)] = find(v);
		G[u].emplace_back(v), G[v].emplace_back(u);
	}
	vector<vector<int>> nd(n + 1);
	for(int i = 1; i <= n; i ++) nd[find(i)].emplace_back(i);
	int flag = 0;
	for(int i = 1; i <= n && !flag; i ++) if(!nd[i].empty()) {
		if(!solve_block(nd[i], i)) flag = 1;
		cur = cnt;
	}
	print(flag);
}
void clear() {
	for(int i = 1; i <= n; i ++) G[i].clear();
	flag = 0, cur = 0, cnt = 0;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int T; 
	for(cin >> T; T; T --) {
		solve();
		clear();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 8ms
memory: 27012kb

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
3 4
1 3
4 5
2 4
1 2
Yes
2 1
1 2
Yes
3 2
2 3
1 2
Yes
4 3
2 3
2 4
1 2
No
Yes
5 5
4 5
3 4
1 3
2 3
1 2

result:

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

Test #2:

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

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
5 7
4 6
2 3
1 2
4 5
5 8
Yes
4 2
1 2
3 4
Yes
2 1
1 2
Yes
8 5
1 2
4 6
4 5
3 4
7 8
Yes
8 6
4 8
6 7
1 2
5 6
3 5
3 4

result:

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

Test #3:

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

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
8 5
6 8
6 7
1 2
3 4
5 6
Yes
5 4
2 3
3 4
1 2
4 5
Yes
5 5
1 3
3 4
3 5
2 4
1 2
Yes
6 3
1 2
3 4
5 6
Yes
7 6
6 7
3 4
2 3
1 2
5 6
4 5
Yes
4 4
2 4
3 4
1 3
1 2
Yes
7 6
2 3
1 2
3 4
6 7
4 5
2 4
Yes
2 1
1 2
Yes
6 5
4 5
2 4
1 3
2 6
1 2
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: 3ms
memory: 26992kb

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
7 8
5 6
3 4
1 3
4 5
6 7
1 2
5 8
2 7
Yes
4 2
1 2
3 4
Yes
7 5
6 7
1 2
5 6
4 5
3 4
Yes
3 2
2 3
1 2

result:

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

Test #5:

score: 0
Accepted
time: 127ms
memory: 27000kb

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

result:

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

Test #6:

score: 0
Accepted
time: 172ms
memory: 27092kb

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

result:

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

Test #7:

score: 0
Accepted
time: 185ms
memory: 27136kb

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
2 3
1 2
3 4
4 5
4 8
5 7
5 6
4 6
6 7
3 5
Yes
6 4
2 3
5 6
1 2
4 5
No
Yes
9 14
3 8
4 5
5 8
6 9
4 6
2 3
4 9
5 7
6 7
5 6
3 7
3 4
7 8
1 2
Yes
10 14
6 7
7 8
5 6
2 7
4 5
2 9
1 3
2 5
2 4
3 5
9 10
1 2
3 4
4 8
Yes
10 17
6 7
4 7
1 3
4 6
1 4
2 8
9 10
2 3
4 5
1 2
8 9
1 7
3 8
1 6
1 9
3 4
2...

result:

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

Test #8:

score: 0
Accepted
time: 235ms
memory: 27028kb

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
7 8
4 5
1 2
3 4
6 7
Yes
10 23
5 6
3 10
5 8
1 3
7 8
4 5
8 10
8 9
7 10
3 5
1 9
5 10
5 9
6 7
4 7
1 8
2 6
3 4
1 2
4 8
4 9
1 4
4 6
No
Yes
9 11
8 9
3 6
2 3
5 8
2 5
6 7
1 2
5 6
4 5
3 4
6 8
Yes
9 12
2 7
6 9
2 5
4 5
7 9
3 4
1 3
7 8
1 2
6 7
3 9
4 6
Yes
14 7
1 2
3 4
5 6
7 8
9 10
11 12
13 14
Yes
10 14
4...

result:

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

Test #9:

score: 0
Accepted
time: 323ms
memory: 27220kb

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
4 5
3 7
7 9
1 3
5 7
2 3
8 10
7 8
2 4
4 10
3 8
4 7
5 10
3 4
3 9
5 9
6 8
6 7
5 6
1 9
8 9
4 8
4 6
3 6
1 2
1 6
6 9
1 7
9 10
2 10
2 7
5 8
2 6
1 5
2 9
2 8
4 9
3 5
1 8
Yes
6 3
1 2
3 4
5 6
No
Yes
10 22
1 3
6 7
3 10
5 9
4 5
9 10
4 6
5 7
5 10
8 9
3 8
5 6
2 7
3 4
7 8
4 10
3 5
3 6
2 4
2 9
1 9
1 2
Yes
...

result:

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

Test #10:

score: 0
Accepted
time: 366ms
memory: 27136kb

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
8 9
3 4
4 6
2 3
4 5
1 2
7 8
Yes
10 20
7 9
1 4
4 9
6 7
4 6
3 4
2 4
3 6
1 10
1 3
3 5
1 8
3 8
1 2
2 5
7 8
6 10
3 7
9 10
4 5
Yes
31 46
19 22
23 24
17 19
18 19
16 22
17 20
1 2
17 22
16 17
22 25
3 4
17 23
16 18
5 6
16 23
7 8
15 17
21 23
16 21
19 21
9 10
17 18
11 12
13 14
15 20
18 20
16 25
15 18
20...

result:

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

Test #11:

score: 0
Accepted
time: 461ms
memory: 27052kb

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

result:

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

Test #12:

score: 0
Accepted
time: 518ms
memory: 27076kb

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
9 12
9 18
12 14
4 11
12 15
9 11
10 12
16 18
7 10
3 12
3 5
3 4
3 8
13 14
3 9
4 6
5 8
3 10
11 15
3 15
1 6
6 8
13 15
14 15
2 6
11 13
6 7
11 21
5 9
13 20
7 12
5 15
4 8
9 15
10 18
5 6
4 12
1 3
2 7
4 5
1 13
15 16
8 15
1 7
11 14
2 12
4 7
7 14
6 12
4 15
9 10
8 11
8 10
1 15
4 14
3 20
6 22
6 10
8 1...

result:

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

Test #13:

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

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

result:

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

Test #14:

score: 0
Accepted
time: 527ms
memory: 27152kb

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
5 10
13 17
5 6
10 14
7 17
4 10
1 2
10 17
7 10
6 10
4 13
3 18
7 14
11 12
3 10
12 17
3 5
5 11
9 13
4 11
8 10
5 8
13 18
10 13
14 18
5 17
20 21
12 13
15 17
8 13
6 9
3 4
3 8
23 24
6 8
6 18
25 26
9 10
27 28
29 30
5 15
10 12
31 32
8 22
5 13
15 16
12 18
13 14
3 15
6 13
33 34
35 36
37 38
3 9
11 14...

result:

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

Test #15:

score: 0
Accepted
time: 513ms
memory: 27092kb

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
5 6
2 4
6 7
4 5
1 3
5 8
1 2
Yes
10 43
3 7
6 9
3 5
1 7
2 5
1 8
5 7
1 10
3 8
2 7
1 4
2 10
2 6
3 10
8 10
5 6
4 6
4 9
1 3
4 7
1 5
7 10
6 10
9 10
5 9
5 10
4 8
2 9
3 6
2 4
1 2
6 7
4 5
1 9
6 8
3 4
3 9
7 9
5 8
7 8
2 3
2 8
8 9
Yes
22 126
2 16
6 17
10 12
4 9
11 15
3 13
2 17
13 14
6 9
11 17
6 7
14 17
5...

result:

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

Test #16:

score: 0
Accepted
time: 507ms
memory: 27332kb

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
38 41
36 39
35 39
42 43
40 42
47 54
36 46
47 52
42 49
35 40
40 53
43 50
39 57
39 41
1 2
46 53
36 40
37 48
35 47
44 53
40 48
39 44
40 49
37 43
54 56
3 4
38 46
43 46
39 45
36 53
37 53
49 50
46 48
5 6
45 53
43 53
40 47
35 45
35 41
42 46
37 40
40 46
42 53
43 45
38 45
7 8
47 53
9 10
44 47
39 4...

result:

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

Test #17:

score: 0
Accepted
time: 517ms
memory: 27260kb

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

result:

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

Test #18:

score: 0
Accepted
time: 539ms
memory: 27264kb

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

result:

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

Test #19:

score: 0
Accepted
time: 514ms
memory: 27124kb

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
6 7
3 6
2 7
3 7
5 6
3 4
1 3
2 3
2 8
8 9
4 7
1 2
4 5
3 5
Yes
56 159
35 44
1 2
36 47
28 37
37 46
41 42
32 42
30 38
31 33
47 48
31 42
37 44
29 46
38 43
32 45
40 46
34 38
38 44
32 48
37 45
30 45
35 47
33 34
31 32
36 40
31 46
30 40
35 40
36 43
37 43
30 43
37 38
34 42
44 45
47 49
45 46
35 36
3...

result:

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

Test #20:

score: 0
Accepted
time: 520ms
memory: 27188kb

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

result:

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

Test #21:

score: 0
Accepted
time: 507ms
memory: 27252kb

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

result:

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

Test #22:

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

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

result:

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

Test #23:

score: 0
Accepted
time: 502ms
memory: 27256kb

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
12 19
5 15
4 8
1 20
2 10
2 12
2 15
10 20
1 19
6 12
4 6
1 6
7 9
8 10
8 12
3 7
11 12
12 14
8 11
11 13
7 13
11 19
4 5
10 12
3 4
3 12
16 18
14 19
8 14
2 3
6 20
12 13
2 8
3 9
5 6
15 21
1 13
8 9
4 11
13 19
16 17
1 3
13 20
12 20
1 5
1 7
4 15
2 13
15 16
16 19
1 2
9 19
8 20
7 20
10 11
4 9
7 8
6 19...

result:

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

Test #24:

score: 0
Accepted
time: 517ms
memory: 27172kb

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
79 82
1 2
85 91
78 85
3 4
5 6
7 8
9 10
78 86
79 86
79 88
84 91
11 12
13 14
87 92
15 16
85 89
17 18
89 92
83 88
78 89
85 92
82 87
81 89
80 90
80 82
80 86
19 20
21 22
81 91
87 91
80 84
82 86
23 24
84 86
86 88
80 92
75 76
25 26
80 91
27 28
29 30
31 32
86 92
78 92
93 94
33 34
82 91
35 36
83 ...

result:

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

Test #25:

score: 0
Accepted
time: 551ms
memory: 27412kb

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
253 254
248 261
247 257
242 256
245 247
244 249
251 257
1 2
255 261
3 4
240 260
5 6
7 8
9 10
11 12
241 256
249 255
241 252
252 258
247 260
13 14
15 16
256 258
245 248
243 257
17 18
19 20
248 259
257 259
21 22
23 24
25 26
254 256
243 247
242 245
259 261
27 28
246 255
247 252
241 261
29...

result:

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

Test #26:

score: 0
Accepted
time: 530ms
memory: 27468kb

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
8 18
2 12
10 12
15 16
4 11
2 18
1 19
7 17
10 13
15 20
5 6
5 21
12 20
3 18
12 13
5 17
19 20
3 8
6 19
18 19
21 22
9 17
9 19
2 15
3 20
8 10
2 10
12 15
9 15
3 11
5 10
8 9
15 17
17 18
13 16
5 7
2 20
10 16
16 19
16 21
1 12
4 5
9 13
10 20
13 17
9 11
14 16
18 21
5 18
1 8
17 21
11 20
6 15
5 12
11 ...

result:

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

Test #27:

score: 0
Accepted
time: 570ms
memory: 27464kb

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
12 16
4 15
4 17
8 22
7 10
7 13
16 21
15 18
17 18
4 7
19 22
10 11
2 4
6 13
7 8
12 22
5 21
1 13
1 3
10 15
1 6
14 22
4 8
19 20
2 16
14 16
12 21
5 10
13 22
15 22
13 17
9 17
11 21
10 13
6 22
5 9
5 16
5 7
7 22
7 17
8 14
5 6
8 9
1 10
6 10
2 17
10 19
5 18
10 14
1 4
6 12
5 8
13 20
6 7
2 9
7 15
2 3...

result:

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

Test #28:

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

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

result:

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

Test #29:

score: 0
Accepted
time: 581ms
memory: 27556kb

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
111 119
3 4
95 109
5 6
7 8
9 10
117 118
107 115
11 12
13 14
15 16
109 123
17 18
107 108
19 20
115 123
97 98
21 22
23 24
25 26
27 28
29 30
111 113
31 32
107 121
33 34
35 36
37 38
106 112
39 40
98 99
107 120
41 42
111 123
43 44
99 113
102 114
45 46
47 48
97 100
49 50
51 52
53 54
97 ...

result:

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

Test #30:

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

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
9 17
8 26
1 5
17 26
9 13
19 20
15 25
22 25
10 25
4 23
5 9
4 22
14 23
3 7
9 23
4 16
7 14
3 23
10 17
5 13
14 29
4 31
14 15
7 8
9 20
5 16
5 7
12 14
1 26
30 31
13 20
6 22
1 23
9 10
24 26
4 24
3 20
8 13
8 20
20 25
3 16
13 24
5 17
8 16
10 12
16 17
4 26
13 23
11 15
13 22
15 23
7 26
7 22
3 9
14 2...

result:

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

Test #31:

score: 0
Accepted
time: 547ms
memory: 27720kb

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
374 379
366 381
368 370
3 4
5 6
7 8
9 10
376 382
367 376
11 12
377 387
374 380
13 14
15 16
365 372
17 18
384 386
370 374
370 375
19 20
378 380
21 22
23 24
25 26
365 380
378 379
379 387
27 28
370 380
383 386
377 385
366 377
370 381
29 30
31 32
33 34
372 383
367 383
35 36
37 38
367 377...

result:

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

Test #32:

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

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
204 207
201 210
1 2
3 4
196 197
184 209
186 203
5 6
185 199
7 8
200 212
202 210
9 10
11 12
194 200
13 14
184 199
15 16
193 197
17 18
196 208
193 196
196 205
195 211
193 198
19 20
198 200
194 202
202 203
199 211
194 212
197 206
184 197
21 22
23 24
209 212
25 26
190 196
200 203
27 28
29 30...

result:

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

Test #33:

score: 0
Accepted
time: 591ms
memory: 27556kb

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
199 203
198 202
210 212
1 2
183 212
210 211
195 205
191 210
204 213
201 202
3 4
185 198
186 187
202 209
5 6
190 204
193 198
184 203
205 215
7 8
184 202
208 210
210 215
188 211
9 10
11 12
183 188
184 200
13 14
197 213
15 16
193 215
183 215
191 194
17 18
197 210
188 189
195 198
185 187
205...

result:

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

Test #34:

score: 0
Accepted
time: 562ms
memory: 33304kb

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
3225 3284
3224 3236
3214 3240
1 2
3217 3241
3 4
3247 3277
5 6
3220 3229
7 8
9 10
3222 3248
3222 3278
11 12
13 14
3224 3234
15 16
17 18
3220 3276
19 20
21 22
3220 3273
23 24
25 26
27 28
3224 3261
3239 3274
29 30
31 32
33 34
3275 3276
3217 3257
35 36
37 38
3235 3276
39 40
41 42
43 44
45 ...

result:

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

Test #35:

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

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: 612ms
memory: 33896kb

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
16 27
21 48
3 47
35 42
3 45
6 42
4 46
20 33
1 46
44 45
19 27
15 41
11 34
24 27
21 46
3 40
17 20
14 20
10 13
19 44
1 34
22 35
3 23
38 48
1 31
23 29
15 19
27 43
1 45
1 25
16 34
17 29
11 20
7 48
43 49
14 30
23 27
20 36
17 45
18 36
36 41
6 24
11 27
20 43
8 13
6 35
13 44
32 48
24 28
1 28
1 16
...

result:

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

Test #37:

score: 0
Accepted
time: 685ms
memory: 35596kb

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: 657ms
memory: 36508kb

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
10016 10097
10059 10069
5 6
7 8
10059 10072
9 10
11 12
10021 10024
13 14
15 16
10019 10053
17 18
19 20
21 22
10054 10086
23 24
25 26
10063 10076
27 28
29 30
31 32
10036 10070
33 34
35 36
10063 10084
37 38
39 40
41 42
10002 10011
10014 10027
43 44
45 46
10005 10059
10023 10062
...

result:

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

Test #39:

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

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
4051 4078
4050 4052
1 2
4038 4062
4047 4082
4038 4092
4046 4090
3 4
5 6
4067 4111
4039 4099
7 8
9 10
4054 4140
4076 4089
4075 4088
4044 4116
11 12
13 14
15 16
17 18
19 20
4074 4081
4082 4084
4058 4081
21 22
4083 4117
4104 4105
23 24
25 26
4044 4104
4062 4073
27 28
4046 4050
29 30
31 32...

result:

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

Test #40:

score: 0
Accepted
time: 734ms
memory: 42564kb

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: 747ms
memory: 41856kb

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
7290 7295
11 12
13 14
7294 7325
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
7314 7318
49 50
51 52
53 54
55 56
57 58
59 60
61 62
63 64
65 66
67 68
7317 7319
69 70
71 72
73 74
75 76
77 78
79 80
81 82
83 84
8...

result:

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

Test #42:

score: 0
Accepted
time: 718ms
memory: 43852kb

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
32489 32532
32516 32549
25 26
27 28
29 30
32468 32470
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
32465 32527
32529 32549
61 62
63 64
65 66
67 68
69 70
71 72
73 74
75 76
77 78...

result:

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

Test #43:

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

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
111 114
111 125
110 114
122 123
121 126
115 121
112 128
112 123
118 128
1 2
3 4
5 6
113 125
112 124
7 8
113 116
115 116
111 126
9 10
11 12
123 128
113 121
121 128
121 125
13 14
15 16
110 118
109 130
109 126
114 120
117 130
112 121
17 18
124 127
122 125
109 128
19 20
113 123
116 128
120 1...

result:

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

Test #44:

score: 0
Accepted
time: 774ms
memory: 46200kb

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
9754 9758
1 2
9731 9741
3 4
5 6
7 8
9 10
11 12
9742 9754
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
9717 9746
9715 9760
33 34
35 36
37 38
39 40
41 42
43 44
45 46
47 48
49 50
9718 9747
51 52
53 54
55 56
57 58
59 60
9750 9753
61 62
63 64
9745 9760
65 66
67 68
69 70
9740...

result:

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

Test #45:

score: 0
Accepted
time: 761ms
memory: 44784kb

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
20937 20969
53 54
55 56
57 58
20933 20941
59 60
61 62
63 64
20923 20945
65 66
67 68
69 70
71 72
73 74
20944 20980
20963 20976
75 76...

result:

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

Test #46:

score: 0
Accepted
time: 609ms
memory: 27224kb

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

result:

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

Test #47:

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

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

result:

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

Test #48:

score: 0
Accepted
time: 589ms
memory: 27252kb

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
109 110
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
105 111
27 28
29 30
31 32
33 34
35 36
37 38
108 111
39 40
105 106
41 42
43 44
45 46
105 112
47 48
108 110
106 112
110 111
49 50
51 52
109 111
53 54
107 110
109 112
55 56
105 107
57 58
59 60
61 62
104 107
63 64
65...

result:

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

Test #49:

score: 0
Accepted
time: 586ms
memory: 27320kb

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
6 14
15 19
10 20
1 10
14 19
2 10
3 13
4 20
11 22
13 14
11 15
9 11
5 16
10 14
5 13
6 7
13 15
2 5
1 21
7 13
1 4
8 15
14 16
3 4
4 15
13 18
3 7
14 22
1 6
7 21
3 14
16 19
1 3
1 2
10 18
12 19
1 19
20 21
2 15
9 15
10 22
1 18
4 5
10 11
15 16
6 22
11 17
9 22
4 13
8 10
8 13
14 18
8 14
9 20
4 17
1 7...

result:

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

Test #50:

score: 0
Accepted
time: 441ms
memory: 42284kb

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
14083 14096
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
14115 14116
23 24
25 26
27 28
29 30
31 32
14067 14103
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
14079 14080
73 74
75 76
77 78
79 80
81 82...

result:

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

Test #51:

score: 0
Accepted
time: 772ms
memory: 47692kb

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
900 904
21 22
23 24
25 26
27 28
29 30
31 32
33 34
901 903
35 36
37 38
39 40
41 42
43 44
45 46
47 48
49 50
51 52
53 54
898 899
55 56
57 58
59 60
898 902
61 62
63 64
65 66
67 68
69 70
71 72
73 74
75 76
77 78
79 80
81 82
83 84
906 907
85 ...

result:

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

Test #52:

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

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
10523 10555
3 4
5 6
7 8
10461 10474
9 10
10507 10541
11 12
10476 10494
13 14
10480 10551
15 16
10478 10485
17 18
10466 10483
19 20
21 22
10475 10488
23 24
25 26
10490 10558
27 28
29 30
31 32
33 34
10481 10507
35 36
37 38
10520 10545
39 40
10520 10542
41 42
43 44
45 46
47 48
49 50...

result:

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

Test #53:

score: 0
Accepted
time: 986ms
memory: 59748kb

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
30425 30435
3 4
30422 30455
5 6
30390 30400
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
30415 30479
23 24
25 26
30457 30479
30418 30464
30391 30436
27 28
30434 30436
29 30
30393 30439
31 32
33 34
35 36
37 38
30443 30476
39 40
41 42
43 44
45 46
30467 30481
30489 30491
47 48
49 50...

result:

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

Test #54:

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

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: 798ms
memory: 54568kb

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
7314 7318
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
7312 7318
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 9...

result:

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

Test #56:

score: 0
Accepted
time: 835ms
memory: 63856kb

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: 937ms
memory: 63780kb

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
4 24
22 28
4 23
24 33
25 28
4 18
21 30
3 18
11 28
23 25
11 23
1 9
9 23
11 29
16 33
12 21
20 31
31 33
6 31
8 18
8 30
13 32
4 28
14 31
3 17
18 30
15 25
18 31
17 21
20 26
4 19
2 20
4 22
6 18
7 16
18 28
4 8
13 16
4 12
10 33
7 29
5 28
4 5
29 32
8 32
9 21
5 7
9 27
7 27
2 4
15 29
10 18
1 17
22 3...

result:

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

Test #58:

score: 0
Accepted
time: 924ms
memory: 66892kb

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
77882 77924
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...

result:

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

Test #59:

score: 0
Accepted
time: 1036ms
memory: 62684kb

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: 1174ms
memory: 67228kb

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 3
3 4
1 2
3 5
6 8
6 7
2 3
2 9
5 8
5 6
3 6
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
141014 141031
33 34
35 36
141081 141086
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
1...

result:

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

Test #61:

score: 0
Accepted
time: 1152ms
memory: 79100kb

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
9 10
3 6
5 6
1 7
4 5
7 8
1 3
8 9
1 6
2 3
2 7
3 4
1 2
3 5
Yes
33 475
29 31
12 23
27 30
18 22
12 21
10 14
1 33
1 7
10 27
2 3
18 32
11 31
12 13
22 30
5 30
4 27
9 25
5 22
17 18
4 22
16 22
12 33
6 26
17 22
9 12
25 31
24 31
18 20
21 24
12 19
11 22
23 26
13 28
6 8
6 7
5 23
10 32
13 31
10 29
13 20...

result:

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

Test #62:

score: 0
Accepted
time: 1021ms
memory: 64908kb

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
8194 8198
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
8182 8198
31 32
33 34
35 36
37 38
39 40
41 42
43 44
8191 8196
45 46
47 48
49 50
51 52
53 54
55 56
57 58
8183 8187
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...

result:

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

Test #63:

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

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
1355 1356
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 ...

result:

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

Test #64:

score: 0
Accepted
time: 924ms
memory: 63612kb

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
53000 53074
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 ...

result:

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

Test #65:

score: 0
Accepted
time: 910ms
memory: 62420kb

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
4 5
3 4
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
66 67
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
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: 887ms
memory: 67448kb

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
47551 25532
1 2
3 4
31096 31104
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
31118 31142
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
31097 31132...

result:

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

Test #67:

score: 0
Accepted
time: 1266ms
memory: 71856kb

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

result:

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

Test #68:

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

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
16641 16739
7 8
16609 16725
16617 16747
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
16612 16702
39 40
16692 16767
41 42
43 44
16634 16653
45 46
16671 16747
47 48
16736 16767
49 50
16610 16652
16654 16670
51 52
16719 16753
53 54...

result:

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

Test #69:

score: 0
Accepted
time: 1003ms
memory: 64696kb

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
2249 2250
2244 2265
13 14
15 16
17 18
19 20
21 22
2248 2267
23 24
25 26
27 28
29 30
2241 2262
31 32
2264 2272
33 34
35 36
2243 2249
37 38
39 40
41 42
2254 2268
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
2244 2268
69 70
2248 ...

result:

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

Test #70:

score: 0
Accepted
time: 951ms
memory: 74664kb

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
23 24
7 8
9 10
11 12
13 14
22 23
15 16
17 18
19 20
21 22
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
15097 15098
45 46
47 48
49 50
51 52
53 54
55 56
57 58
59 60...

result:

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

Test #71:

score: 0
Accepted
time: 283ms
memory: 55464kb

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
9 20
7 15
12 18
1 6
9 26
13 21
7 12
7 13
6 8
14 17
16 25
12 13
4 14
9 13
10 12
18 25
1 14
15 17
5 16
5 21
23 24
3 4
8 15
8 16
7 18
1 16
5 8
1 10
7 26
11 25
10 14
11 19
11 15
12 19
7 19
6 17
5 14
5 19
8 20
3 16
8 26
4 12
5 9
18 26
3 8
1 20
4 20
6 21
7 21
1 19
11 12
11 14
4 5
7 25
8 14
5 13...

result:

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

Test #72:

score: 0
Accepted
time: 1092ms
memory: 80960kb

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 9
3 8
7 8
5 7
7 10
4 6
5 6
6 9
1 7
3 6
6 8
1 8
4 5
8 11
3 10
3 5
5 10
4 10
2 8
6 10
7 9
2 4
8 13
2 5
6 7
2 6
8 9
1 4
1 3
10 11
2 7
2 9
4 9
3 9
1 2
8 10
3 4
1 5
4 8
1 6
2 10
5 8
9 10
3 7
1 10
11 12
5 9
4 7
2 3
Yes
6 5
2 3
3 4
4 6
4 5
1 2
Yes
9 6
1 2
4 6
8 9
3 5
3 4
7 8
Yes
73 1734
18 23
2...

result:

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

Test #73:

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

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

result:

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

Test #74:

score: 0
Accepted
time: 1011ms
memory: 74036kb

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
8840 8841
25 26
27 28
29 30
31 32
8815 8848
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
8806 8831
65 66
8805 8806
67 68
69 70
71 72
73 74
75 76
77 78
79 80
81 82
83 84
85...

result:

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

Test #75:

score: 0
Accepted
time: 865ms
memory: 54812kb

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
13 27
7 17
16 32
9 23
9 21
14 25
7 11
6 23
4 6
26 30
7 12
10 28
21 30
13 18
19 20
23 30
5 16
4 9
8 21
18 21
11 15
28 30
10 18
3 22
5 6
26 28
20 21
8 17
18 23
12 18
20 22
14 23
22 31
11 23
12 14
7 25
15 30
13 21
13 17
11 16
5 22
12 31
16 21
23 31
6 24
12 13
9 31
11 24
12 24
18 31
14 31
10 ...

result:

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

Test #76:

score: 0
Accepted
time: 974ms
memory: 68152kb

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
6 8
5 7
1 2
3 4
5 6
17 18
8 9
14 15
19 20
12 13
10 13
10 11
13 14
21 22
23 24
9 10
25 26
15 16
27 28
11 12
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
6...

result:

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

Test #77:

score: 0
Accepted
time: 1524ms
memory: 68692kb

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
7073 7074
22513 22520
45352 45357
56131 56139
58442 58445
21174 21176
49885 49887
40141 40144
24091 24093
11 13
41981 41987
49675 49679
61785 61790
65669 65670
30463 30469
43605 43608
15944 15950
22786 22790
17682 17684
50301 50308
4514 4516
57366 57369
54691 54696
1951 1953
36622 3...

result:

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

Test #78:

score: 0
Accepted
time: 1270ms
memory: 68580kb

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
63095 63096
27866 27871
50666 50671
65813 65814
81666 81671
54761 54768
16181 16184
8645 8647
42962 42967
3101 3102
86441 86444
4313 4318
85058 85062
74780 74784
17493 17496
43637 43640
10324 10328
76324 76327
58505 58509
52769 52774
49747 49748
64634 64637
19754 19757
30027 30031
1...

result:

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

Test #79:

score: 0
Accepted
time: 1121ms
memory: 69188kb

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
53055 53058
38461 38463
66650 66653
33734 33740
11650 11654
46176 46177
17762 17764
16496 16497
32996 32997
40528 40530
61326 61327
40049 40054
50408 50413
73921 73924
88269 88270
61311 61312
10532 10533
1058 1060
31083 31084
62457 62458
60274 60277
43531 43532
9206 9212
89343 8934...

result:

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

Test #80:

score: 0
Accepted
time: 832ms
memory: 57876kb

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
1693 1697
50789 50790
23626 23628
47440 47441
51313 51318
3169 3173
12609 12612
110607 110609
21175 21178
77390 77393
7822 7824
39932 39935
87141 87143
58513 58515
76748 76751
46543 46545
82147 82152
97225 97228
82267 82271
68678 68682
20521 20524
16502 16504
75812 75815
86793 8679...

result:

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

Test #81:

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

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
77916 77919
35048 35049
140281 140283
23992 23994
83946 83948
75116 75118
118337 118339
15182 15184
19666 19668
46958 46960
105662 105663
136136 136140
123367 123368
105706 105709
137706 137709
134671 134675
95961 95965
8336 8338
34481 34485
56816 56819
103623 103624
86081 86085
10...

result:

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

Test #82:

score: 0
Accepted
time: 467ms
memory: 50668kb

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
141530 141532
42749 42752
95023 95024
53142 53143
42150 42152
110118 110120
72482 72483
34366 34368
25746 25748
56958 56960
165941 165944
10869 10871
96706 96708
85434 85435
3370 3372
44369 44372
62573 62576
173338 173339
68954 68955
145 147
161290 161291
168442 168443
119722 11972...

result:

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

Test #83:

score: 0
Accepted
time: 573ms
memory: 66424kb

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
2680 2601
29 1491
29 2347
29 1268
29 677
29 1095
29 71
29 2442
29 1188
29 1205
29 1908
29 689
29 1524
29 2111
29 891
29 477
29 1715
29 261
29 676
29 353
29 2181
29 1413
29 1571
29 930
29 995
29 2206
29 314
29 890
29 2223
29 1027
29 1656
29 368
29 2027
29 1442
29 1044
29 1009
29 2254
29 747
29 24...

result:

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

Test #84:

score: 0
Accepted
time: 800ms
memory: 59004kb

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
242715 242720
73990 73995
238445 238452
158810 158813
28191 28195
136910 136912
10311 10313
92110 92116
261745 261747
159390 159399
193370 193372
20611 20616
276125 276133
239655 239659
286975 286979
94380 94389
31561 31568
279035 279038
43040 43044
169370 169379
144070 144072
1127...

result:

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

Test #85:

score: 0
Accepted
time: 699ms
memory: 58228kb

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
45705 45711
151803 151807
186075 186079
2473 2478
244555 244557
328435 328440
239155 239157
186603 186609
240299 240305
61441 61446
267067 267070
39809 39816
35609 35611
103465 103469
43025 43031
195355 195357
257659 257664
200107 200113
88417 88419
106809 106816
21929 21932
193579...

result:

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

Test #86:

score: 0
Accepted
time: 435ms
memory: 51004kb

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
3338 3342
98138 98139
303434 303437
146768 146769
45482 45485
55622 55623
257300 257301
208778 208780
168704 168708
57410 57412
160898 160900
29900 29904
215012 215013
92468 92471
287972 287974
10262 10265
4616 4620
140012 140015
152276 152277
62294 62296
286178 286180
199532 19953...

result:

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

Test #87:

score: 0
Accepted
time: 270ms
memory: 50840kb

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
400000 300000
211718 211720
6954 6955
14666 14668
15414 15416
78642 78644
315158 315159
882 883
6606 6607
112910 112911
231002 231003
164902 164903
233174 233175
375674 375676
111534 111536
288858 288859
247270 247271
23514 23515
42354 42355
278226 278227
104974 104975
72250 72252
1670 1671
1247...

result:

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