QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#107761#5307. Subgraph IsomorphismshihoghmeanWA 249ms36464kbC++173.3kb2023-05-22 19:01:412023-05-22 19:01:44

Judging History

你现在查看的是测评时间为 2023-05-22 19:01:44 的历史记录

  • [2023-10-15 17:25:47]
  • 管理员手动重测本题所有提交记录
  • 测评结果:WA
  • 用时:198ms
  • 内存:54500kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-22 19:01:44]
  • 评测
  • 测评结果:100
  • 用时:249ms
  • 内存:36464kb
  • [2023-05-22 19:01:41]
  • 提交

answer

// Problem: G. Subgraph Isomorphism
// Contest: Codeforces - The 2022 ICPC Asia Hangzhou Regional Programming Contest
// URL: https://codeforces.com/gym/104090/problem/G
// Memory Limit: 1024 MB
// Time Limit: 3000 ms

#include<bits/stdc++.h>
using namespace std;
#define int unsigned long long
#define ll long long
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fr(i,a,b) for(int i=a;i>=b;i--)
#define py puts("YES")
#define pn puts("NO")
#define pt puts("")
#define pb push_back
#define wt(x) write(x),puts("")
#define wr(x) write(x) ,putchar(' ')
#define tx printf("fds")
#define mp make_pair
#define fi first
#define se second
inline int read(){
	int x=0,k=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') k=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+ch-48;
		ch=getchar();
	}
	return x*k;
}
void write(int x){
	if(x<0){
		x=-x;
		putchar('-');
	}
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
int power(int x,int y,int mod){
	int num=1;
	while(y){
		if(y&1) num=(num*x)%mod;
		x=x*x%mod;
		y>>=1;
	}
	return num;
}
int mul(int x,int y,int mod){
	int num=0;
	while(y){
		if(y&1) num=(num+x)%mod;
		x=(x+x)%mod;
		y>>=1;
	}
	return num;
}
const int N=1e6+7,mod=998244353;
int n,m,tot,tot1;
int head[N];
struct edge{
	int to,next;
}e[N];
void add(int u,int v){
	e[++tot]={v,head[u]};
	head[u]=tot;
}
int vis[N],is_round[N],END,siz[N],st[N],top,f[N];
int Hash[N],bases[N],base=233,Hash1[N];
int p[10000001],prime[N];
void pre(){
    bases[0]=1;
    for(int i=1;i<=1000000;i++){
        bases[i]=bases[i-1]*base;
        int x=rand(),y=rand(),z=rand();
        x<<=30;
        y<<=15;
        prime[i]=x+y+z;
        
    }
}
void dfs(int u,int fa){
	if(vis[u]){
		while(st[top]!=u){
			is_round[st[top]]=1;
			top--;
		}
		is_round[u]=1;
		END=1;
		return ;
	}
	vis[u]=1;
	st[++top]=u;
	for(int i=head[u];i;i=e[i].next){
		int v=e[i].to;
		if(v==fa) continue;
		dfs(v,u);
		if(END) return ;
		while(st[top]!=u){
			top--;
		}
	}
}
void dfs1(int u,int fa){
	f[u]=1;
	siz[u]=1;
	for(int i=head[u];i;i=e[i].next){
		int v=e[i].to;
		if(is_round[v]||v==fa) continue;
		dfs1(v,u);
		siz[u]+=siz[v];
		f[u]+=f[v]*prime[siz[v]];
	}
}
void dfs2(int u,int fa){
	st[++top]=u;
	vis[u]=1;
	for(int i=head[u];i;i=e[i].next){
		int v=e[i].to;
		if(v==fa||vis[v]||!is_round[v]) continue;
		dfs2(v,u);
	}
}
bool solve(){
	fo(i,1,n) vis[i]=0,is_round[i]=0,siz[i]=0,f[i]=0;
	END=0;
	top=0;
	dfs(1,0);
	top=0;
	fo(u,1,n){
		if(is_round[u]) dfs1(u,0);
		vis[u]=0;
	}
	fo(u,1,n){
		if(is_round[u]){
			dfs2(u,0);
			break;
		}
	}
    fo(i,1,top+1) Hash[i]=0,Hash1[i]=0;
	fo(i,1,top){
        Hash[i]=Hash[i-1]*base+f[st[i]];
    }
    fr(i,top,1){
    
        Hash1[i]=Hash1[i+1]*base+f[st[i]];
    }
    fo(i,2,top){
        int o=(Hash[top]-Hash[i-1]*bases[top-i+1])*bases[i-1]+Hash[i-1];
        if(Hash[top]!=o&&o!=Hash1[1]) return false; 
    }
    return true;
}
signed main(){
    srand(time(0));
	pre();
	int tt=read();
	while(tt--){
		n=read();m=read();
		fo(i,0,tot) head[i]=0;
		tot=0;
		fo(i,1,m){
			int x=read(),y=read();
			add(x,y);add(y,x);
		}
		if(m==n-1){
			py;
			continue;
		}
		if(m>n){
			pn;
			continue;
		}
		if(solve()) py;
		else pn;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 22ms
memory: 21020kb

input:

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

output:

YES
YES
NO
YES

result:

ok 4 token(s): yes count is 3, no count is 1

Test #2:

score: 0
Accepted
time: 34ms
memory: 19372kb

input:

33192
2 1
1 2
3 2
1 3
2 3
3 3
1 2
1 3
2 3
4 3
1 4
2 4
3 4
4 3
1 3
1 4
2 4
4 4
1 3
1 4
2 4
3 4
4 4
1 3
1 4
2 3
2 4
4 5
1 3
1 4
2 3
2 4
3 4
4 6
1 2
1 3
1 4
2 3
2 4
3 4
5 4
1 5
2 5
3 5
4 5
5 4
1 4
1 5
2 5
3 5
5 5
1 4
1 5
2 5
3 5
4 5
5 5
1 4
1 5
2 4
3 5
4 5
5 5
1 4
1 5
2 4
2 5
3 5
5 6
1 4
1 5
2 4
2 5
3 ...

output:

YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO...

result:

ok 33192 token(s): yes count is 58, no count is 33134

Test #3:

score: 0
Accepted
time: 31ms
memory: 20420kb

input:

40000
9 24
1 4
1 6
1 7
1 9
2 5
2 7
2 8
2 9
3 5
3 7
3 8
3 9
4 6
4 8
4 9
5 6
5 8
5 9
6 7
6 8
6 9
7 8
7 9
8 9
9 21
1 4
1 6
1 7
1 8
2 5
2 7
2 8
2 9
3 5
3 7
3 9
4 6
4 8
4 9
5 6
5 9
6 7
6 8
6 9
7 8
8 9
9 21
1 4
1 6
1 7
1 8
2 5
2 7
2 8
2 9
3 5
3 7
3 9
4 6
4 8
4 9
5 6
5 9
6 7
6 8
6 9
7 8
7 9
9 22
1 4
1 6
1 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 40000 token(s): yes count is 0, no count is 40000

Test #4:

score: 0
Accepted
time: 48ms
memory: 19576kb

input:

40000
9 16
1 4
1 6
1 8
1 9
2 5
2 7
2 8
2 9
3 6
3 7
4 7
5 8
6 9
7 8
7 9
8 9
9 16
1 4
1 6
1 8
1 9
2 5
2 7
2 8
2 9
3 6
3 7
4 7
5 8
5 9
7 8
7 9
8 9
9 16
1 4
1 6
1 8
1 9
2 5
2 7
2 8
2 9
3 6
3 7
4 7
5 8
5 9
6 9
7 8
8 9
9 16
1 4
1 6
1 8
1 9
2 5
2 7
2 8
2 9
3 6
3 7
4 7
5 8
5 9
6 9
7 8
7 9
9 17
1 4
1 6
1 8
1...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 40000 token(s): yes count is 0, no count is 40000

Test #5:

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

input:

40000
9 17
1 5
1 6
1 7
1 8
2 5
2 7
2 9
3 6
3 8
3 9
4 7
4 8
4 9
5 7
5 8
5 9
6 9
9 18
1 5
1 6
1 7
1 8
2 5
2 7
2 9
3 6
3 8
3 9
4 7
4 8
4 9
5 7
5 8
5 9
6 9
8 9
9 18
1 5
1 6
1 7
1 8
2 5
2 7
2 9
3 6
3 8
3 9
4 7
4 8
4 9
5 7
5 8
5 9
6 9
7 9
9 19
1 5
1 6
1 7
1 8
2 5
2 7
2 9
3 6
3 8
3 9
4 7
4 8
4 9
5 7
5 8
5 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 40000 token(s): yes count is 0, no count is 40000

Test #6:

score: 0
Accepted
time: 33ms
memory: 21048kb

input:

40000
9 17
1 5
1 6
1 7
1 8
2 6
2 7
2 8
2 9
3 7
3 9
4 9
5 8
6 7
6 8
6 9
7 9
8 9
9 16
1 5
1 6
1 7
1 8
2 6
2 7
2 8
2 9
3 7
3 9
4 9
5 8
5 9
6 7
6 8
8 9
9 16
1 5
1 6
1 7
1 8
2 6
2 7
2 8
2 9
3 7
3 9
4 9
5 8
5 9
6 7
6 8
7 9
9 17
1 5
1 6
1 7
1 8
2 6
2 7
2 8
2 9
3 7
3 9
4 9
5 8
5 9
6 7
6 8
7 9
8 9
9 17
1 5
1...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 40000 token(s): yes count is 0, no count is 40000

Test #7:

score: 0
Accepted
time: 28ms
memory: 19860kb

input:

40000
9 15
1 5
1 8
1 9
2 6
2 7
2 9
3 6
3 7
4 7
4 8
4 9
5 8
6 9
7 9
8 9
9 13
1 5
1 8
1 9
2 6
2 7
2 9
3 6
3 7
4 7
4 8
4 9
5 8
5 9
9 14
1 5
1 8
1 9
2 6
2 7
2 9
3 6
3 7
4 7
4 8
4 9
5 8
5 9
8 9
9 14
1 5
1 8
1 9
2 6
2 7
2 9
3 6
3 7
4 7
4 8
4 9
5 8
5 9
7 9
9 15
1 5
1 8
1 9
2 6
2 7
2 9
3 6
3 7
4 7
4 8
4 9
5...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 40000 token(s): yes count is 1, no count is 39999

Test #8:

score: 0
Accepted
time: 34ms
memory: 20864kb

input:

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

output:

YES
YES
NO
YES
YES
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
N...

result:

ok 40000 token(s): yes count is 50, no count is 39950

Test #9:

score: 0
Accepted
time: 29ms
memory: 20688kb

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 1393 token(s): yes count is 0, no count is 1393

Test #10:

score: 0
Accepted
time: 32ms
memory: 20368kb

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 3000 token(s): yes count is 0, no count is 3000

Test #11:

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

input:

30
28171 28170
2482 5158
15414 17513
7825 17196
10171 8545
8850 13596
3314 9296
5490 15625
18905 9569
24135 6453
360 718
65 27875
13734 20008
20072 4447
23395 24852
11440 1818
20672 13049
13770 6079
19115 24044
22134 24300
15787 3053
6462 6652
3200 14184
20621 629
1328 5200
7181 17707
4515 18911
249...

output:

YES
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES

result:

ok 30 token(s): yes count is 12, no count is 18

Test #12:

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

input:

30
3658 3658
1673 1805
115 1360
145 1722
3398 2869
700 3578
2145 60
3563 2682
2957 307
2443 1048
3581 2555
2368 2336
1023 3041
664 412
1950 552
3425 1162
3159 3296
1373 1763
1336 3591
1119 1992
1912 354
3573 3124
1351 1022
3047 2879
2521 1939
1683 1679
1070 1259
1342 1637
732 2576
2167 3067
2742 514...

output:

NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
YES
NO
NO
NO

result:

ok 30 token(s): yes count is 13, no count is 17

Test #13:

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

input:

30
6200 6199
2543 3295
1003 4780
4627 4563
5620 660
1731 3047
1198 3343
3419 4710
2488 3843
3722 4576
752 3212
5313 4025
4612 286
1967 1397
36 2212
1206 928
4689 1268
2831 4376
4334 3028
1040 1514
5636 5331
4257 571
5182 5007
1629 208
2345 3406
5280 4999
2607 2254
6192 1403
5075 3889
3389 5294
3682 ...

output:

YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
NO
YES

result:

ok 30 token(s): yes count is 16, no count is 14

Test #14:

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

input:

30
14491 14490
6052 10994
13301 461
1336 9631
10722 4121
9829 5812
11883 5039
4854 6739
4064 11033
466 6698
2959 4374
3041 3663
5616 3289
458 788
4018 8915
13689 2763
14153 14146
2336 9011
7827 11114
9235 13235
4091 5135
8099 10920
4359 13623
10194 870
3222 11124
13620 2624
4477 7638
12926 10795
506...

output:

YES
YES
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO

result:

ok 30 token(s): yes count is 18, no count is 12

Test #15:

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

input:

30
100000 99999
58634 53166
60069 39545
82578 88227
56874 85747
22905 28646
92672 64752
22373 59305
22541 59348
44095 65942
4988 67515
10343 77755
60473 69842
23600 65125
30620 9705
23682 88606
90443 30376
64660 28469
49987 74473
95538 6848
57849 92719
41776 11339
34932 41927
53269 36288
27451 77680...

output:

YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES

result:

ok 30 token(s): yes count is 12, no count is 18

Test #16:

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

input:

30
28822 28821
18849 2213
3904 10406
22000 14733
3382 11686
18120 2209
16720 21313
27796 11273
2151 1627
14221 1730
28679 13010
13611 8540
8923 13036
14093 25113
28268 1341
22450 5687
24407 28379
28185 19130
9949 4590
19825 24477
24266 21368
15658 20039
19834 22900
10711 27768
21931 21505
701 5260
2...

output:

YES
NO
YES
YES
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES

result:

ok 30 token(s): yes count is 14, no count is 16

Test #17:

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

input:

30
94155 94155
59782 9369
85417 55440
49151 38561
70569 2997
58372 92455
55440 13968
23987 25454
31693 59782
28401 47143
70435 87698
29557 80207
71824 24642
52316 53847
52316 49058
26005 29924
42139 19301
57171 76189
41506 59782
41871 88927
2997 10080
41910 83200
52724 3425
55302 18910
72572 45110
6...

output:

NO
YES
NO
YES
YES
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO

result:

ok 30 token(s): yes count is 14, no count is 16

Test #18:

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

input:

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

output:

NO
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
...

result:

ok 100000 token(s): yes count is 62089, no count is 37911

Test #19:

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

input:

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

output:

YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
...

result:

ok 100000 token(s): yes count is 63111, no count is 36889

Test #20:

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

input:

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

output:

NO
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES...

result:

ok 100000 token(s): yes count is 63673, no count is 36327

Test #21:

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

input:

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

output:

YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
YE...

result:

ok 100000 token(s): yes count is 63794, no count is 36206

Test #22:

score: 0
Accepted
time: 67ms
memory: 20012kb

input:

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

output:

YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
...

result:

ok 100000 token(s): yes count is 60664, no count is 39336

Test #23:

score: 0
Accepted
time: 66ms
memory: 19772kb

input:

100000
22 22
18 20
18 6
18 11
18 12
11 5
19 18
5 18
9 18
18 1
15 18
17 18
18 22
16 18
18 4
10 18
7 18
13 18
2 18
18 21
8 18
3 18
14 18
14 13
6 13
6 10
6 11
6 5
4 6
7 6
3 6
6 2
12 6
6 9
8 6
14 6
1 6
49 48
29 1
29 45
29 42
29 11
24 29
27 29
29 2
29 17
29 10
29 41
26 29
29 3
29 28
29 35
14 24
29 43
34 ...

output:

NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
Y...

result:

ok 100000 token(s): yes count is 60375, no count is 39625

Test #24:

score: 0
Accepted
time: 69ms
memory: 21200kb

input:

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

output:

NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
N...

result:

ok 100000 token(s): yes count is 60402, no count is 39598

Test #25:

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

input:

1000
92 92
48 22
48 36
85 61
5 34
32 92
85 77
51 80
20 21
46 66
88 60
87 24
91 37
73 49
68 82
57 43
33 8
51 9
87 88
30 87
36 55
74 9
47 79
56 28
51 91
17 43
10 91
83 8
4 31
59 27
83 20
25 40
58 57
64 58
78 6
24 19
91 13
40 23
33 39
15 24
89 9
86 15
20 28
4 82
62 6
89 71
23 51
41 6
13 27
91 66
20 3
3...

output:

NO
NO
NO
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
YE...

result:

ok 1000 token(s): yes count is 514, no count is 486

Test #26:

score: 0
Accepted
time: 65ms
memory: 20768kb

input:

1000
1395 1395
1105 938
78 70
1391 1308
575 1100
870 761
532 359
317 510
731 1286
225 1032
417 457
143 138
1183 590
1163 684
1330 486
85 496
164 1362
1384 536
1179 634
345 556
1050 1225
96 1344
936 4
1293 1364
680 1342
1011 456
1218 252
515 7
1327 885
147 674
117 1359
232 876
240 547
529 995
1369 66...

output:

NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES...

result:

ok 1000 token(s): yes count is 472, no count is 528

Test #27:

score: 0
Accepted
time: 65ms
memory: 20328kb

input:

1000
4795 4795
1309 4214
4012 1850
4558 438
94 4634
4280 776
2602 2099
3333 2225
3255 563
4312 2297
3970 37
4226 1505
3154 2093
4346 2696
1150 3480
1177 3639
4505 3028
2158 975
1656 3875
440 3655
1582 623
1481 1065
671 3689
1779 3033
4280 1446
2065 4021
3786 2148
504 435
2942 1135
1679 1604
2577 129...

output:

NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
Y...

result:

ok 1000 token(s): yes count is 511, no count is 489

Test #28:

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

input:

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

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
NO
NO
YES...

result:

ok 1000 token(s): yes count is 506, no count is 494

Test #29:

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

input:

1000
564 563
286 186
170 93
368 101
6 1
131 96
209 195
87 541
243 455
536 294
107 1
33 102
405 518
274 152
52 541
133 476
304 169
476 22
282 486
541 96
77 476
105 286
386 541
48 4
1 331
157 519
274 288
169 534
149 113
562 116
21 394
558 21
541 141
264 165
220 209
167 535
324 116
228 196
264 314
62 4...

output:

YES
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
...

result:

ok 1000 token(s): yes count is 501, no count is 499

Test #30:

score: 0
Accepted
time: 69ms
memory: 19908kb

input:

1000
121 120
31 17
60 31
31 58
31 57
54 31
31 118
26 31
31 39
31 80
50 121
31 99
87 51
105 51
116 31
31 32
51 103
31 18
45 31
31 94
31 100
5 31
10 31
31 64
84 31
20 102
70 31
31 19
101 31
31 36
73 31
95 51
31 75
31 53
31 82
31 47
31 74
15 31
42 31
27 31
4 31
30 31
31 55
31 35
31 89
71 31
24 31
31 7
...

output:

YES
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
N...

result:

ok 1000 token(s): yes count is 520, no count is 480

Test #31:

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

input:

1000
1860 1860
1486 1549
1486 4
1486 1319
1486 876
1486 1346
1486 1079
1486 1448
658 1486
772 1486
1486 1569
1486 458
201 1486
845 1486
932 1511
1553 115
263 1486
306 310
115 1596
1486 1374
115 331
1486 1110
115 739
1486 77
1486 1849
1486 464
1486 139
1701 310
1804 1486
1486 1825
1629 1486
115 307
2...

output:

NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
NO
YES
NO
NO
...

result:

ok 1000 token(s): yes count is 504, no count is 496

Test #32:

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

input:

10
99999 99999
55299 76206
53426 64385
86905 10791
98284 81890
12655 7511
46654 55754
61631 27386
70022 21981
87542 20275
66909 81933
71211 38008
84522 76391
62184 73876
84201 90037
34273 33546
40421 84499
82568 84837
65007 63760
3952 93765
6975 26057
37512 92996
18729 39781
34934 32453
50660 22877
...

output:

NO
NO
YES
NO
NO
YES
YES
NO
NO
YES

result:

ok 10 token(s): yes count is 4, no count is 6

Test #33:

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

input:

10
100000 100000
80453 9109
35432 82405
88992 78477
24413 20501
38584 96799
13443 57974
56636 68614
75936 69987
83195 46581
41678 17455
72227 87089
56924 26527
93681 7919
32011 91553
43058 64439
89121 26747
33767 84585
10449 37803
83365 92049
49177 83710
4596 12834
73214 40050
62496 43493
7089 51625...

output:

YES
NO
YES
NO
YES
YES
YES
NO
NO
YES

result:

ok 10 token(s): yes count is 6, no count is 4

Test #34:

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

input:

10
99999 99999
78883 36443
67800 23425
68922 45225
26045 28124
80375 70077
99532 98724
33964 78380
56589 93558
41279 38352
25208 95475
56889 23
77414 87088
48267 18326
98620 94432
18893 24052
87301 84789
5571 36537
84042 30379
44977 2725
80540 86514
83801 41222
44852 26591
44909 81229
50737 40038
30...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #35:

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

input:

10
100000 100000
65690 72848
7525 59163
22913 92659
637 42294
73052 80783
96435 28982
46576 22618
12929 71541
95452 27926
1882 4245
93116 42865
4421 91488
93174 57859
68478 3646
84489 12701
63850 86878
54711 79192
37083 78277
18996 9072
59873 14665
57763 79950
72288 6792
34056 72677
30679 11611
7507...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #36:

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

input:

10
99998 99998
56337 74968
78913 99296
9035 6309
4549 42626
23722 75464
78240 75974
57617 67863
64934 71737
84598 39558
26088 84811
5325 86486
59484 99961
71773 42079
96107 29038
75150 78836
10417 97471
89437 28006
71825 72730
71140 20789
23939 77963
57533 63523
99286 60991
54094 49702
49310 71543
1...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #37:

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

input:

10
100000 100000
63815 3625
32296 84580
23849 83409
33690 1811
37600 26074
71282 40355
70944 43351
19901 65705
11560 85569
64766 48662
56590 77874
41633 82398
31554 91918
13789 27130
94480 36938
68133 84329
18917 38457
78815 28741
6524 79909
67071 82047
28454 37020
89037 24255
56690 4898
11550 281
4...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #38:

score: 0
Accepted
time: 176ms
memory: 31068kb

input:

10
99999 99999
46900 92839
84072 29148
61872 29154
26803 41345
41562 66603
11107 74900
72200 34439
43653 7157
49018 18421
34089 90339
43947 14562
73697 37251
45703 67847
59041 60833
25822 96546
94798 50315
6083 54256
21351 18718
86085 55498
12307 88645
61492 24878
14191 67063
80198 52680
97421 27928...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #39:

score: 0
Accepted
time: 189ms
memory: 31660kb

input:

10
99996 99996
34862 34903
19813 73904
19904 99608
90308 37873
49635 83926
53061 80551
3889 79750
10014 913
18333 69371
16783 56986
97281 92385
20576 55967
6657 29114
82832 96966
70587 88808
22952 72638
6291 26616
6147 21341
44813 44847
88283 85414
13208 59333
67762 28952
90927 24457
79999 56387
527...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #40:

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

input:

10
100000 100000
20400 27643
36724 75417
78289 24073
96193 27717
24574 88752
96121 59895
62 21530
30007 4930
22338 16422
11909 86674
86206 57694
23448 87078
46079 92151
64590 49977
10565 40701
69152 68688
48291 49944
47137 8030
80216 18260
21613 18309
54272 14802
31642 89726
83026 2800
62533 62432
5...

output:

YES
NO
YES
NO
NO
NO
YES
YES
NO
NO

result:

ok 10 token(s): yes count is 4, no count is 6

Test #41:

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

input:

10
99999 99999
11602 38387
41801 54147
39814 47797
64769 86906
22479 19371
52904 90928
82168 70773
97018 47335
52324 82889
59489 60786
94312 85192
22569 14627
76269 42584
15690 97633
12119 90694
75900 78722
12523 2377
36810 13575
64644 60853
36850 71268
80042 46108
90402 98175
14489 91593
35596 8910...

output:

NO
YES
YES
NO
YES
YES
NO
YES
NO
NO

result:

ok 10 token(s): yes count is 5, no count is 5

Test #42:

score: 0
Accepted
time: 131ms
memory: 27956kb

input:

10
99999 99999
41073 94460
80049 72059
88841 22510
71004 13050
576 52108
18980 74020
15285 9700
22583 26221
76915 13517
31637 56211
27775 30502
72502 68019
82445 65066
80087 21899
53391 18598
74948 39720
29748 91017
44996 31340
24686 2506
92687 57691
94233 30487
94925 33961
79062 71334
43067 46080
4...

output:

NO
YES
YES
NO
NO
NO
NO
NO
NO
YES

result:

ok 10 token(s): yes count is 3, no count is 7

Test #43:

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

input:

10
100000 100000
17701 46525
79920 80602
55708 13949
71217 50946
84773 93601
17257 87153
67100 20545
23326 78396
97044 37083
23163 99239
48277 45881
53792 93856
59452 20054
25951 96818
68516 85905
54602 41935
28352 73914
87958 11060
75975 64243
15149 51096
95844 56715
76078 86782
71446 37985
70580 2...

output:

YES
NO
NO
YES
NO
YES
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 3, no count is 7

Test #44:

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

input:

10
100000 100000
93456 34375
17492 47901
45922 33052
24395 70320
36055 34906
40720 64052
93030 17140
86404 61847
95287 55040
22357 94928
64666 10952
56832 77353
48224 74367
42907 84412
65413 36410
53134 44343
46649 85372
59894 29419
94506 69012
49503 42907
46375 92922
97471 51742
32769 49692
42219 9...

output:

NO
NO
YES
YES
YES
NO
NO
YES
YES
YES

result:

ok 10 token(s): yes count is 6, no count is 4

Test #45:

score: 0
Accepted
time: 177ms
memory: 28572kb

input:

10
100000 100000
6577 81280
32493 33400
73738 24465
99584 76444
85061 10365
57837 2189
842 9696
86042 92097
10446 383
83811 17673
64059 67739
24835 3417
39985 30410
6930 92605
41770 36745
19543 78161
21863 18314
82415 26195
80386 3670
93311 85899
11165 5299
39497 71206
92453 93834
32932 95759
58015 ...

output:

NO
YES
YES
YES
YES
NO
NO
YES
YES
YES

result:

ok 10 token(s): yes count is 7, no count is 3

Test #46:

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

input:

10
100000 100000
53947 47393
52690 14394
11913 61605
44624 68452
91729 56758
4883 1184
71910 10537
41295 57743
24255 23992
89443 45719
59490 23055
18245 12935
44661 30232
45030 43931
28091 97568
58457 78933
8988 90742
90932 54150
32159 50614
35343 24559
56697 50913
50094 3020
71080 94794
84610 97915...

output:

YES
YES
YES
NO
NO
NO
NO
YES
NO
NO

result:

ok 10 token(s): yes count is 4, no count is 6

Test #47:

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

input:

10416
96 96
31 63
87 90
12 30
22 16
86 16
38 6
41 10
32 28
15 53
85 80
39 56
1 17
14 87
63 65
17 23
89 38
25 40
8 6
66 17
85 51
76 88
92 25
22 42
55 32
24 90
50 56
46 88
84 26
84 83
50 73
81 36
71 25
38 58
96 63
27 17
68 38
41 9
72 87
33 80
12 62
36 21
45 60
17 71
15 25
79 90
32 88
7 25
71 60
88 56
...

output:

NO
YES
NO
NO
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
...

result:

ok 10416 token(s): yes count is 5345, no count is 5071

Test #48:

score: 0
Accepted
time: 63ms
memory: 19188kb

input:

10416
96 96
22 13
67 75
38 2
20 5
19 84
14 24
3 74
52 7
10 65
34 93
45 6
40 76
30 19
15 9
18 53
80 88
89 59
60 35
30 71
59 76
44 16
88 68
41 4
39 36
1 65
95 66
51 69
58 85
87 92
39 82
13 23
61 91
32 90
61 11
76 33
70 7
64 51
92 23
2 46
73 75
59 64
5 78
35 67
48 89
55 40
49 68
66 49
62 12
71 62
3 10
...

output:

YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
YES
Y...

result:

ok 10416 token(s): yes count is 7252, no count is 3164

Test #49:

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

input:

10416
96 96
94 31
51 95
80 9
91 7
29 10
12 15
65 10
65 45
84 64
23 40
49 63
7 40
10 72
95 50
95 36
14 54
4 94
46 64
94 5
26 76
93 9
19 94
34 95
13 26
94 28
74 15
57 54
81 57
87 65
89 42
40 69
65 41
37 15
9 11
59 9
88 94
15 54
54 25
54 21
9 40
10 24
75 80
89 67
22 40
15 20
54 94
10 68
15 85
70 9
89 8...

output:

NO
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
Y...

result:

ok 10416 token(s): yes count is 7708, no count is 2708

Test #50:

score: 0
Accepted
time: 75ms
memory: 19220kb

input:

793
1260 1260
524 991
1240 1020
1204 661
272 389
479 770
398 421
1104 143
234 876
542 137
377 337
1141 444
549 408
628 146
328 852
570 706
555 221
408 1100
1048 1184
426 938
1232 924
454 132
1250 803
26 499
628 997
299 1138
1197 210
702 1005
83 658
535 162
182 351
696 245
606 92
135 39
1255 593
418 ...

output:

YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
YES
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
NO
NO
NO
NO
YE...

result:

ok 793 token(s): yes count is 391, no count is 402

Test #51:

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

input:

793
1260 1260
888 84
563 916
1067 402
1103 325
361 315
630 1216
1095 521
487 210
1224 620
525 1101
6 779
752 1130
650 180
675 603
482 1102
495 616
981 341
781 1159
105 690
513 1056
638 1003
1127 355
427 102
905 792
948 887
184 369
506 1056
110 885
507 709
661 556
867 312
931 903
814 168
983 281
213 ...

output:

YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
...

result:

ok 793 token(s): yes count is 431, no count is 362

Test #52:

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

input:

793
1260 1260
579 438
263 700
718 792
613 162
1066 802
1166 890
670 1090
1115 29
90 1240
66 1178
306 1156
498 615
17 670
188 583
314 248
316 1257
1009 709
224 1064
966 383
520 329
1063 258
1115 384
41 739
321 376
256 88
782 314
300 595
655 927
396 335
355 886
636 638
486 716
388 160
1244 157
772 446...

output:

YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
...

result:

ok 793 token(s): yes count is 455, no count is 338

Test #53:

score: 0
Accepted
time: 189ms
memory: 27760kb

input:

10
100000 100000
52131 86313
34666 93975
16684 99652
34427 48340
70282 53117
3901 35496
59742 49203
7539 96581
10093 41385
55981 64826
81906 32744
51790 60417
16641 16768
5088 9613
12299 4105
48338 74618
53331 18291
10241 68164
53158 42856
86492 70625
42436 9977
60610 54655
70916 10228
81961 70268
1...

output:

YES
YES
YES
YES
YES
YES
YES
NO
NO
YES

result:

ok 10 token(s): yes count is 8, no count is 2

Test #54:

score: 0
Accepted
time: 167ms
memory: 27660kb

input:

10
99990 99990
7585 29030
83760 16550
58209 51341
10154 39910
35950 43045
85184 27583
10657 3059
6691 4789
47073 23540
63957 6553
50066 3428
32904 10072
537 92015
25244 95706
41691 39978
96327 73581
76821 45803
8539 84506
8005 55442
18592 95736
69429 14374
20306 47861
27296 82835
84412 54398
94029 1...

output:

NO
YES
YES
NO
NO
YES
NO
YES
NO
YES

result:

ok 10 token(s): yes count is 5, no count is 5

Test #55:

score: 0
Accepted
time: 198ms
memory: 27776kb

input:

10
100000 100000
83519 96188
72363 29698
1559 87199
43978 41544
41237 18453
21036 70937
6967 17940
45245 12252
6401 30772
34475 77813
89099 19508
81406 1776
86041 97104
82611 46165
97791 75132
85618 67102
29396 85889
7667 5489
14150 69574
85573 31538
21173 40426
18435 61288
37803 3682
24735 15253
28...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #56:

score: 0
Accepted
time: 192ms
memory: 27760kb

input:

10
99990 99990
39424 29897
32062 93181
23748 61132
47389 56627
38177 45454
67118 13518
90996 27542
72278 55027
6255 58529
87604 3090
24471 28719
3990 41965
74133 63443
7382 2199
9226 28941
5854 11676
42638 96201
11916 81869
78801 83500
1034 33161
48363 11954
17909 79882
24157 17033
21738 34335
12142...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #57:

score: 0
Accepted
time: 214ms
memory: 27892kb

input:

10
100000 100000
3280 61521
43032 26291
912 36233
68769 44378
93467 1033
50104 49288
48379 77658
95822 24728
88709 13939
95688 57355
41744 73877
98805 71526
96986 77814
76738 30556
17674 24799
65231 17258
93269 40774
3601 77930
25811 73805
13767 79090
42428 71987
37927 40246
44656 99502
22848 98373
...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #58:

score: 0
Accepted
time: 187ms
memory: 27668kb

input:

10
99990 99990
6005 774
51937 90324
62044 12922
74457 52418
39123 39794
14939 43691
9740 26032
12972 7406
34221 14712
79290 12070
15923 8078
9542 76057
93640 2908
82093 56409
74325 70597
15965 68900
45546 92387
34700 30446
69547 21020
85396 2721
48212 15373
11057 17660
57354 35079
16393 33253
54761 ...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #59:

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

input:

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

output:

YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
NO
NO
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
Y...

result:

ok 55555 token(s): yes count is 29936, no count is 25619

Test #60:

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

input:

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

output:

YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
YES
NO
NO...

result:

ok 41666 token(s): yes count is 21337, no count is 20329

Test #61:

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

input:

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

output:

NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
NO
YES
N...

result:

ok 33333 token(s): yes count is 16857, no count is 16476

Test #62:

score: 0
Accepted
time: 77ms
memory: 19116kb

input:

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

output:

YES
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
Y...

result:

ok 66666 token(s): yes count is 34290, no count is 32376

Test #63:

score: 0
Accepted
time: 79ms
memory: 20248kb

input:

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

output:

YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
YES
NO
N...

result:

ok 55555 token(s): yes count is 28157, no count is 27398

Test #64:

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

input:

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

output:

YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
YE...

result:

ok 47619 token(s): yes count is 24037, no count is 23582

Test #65:

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

input:

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

output:

NO
YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
NO
NO
YES
YES
YES
YE...

result:

ok 41666 token(s): yes count is 20814, no count is 20852

Test #66:

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

input:

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

output:

NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
N...

result:

ok 33333 token(s): yes count is 16797, no count is 16536

Test #67:

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

input:

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

output:

YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
...

result:

ok 27777 token(s): yes count is 13860, no count is 13917

Test #68:

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

input:

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

output:

NO
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
YES
NO
NO
YES
NO
Y...

result:

ok 50000 token(s): yes count is 25436, no count is 24564

Test #69:

score: 0
Accepted
time: 77ms
memory: 19988kb

input:

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

output:

YES
NO
YES
NO
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
YE...

result:

ok 41666 token(s): yes count is 21142, no count is 20524

Test #70:

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

input:

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

output:

YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO...

result:

ok 35714 token(s): yes count is 17907, no count is 17807

Test #71:

score: 0
Accepted
time: 79ms
memory: 19064kb

input:

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

output:

YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
YES
YES
NO
NO
...

result:

ok 31250 token(s): yes count is 15662, no count is 15588

Test #72:

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

input:

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

output:

NO
NO
YES
YES
NO
YES
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
YES
NO
NO
NO
...

result:

ok 25000 token(s): yes count is 12425, no count is 12575

Test #73:

score: 0
Accepted
time: 62ms
memory: 20160kb

input:

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

output:

YES
NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO...

result:

ok 20833 token(s): yes count is 10443, no count is 10390