QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#22795#2882. New White-Black Treehy_zheng_zai_nei_juan#AC ✓1055ms77484kbC++203.5kb2022-03-10 16:40:432022-04-30 01:40:53

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 01:40:53]
  • 评测
  • 测评结果:AC
  • 用时:1055ms
  • 内存:77484kb
  • [2022-03-10 16:40:43]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<sstream>
#include<cctype>
#include<cmath>
#include<iomanip>
#include<map>
#include<stack>
#include<set>
#include<functional>
#define in(x) x=read()
#define qr read()
#define int ll
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
namespace fastIO
{
    #define BUF_SIZE 100000
    bool IOerror=0;
    inline char nc()
	{
        static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
        if (p1==pend){
            p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
            if (pend==p1){IOerror=1;return -1;}
        }
        return *p1++;
    }
    inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
    inline ll read()
	{
        bool sign=0; char ch=nc();ll x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return 0;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
        return x;
    }
    #undef BUF_SIZE
};
using namespace fastIO;
struct node1
{
	int w,b,id;
};
struct node2
{
	int w,b,id;
};
struct node3
{
	int w,b,id;
};
bool operator < (const node1 a,const node1 b){return a.w==b.w?((a.w+a.b)==(b.w+b.b)?a.id<b.id:(a.w+a.b)<(b.w+b.b)):a.w<b.w;}
bool operator < (const node2 a,const node2 b){return a.b==b.b?((a.w+a.b)==(b.w+b.b)?a.id<b.id:(a.w+a.b)<(b.w+b.b)):a.b<b.b;}
bool operator < (const node3 a,const node3 b){return (a.w+a.b)==(b.w+b.b)?a.id<b.id:(a.w+a.b)<(b.w+b.b);}
set<node1>s1;
set<node2>s2;
set<node3>s3;
int w[1000010],b[1000010];
void del(node1 x)
{
	s1.erase((node1){x.w,x.b,x.id});
	s2.erase((node2){x.w,x.b,x.id});
	s3.erase((node3){x.w,x.b,x.id});
}
void del(node2 x)
{
	s1.erase((node1){x.w,x.b,x.id});
	s2.erase((node2){x.w,x.b,x.id});
	s3.erase((node3){x.w,x.b,x.id});
}
void del(node3 x)
{
	s1.erase((node1){x.w,x.b,x.id});
	s2.erase((node2){x.w,x.b,x.id});
	s3.erase((node3){x.w,x.b,x.id});
}
void ins(int w,int b,int id)
{
	s1.insert((node1){w,b,id});
	s2.insert((node2){w,b,id});
	s3.insert((node3){w,b,id});
}
vector<pair<int,int> >answ,ansb;
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int T=qr;
	while(T--)
	{
		int n=qr,sum=0,sumw=0,sumb=0;
		for(int i=1;i<=n;i++)
		{
			in(w[i]),in(b[i]);
			sumw+=w[i];
			sumb+=b[i];
			sum+=w[i]+b[i];
			s1.insert((node1){w[i],b[i],i});
			s2.insert((node2){w[i],b[i],i});
			s3.insert((node3){w[i],b[i],i});
		}
		if(sum!=2*(n-1)||sumw%2||sumb%2)
		{
			puts("No");
			s1.clear(),s2.clear(),s3.clear(),answ.clear(),ansb.clear();
			continue;
		}
		int f=0;
		while(!s3.empty())
		{
			node3 now=*s3.begin();
			// cout<<now.id<<' '<<now.w<<' '<<now.b<<'\n';
			del(now);
			if(!(s3.empty()&&now.w+now.b==0)&&now.w+now.b!=1)
			{
				f=1;
				break;
			}
			if(s3.empty())break;
			if(now.w)
			{
				node1 nxt=*--s1.end();
				answ.push_back(mp(now.id,nxt.id));
				del(nxt);
				ins(nxt.w-1,nxt.b,nxt.id);
			}
			else
			{
				node2 nxt=*--s2.end();
				ansb.push_back(mp(now.id,nxt.id));
				del(nxt);
				ins(nxt.w,nxt.b-1,nxt.id);
			}
		}
		if(f)puts("No");
		else
		{
			puts("Yes");
			for(auto i:answ)cout<<i.first<<' '<<i.second<<" W\n";
			for(auto i:ansb)cout<<i.first<<' '<<i.second<<" B\n";
		}
		s1.clear(),s2.clear(),s3.clear(),answ.clear(),ansb.clear();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 5516kb

input:

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

output:

Yes
3 2 W
1 4 W
2 1 B
No
Yes
Yes
1 2 B
No
No

result:

ok 3 'Yes' out of 6 cases (6 test cases)

Test #2:

score: 0
Accepted
time: 150ms
memory: 5732kb

input:

23072
2
1 0
1 0
2
0 1
0 1
3
1 0
1 0
2 0
3
2 0
0 1
0 1
3
0 2
1 0
1 0
3
1 0
1 1
0 1
3
0 1
0 1
0 2
4
3 0
1 0
1 0
1 0
4
1 0
1 0
2 0
2 0
4
1 0
0 1
3 0
0 1
4
2 0
0 1
2 0
0 1
4
1 0
2 0
1 0
0 2
4
1 0
2 0
1 1
0 1
4
1 0
1 0
2 1
0 1
4
1 0
1 0
1 2
1 0
4
1 1
1 0
1 1
1 0
4
0 2
0 1
0 1
2 0
4
2 1
0 1
0 1
0 1
4
1 0
...

output:

Yes
1 2 W
Yes
1 2 B
Yes
1 3 W
2 3 W
No
No
Yes
1 2 W
2 3 B
Yes
1 3 B
2 3 B
Yes
2 1 W
3 1 W
1 4 W
Yes
1 4 W
2 3 W
3 4 W
No
No
No
Yes
1 2 W
2 3 W
3 4 B
Yes
1 3 W
2 3 W
3 4 B
No
Yes
2 3 W
1 4 W
3 1 B
No
No
No
No
Yes
3 2 W
1 4 B
2 4 B
Yes
1 3 W
2 3 B
3 4 B
Yes
3 2 W
1 3 B
2 4 B
Yes
1 3 B
2 3 B
3 4 B
Yes
...

result:

ok 11912 'Yes' out of 23072 cases (23072 test cases)

Test #3:

score: 0
Accepted
time: 215ms
memory: 5732kb

input:

25000
12
4 1
1 0
1 0
2 0
1 0
0 2
0 1
1 1
1 0
1 2
1 0
1 1
12
1 0
2 0
0 2
1 0
0 1
2 0
0 1
1 0
0 3
0 2
1 0
0 5
12
0 1
0 1
1 0
0 1
0 2
0 2
4 5
1 0
0 1
0 1
1 0
1 0
12
2 0
1 0
1 0
1 3
1 0
1 0
1 0
1 0
0 3
1 0
0 3
0 3
12
0 1
1 1
0 1
0 2
0 1
5 0
0 1
0 1
1 1
1 1
3 0
1 0
12
0 2
0 1
0 1
0 1
1 1
3 0
0 4
0 3
2 0
...

output:

Yes
2 1 W
3 1 W
5 1 W
9 4 W
4 12 W
11 10 W
8 1 W
7 10 B
10 6 B
6 8 B
1 12 B
No
Yes
3 7 W
8 7 W
11 7 W
7 12 W
1 7 B
2 7 B
4 7 B
9 7 B
10 6 B
6 5 B
5 7 B
No
No
No
Yes
6 1 W
7 1 W
9 5 W
5 10 W
11 1 W
2 8 B
3 12 B
4 8 B
10 12 B
1 8 B
8 12 B
Yes
3 12 W
4 12 W
7 10 W
8 12 W
10 11 W
11 1 W
1 12 W
9 6 B
6 5...

result:

ok 13004 'Yes' out of 25000 cases (25000 test cases)

Test #4:

score: 0
Accepted
time: 217ms
memory: 5752kb

input:

23076
13
0 3
0 2
2 0
1 1
3 0
0 2
1 0
1 0
1 0
2 0
1 0
1 2
1 0
13
0 1
3 2
1 2
1 0
0 1
0 1
0 1
2 0
0 1
1 4
1 0
0 1
1 0
13
0 3
0 1
0 1
0 1
2 0
0 1
0 1
1 0
6 0
2 0
0 1
3 0
0 1
13
7 1
1 2
2 0
1 0
0 1
1 0
0 1
0 1
1 0
1 0
2 0
1 0
1 0
13
0 1
0 1
0 1
1 1
1 1
3 0
1 1
0 1
0 1
1 5
0 1
0 1
1 1
13
0 1
1 1
1 0
1 0
...

output:

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

result:

ok 11876 'Yes' out of 23076 cases (23076 test cases)

Test #5:

score: 0
Accepted
time: 23ms
memory: 5692kb

input:

12720
1
0 0
2
1 0
1 0
2
0 1
0 1
3
0 0
2 0
2 0
3
1 0
2 0
1 0
3
2 0
0 0
0 2
3
0 1
2 0
0 1
3
1 0
1 0
0 2
3
1 1
0 1
1 0
3
0 0
1 1
1 1
3
0 0
0 2
0 2
3
0 1
0 1
0 2
4
0 0
0 0
3 0
3 0
4
3 0
2 0
0 0
1 0
4
1 0
3 0
1 0
1 0
4
2 0
0 0
2 0
2 0
4
1 0
2 0
1 0
2 0
4
0 2
1 0
3 0
0 0
4
0 0
3 0
1 2
0 0
4
0 1
1 0
0 1
3 ...

output:

Yes
Yes
1 2 W
Yes
1 2 B
No
Yes
1 2 W
2 3 W
No
No
No
Yes
1 3 W
2 1 B
No
No
Yes
1 3 B
2 3 B
No
No
Yes
1 2 W
3 2 W
2 4 W
No
Yes
1 4 W
3 2 W
2 4 W
No
No
No
No
No
No
No
No
No
No
Yes
1 3 W
3 2 W
2 4 B
Yes
3 2 W
2 4 W
1 2 B
No
No
No
Yes
2 4 W
3 1 W
1 4 B
No
No
No
No
No
No
No
No
No
No
No
Yes
1 2 W
2 3 B
3 4...

result:

ok 851 'Yes' out of 12720 cases (12720 test cases)

Test #6:

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

input:

33907
8
0 1
1 0
0 2
2 0
1 2
0 1
1 0
3 0
8
1 0
2 2
1 0
0 2
0 1
3 0
1 0
0 1
8
1 0
0 1
0 2
3 2
0 1
1 0
1 0
2 0
8
1 1
0 2
3 0
0 0
0 2
1 1
1 0
2 0
8
1 1
2 1
0 2
0 2
1 0
1 0
0 0
3 0
8
0 2
2 0
1 0
1 0
1 1
0 2
3 1
0 0
8
3 1
1 0
1 0
0 2
0 2
2 1
0 0
1 0
8
0 2
1 2
0 0
1 0
3 0
1 1
2 0
0 1
8
2 1
0 2
1 2
1 0
0 1
...

output:

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

result:

ok 1643 'Yes' out of 33907 cases (33907 test cases)

Test #7:

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

input:

10165
1
0 0
2
1 0
1 0
2
0 1
0 1
3
2 0
2 0
0 0
3
2 0
0 0
2 0
3
0 0
2 0
2 0
3
2 0
1 0
1 0
3
1 0
2 0
1 0
3
1 0
1 0
2 0
3
2 0
0 2
0 0
3
2 0
0 0
0 2
3
0 2
2 0
0 0
3
0 2
0 0
2 0
3
0 0
2 0
0 2
3
0 0
0 2
2 0
3
2 0
0 1
0 1
3
0 1
2 0
0 1
3
0 1
0 1
2 0
3
1 0
1 0
0 2
3
1 0
0 2
1 0
3
0 2
1 0
1 0
3
1 1
1 0
0 1
3
...

output:

Yes
Yes
1 2 W
Yes
1 2 B
No
No
No
Yes
2 1 W
1 3 W
Yes
1 2 W
2 3 W
Yes
1 3 W
2 3 W
No
No
No
No
No
No
No
No
No
No
No
No
Yes
2 1 W
1 3 B
Yes
1 3 W
2 1 B
Yes
1 2 W
2 3 B
Yes
1 3 W
2 3 B
Yes
2 3 W
1 2 B
Yes
2 3 W
1 3 B
No
No
No
No
No
No
Yes
2 1 B
1 3 B
Yes
1 2 B
2 3 B
Yes
1 3 B
2 3 B
No
No
No
No
No
No
No
...

result:

ok 1159 'Yes' out of 10165 cases (10165 test cases)

Test #8:

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

input:

50000
6
2 2
0 0
1 0
1 0
0 0
0 4
6
0 2
0 4
1 0
1 2
0 0
0 0
6
0 1
3 0
1 0
0 0
4 1
0 0
6
0 0
3 2
0 0
0 1
1 3
0 0
6
0 2
1 0
0 1
0 0
0 1
1 4
6
0 3
0 0
2 1
0 0
0 2
0 2
6
0 2
0 0
1 3
2 0
1 1
0 0
6
2 0
1 0
0 1
0 0
1 0
0 5
6
0 0
2 1
1 0
0 0
5 0
0 1
6
2 1
0 1
0 0
1 0
1 0
4 0
6
0 0
0 0
0 2
0 4
2 0
0 2
6
0 0
2 ...

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
Yes
2 1 W
5 4 W
4 1 W
1 6 W
3 1 B
No
No
No
No
No
No
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
1 4 W
2 4 W
4 5 W
5 3 B
3 6 B
No
No
Yes
2 1 W
3 2 B
4 2 B
5 2 B
1 6 B
No
No
No
No
No
No
Yes
1 4 W
2 ...

result:

ok 3607 'Yes' out of 50000 cases (50000 test cases)

Test #9:

score: 0
Accepted
time: 200ms
memory: 5696kb

input:

26462
9
1 0
0 1
1 1
3 1
1 3
0 1
0 1
1 0
1 0
9
1 0
3 3
1 0
0 1
1 1
1 0
0 1
0 1
1 1
9
2 0
0 1
0 3
2 1
0 1
0 1
2 0
2 0
0 1
9
3 2
1 0
1 0
1 0
1 0
1 0
0 2
0 2
0 2
9
0 1
2 0
1 1
0 3
2 0
0 1
0 1
1 1
2 0
9
1 0
0 2
1 0
0 2
1 1
1 0
1 0
0 2
3 1
9
2 1
0 1
0 3
2 0
1 0
0 1
0 1
2 0
1 1
9
1 2
3 1
1 0
1 0
0 2
1 0
0 ...

output:

Yes
1 4 W
8 4 W
4 5 W
3 9 W
2 5 B
6 5 B
7 4 B
5 3 B
Yes
1 2 W
3 2 W
6 2 W
5 9 W
4 2 B
7 2 B
2 9 B
8 5 B
No
No
Yes
3 9 W
8 5 W
5 2 W
2 9 W
1 4 B
6 4 B
4 8 B
7 3 B
Yes
1 9 W
3 9 W
6 9 W
7 5 W
5 8 B
8 4 B
4 2 B
2 9 B
Yes
5 1 W
1 8 W
8 4 W
4 9 W
2 3 B
6 3 B
3 9 B
7 1 B
Yes
3 2 W
4 2 W
6 1 W
2 9 W
7 8 B
...

result:

ok 13715 'Yes' out of 26462 cases (26462 test cases)

Test #10:

score: 0
Accepted
time: 212ms
memory: 7860kb

input:

23076
13
2 2
0 2
0 1
2 0
2 0
0 2
1 0
0 2
0 1
1 1
0 1
0 2
2 0
13
0 1
3 0
3 0
1 0
0 1
0 1
3 1
1 0
0 1
1 0
3 0
0 1
3 0
13
1 3
0 1
4 0
0 1
1 0
0 2
0 1
0 1
1 0
1 0
2 0
2 0
0 3
13
2 1
0 1
0 1
1 0
1 2
1 0
2 1
1 0
1 0
1 0
0 1
0 4
2 1
13
2 0
4 0
1 0
0 1
1 0
1 3
2 0
2 0
1 0
1 0
0 2
2 0
1 0
13
2 1
0 1
0 1
1 0
...

output:

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

result:

ok 11905 'Yes' out of 23076 cases (23076 test cases)

Test #11:

score: 0
Accepted
time: 223ms
memory: 5732kb

input:

21428
14
1 2
0 1
0 1
1 0
1 2
0 1
1 0
1 0
1 0
2 0
1 2
3 0
1 0
3 1
14
1 0
0 1
2 0
1 0
0 1
1 0
2 2
1 0
0 1
1 0
4 1
1 0
0 4
0 2
14
1 0
1 2
0 1
1 0
2 0
1 4
0 1
1 4
0 2
1 0
1 0
1 0
0 1
0 1
14
0 1
0 1
1 2
1 1
0 1
0 1
0 1
0 1
0 1
3 0
0 2
0 1
2 1
3 2
14
1 1
1 1
0 1
1 0
8 0
0 1
0 1
0 1
0 1
0 1
0 1
1 0
0 2
0 3...

output:

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

result:

ok 11112 'Yes' out of 21428 cases (21428 test cases)

Test #12:

score: 0
Accepted
time: 22ms
memory: 5696kb

input:

66282
1
0 0
2
1 1
1 1
2
1 1
1 0
2
1 1
0 1
2
1 1
0 0
2
1 0
1 1
2
1 0
1 0
2
1 0
0 1
2
1 0
0 0
2
0 1
1 1
2
0 1
1 0
2
0 1
0 1
2
0 1
0 0
2
0 0
1 1
2
0 0
1 0
2
0 0
0 1
2
0 0
0 0
3
2 2
2 2
2 2
3
2 2
2 2
2 1
3
2 2
2 2
2 0
3
2 2
2 2
1 2
3
2 2
2 2
1 1
3
2 2
2 2
1 0
3
2 2
2 2
0 2
3
2 2
2 2
0 1
3
2 2
2 2
0 0
3
...

output:

Yes
No
No
No
No
No
Yes
1 2 W
No
No
No
No
Yes
1 2 B
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
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 119 'Yes' out of 66282 cases (66282 test cases)

Test #13:

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

input:

60000
5
0 0
0 2
1 4
1 3
4 3
5
0 0
0 3
2 1
2 0
0 1
5
0 0
0 2
0 2
3 0
3 0
5
0 0
0 1
2 3
4 0
0 3
5
0 0
0 0
1 0
4 4
3 2
5
0 0
0 1
0 0
0 3
4 0
5
0 0
0 2
2 4
3 2
2 4
5
0 0
0 1
3 2
4 2
4 4
5
0 0
0 0
4 3
0 1
1 4
5
0 0
0 0
4 1
4 4
3 3
5
0 0
0 0
4 4
1 3
0 3
5
0 0
0 1
0 3
3 4
4 3
5
0 0
0 3
2 1
2 3
1 0
5
0 0
0 ...

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 0 'Yes' out of 60000 cases (60000 test cases)

Test #14:

score: 0
Accepted
time: 722ms
memory: 75796kb

input:

1
300000
1 1
0 2
0 1
1 0
0 2
0 1
0 2
1 0
0 1
1 1
0 4
2 2
0 1
1 1
1 1
3 1
0 1
2 2
0 1
0 8
1 1
1 1
2 4
1 0
1 0
0 1
2 1
1 1
0 1
1 1
0 1
2 2
0 1
0 3
2 0
7 3
1 0
1 0
1 1
1 0
2 1
0 2
1 0
2 0
2 2
0 1
1 0
1 0
0 3
0 1
1 0
2 0
1 3
1 0
0 1
0 1
1 0
3 1
2 0
0 1
1 2
0 1
2 3
1 0
3 0
0 1
1 0
0 1
0 1
2 0
2 0
2 1
1 1...

output:

Yes
4 92220 W
8 157058 W
24 92220 W
25 157058 W
37 223452 W
38 95333 W
40 92220 W
43 157058 W
47 19894 W
48 223452 W
51 202711 W
54 150922 W
57 93940 W
64 255089 W
67 108438 W
78 110281 W
82 95333 W
88 92220 W
91 297989 W
93 157058 W
94 19894 W
95 259350 W
96 245224 W
97 223452 W
101 202711 W
110 12...

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #15:

score: 0
Accepted
time: 758ms
memory: 73404kb

input:

1
300000
1 0
0 1
1 0
0 4
1 2
0 1
0 1
0 1
0 1
0 1
2 1
4 1
0 1
2 1
1 0
0 1
1 0
1 0
0 1
1 0
4 1
3 3
1 0
1 0
1 0
0 2
1 0
4 2
0 1
1 0
1 0
1 0
0 1
0 1
0 1
1 0
1 0
0 1
4 1
1 0
6 4
0 1
0 1
1 0
0 1
0 1
0 1
0 1
1 0
0 1
1 0
2 3
1 0
1 0
2 1
2 2
1 0
2 0
1 0
3 1
0 1
2 2
1 0
0 1
3 10
1 1
1 0
1 0
1 0
1 0
1 0
0 1
0 ...

output:

Yes
1 32000 W
3 32000 W
15 38491 W
17 131701 W
18 32000 W
20 69012 W
23 38491 W
24 131701 W
25 32000 W
27 16017 W
30 168140 W
31 82848 W
32 69012 W
36 37830 W
37 111260 W
40 50543 W
44 38491 W
49 227034 W
51 131701 W
53 32000 W
54 261085 W
57 16017 W
59 156148 W
63 9781 W
67 168140 W
68 99017 W
69 8...

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #16:

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

input:

1
300000
1 0
0 1
1 0
0 1
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
0 1
17 25
0 1
1 0
1 0
1 0
0 1
0 1
0 1
0 1
1 0
0 1
0 1
0 1
1 0
0 1
2 0
1 0
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
0 1
1 0
0 1
1 0
0 1
0 1
0 1
4 3
1 0
0 1
0 1
0 1
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
0 1
0 1
1 0
14 14
0 1
0 1
0 1...

output:

Yes
1 150293 W
3 150293 W
6 150293 W
9 150293 W
10 150293 W
11 150293 W
16 150293 W
17 179819 W
18 203152 W
23 150293 W
27 179819 W
30 203152 W
31 150293 W
33 179819 W
36 203152 W
37 279010 W
38 150293 W
39 179819 W
41 203152 W
42 279010 W
47 150293 W
49 179819 W
54 203152 W
59 279010 W
61 150293 W
...

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #17:

score: 0
Accepted
time: 756ms
memory: 76488kb

input:

1
300000
1 0
1 0
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
1 0
0 1
1 0
0 1
0 1
1 0
1 0
0 1
1 0
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
0 1
1 0
0 1
0 1
1 0
0 1
1 0
1 0...

output:

Yes
1 78478 W
2 78478 W
5 78478 W
6 78478 W
7 78478 W
8 78478 W
9 78478 W
10 78478 W
11 78478 W
14 78478 W
15 78478 W
16 78478 W
18 78478 W
21 78478 W
22 78478 W
24 78478 W
28 78478 W
30 78478 W
32 78478 W
34 78478 W
35 78478 W
36 78478 W
37 78478 W
41 78478 W
43 78478 W
46 78478 W
47 78478 W
48 784...

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #18:

score: 0
Accepted
time: 749ms
memory: 68484kb

input:

1
300000
0 1
1 0
1 0
0 1
0 1
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
0 1
0 1
0 1
0 1
1 0
1 0
0 1
0 1
0 1
1 0
1 0
0 1
0 1
0 1
0 1
0 1
0 1
1 0
1 0
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
0 1
1 0
0 1
0 1
0 1
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
0 1
1 0
1 0
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
0 1
1 0
1 0
0 1...

output:

Yes
2 182618 W
3 182618 W
6 182618 W
7 182618 W
8 182618 W
12 182618 W
14 182618 W
19 182618 W
20 182618 W
24 182618 W
25 182618 W
32 182618 W
33 182618 W
36 182618 W
38 182618 W
39 182618 W
40 182618 W
41 182618 W
42 182618 W
43 182618 W
44 182618 W
45 182618 W
47 182618 W
52 182618 W
55 182618 W
5...

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #19:

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

input:

395
845
1 0
1 0
1 0
1 0
1 0
0 1
0 1
0 1
0 1
0 1
1 0
1 0
0 1
1 0
1 0
1 0
0 1
1 0
0 1
0 1
1 0
0 1
0 1
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
1 0
1 0
0 1
1 0
27 51
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
1 0
3 6
0 1
1 0
0 1
1 0
1 0
0 1
1 0
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 ...

output:

Yes
1 194 W
2 47 W
3 194 W
4 47 W
5 194 W
11 119 W
12 47 W
14 194 W
15 119 W
16 47 W
18 194 W
21 119 W
25 47 W
28 194 W
29 119 W
30 47 W
32 194 W
33 119 W
35 490 W
36 256 W
38 194 W
39 47 W
43 119 W
44 490 W
46 256 W
48 194 W
49 47 W
50 119 W
51 533 W
55 490 W
56 256 W
59 194 W
61 47 W
62 119 W
64 5...

result:

ok 395 'Yes' out of 395 cases (395 test cases)

Test #20:

score: 0
Accepted
time: 569ms
memory: 71828kb

input:

1
300000
2 0
0 2
2 0
1 1
1 1
1 1
2 0
2 0
2 0
2 0
1 1
0 2
2 0
2 0
0 2
1 1
1 1
1 1
0 2
0 2
0 2
2 0
2 0
0 2
0 2
2 0
2 0
0 2
0 2
1 1
1 1
2 0
1 1
1 1
1 1
2 0
2 0
1 1
2 0
1 1
1 1
2 0
2 0
2 0
1 1
2 0
1 1
0 2
1 1
1 1
1 1
2 0
0 2
1 1
0 2
0 2
2 0
2 0
1 1
1 1
1 1
2 0
2 0
2 0
0 2
1 1
2 0
0 2
1 1
1 1
2 0
0 2
1 1...

output:

Yes
160135 299999 W
299999 299995 W
299995 299985 W
299985 299977 W
299977 299972 W
299972 299970 W
299970 299968 W
299968 299963 W
299963 299953 W
299953 299951 W
299951 299949 W
299949 299940 W
299940 299939 W
299939 299930 W
299930 299925 W
299925 299924 W
299924 299922 W
299922 299920 W
299920 2...

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #21:

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

input:

1
10
2 0
1 1
1 1
0 2
0 1
2 0
2 0
0 2
1 1
1 0

output:

Yes
9 7 W
7 6 W
6 1 W
1 3 W
2 10 W
5 8 B
8 4 B
4 9 B
3 2 B

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #22:

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

input:

398
588
2 0
1 1
0 2
0 2
1 1
2 0
2 0
0 2
1 1
0 2
2 0
2 0
1 1
0 2
1 1
2 0
2 0
1 1
1 1
0 2
0 2
1 1
1 1
2 0
2 0
1 1
1 1
1 1
1 1
1 1
2 0
1 1
2 0
1 1
0 2
1 1
2 0
2 0
1 1
1 1
2 0
1 1
1 1
0 2
0 2
1 1
2 0
0 2
2 0
2 0
1 1
1 1
2 0
2 0
1 1
0 2
2 0
0 2
1 1
2 0
1 1
0 2
0 2
1 1
0 2
0 2
2 0
1 1
2 0
0 2
0 2
1 1
1 1
...

output:

Yes
331 588 W
488 587 W
587 585 W
585 584 W
584 574 W
574 571 W
571 567 W
567 565 W
565 559 W
559 555 W
555 549 W
549 546 W
546 542 W
542 541 W
541 537 W
537 536 W
536 533 W
533 530 W
530 527 W
527 526 W
526 525 W
525 523 W
523 521 W
521 518 W
518 509 W
509 497 W
497 496 W
496 495 W
495 494 W
494 49...

result:

ok 398 'Yes' out of 398 cases (398 test cases)

Test #23:

score: 0
Accepted
time: 509ms
memory: 46908kb

input:

2
201114
2 0
2 0
0 2
0 2
1 1
1 1
0 2
0 2
0 2
0 2
1 1
1 1
1 1
1 1
0 2
0 2
0 2
1 1
1 1
0 2
0 2
1 1
0 2
0 2
1 1
1 1
2 0
1 1
0 2
1 1
2 0
0 2
0 2
0 2
2 0
2 0
0 2
1 1
2 0
0 2
1 1
1 1
1 1
0 2
0 2
2 0
0 2
0 2
1 1
1 1
0 2
0 2
0 2
0 2
0 2
2 0
1 1
1 1
0 2
1 1
0 2
1 1
0 2
0 2
1 1
2 0
0 2
1 1
1 1
1 1
2 0
1 1
0 2...

output:

Yes
93760 201105 W
196679 201102 W
201102 201100 W
201100 201099 W
201099 201098 W
201098 201095 W
201095 201094 W
201094 201093 W
201093 201088 W
201088 201084 W
201084 201073 W
201073 201068 W
201068 201067 W
201067 201066 W
201066 201065 W
201065 201060 W
201060 201059 W
201059 201049 W
201049 20...

result:

ok 2 'Yes' out of 2 cases (2 test cases)

Test #24:

score: 0
Accepted
time: 650ms
memory: 70340kb

input:

1
300000
2 1
3 0
1 0
1 2
0 1
0 1
2 1
0 1
0 1
3 0
1 0
1 0
1 2
1 2
1 2
2 1
3 0
2 1
0 3
0 1
0 1
0 1
1 2
1 2
1 2
2 1
2 1
0 1
0 3
0 3
0 1
1 2
0 3
0 1
1 0
0 3
0 1
2 1
1 0
2 1
2 1
0 1
1 0
1 0
2 1
2 1
0 1
1 0
1 2
1 2
1 2
2 1
0 1
2 1
3 0
1 0
1 2
1 0
3 0
1 0
2 1
1 0
1 0
0 1
0 3
1 2
1 0
2 1
1 0
2 1
0 1
3 0
1 0...

output:

Yes
3 299980 W
11 299969 W
12 299955 W
35 299943 W
39 299912 W
43 299911 W
44 299857 W
48 299854 W
56 299849 W
58 299830 W
60 299802 W
62 299786 W
63 299745 W
67 299736 W
69 299732 W
73 299714 W
76 299675 W
81 299645 W
85 299624 W
90 299621 W
94 299607 W
95 299567 W
97 299559 W
103 299551 W
105 2995...

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #25:

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

input:

1
30
0 1
3 0
1 2
1 0
0 1
2 0
2 1
1 0
2 1
0 3
3 0
1 0
1 0
1 2
0 1
0 1
1 0
1 0
0 1
0 1
1 0
0 2
1 2
1 2
1 2
0 1
3 0
1 2
1 2
1 0

output:

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

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #26:

score: 0
Accepted
time: 338ms
memory: 6176kb

input:

203
1480
2 1
1 2
2 1
1 2
0 3
2 1
1 0
1 0
1 0
0 1
1 2
1 2
0 1
0 3
1 0
1 0
2 1
1 2
1 2
0 1
1 2
1 0
0 1
2 1
2 1
0 1
0 1
0 1
2 1
2 1
1 0
1 0
1 0
1 0
0 1
1 0
1 0
2 1
2 1
2 1
1 2
1 2
1 0
0 1
1 2
0 1
0 1
2 1
2 1
0 1
1 2
2 1
1 2
3 0
3 0
1 0
1 2
2 1
1 0
1 0
0 1
2 1
1 0
2 1
1 0
0 1
1 0
1 0
1 0
1 0
2 1
1 0
0 1...

output:

Yes
7 1450 W
8 1426 W
9 1400 W
15 1399 W
16 1394 W
22 1393 W
31 1330 W
32 1322 W
33 1312 W
34 1284 W
36 1243 W
37 1226 W
43 1222 W
56 1216 W
59 1206 W
60 1198 W
63 1186 W
65 1167 W
67 1131 W
68 1094 W
69 1074 W
70 1037 W
72 1033 W
74 1026 W
77 1011 W
78 1008 W
82 995 W
84 987 W
86 951 W
88 950 W
91 ...

result:

ok 203 'Yes' out of 203 cases (203 test cases)

Test #27:

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

input:

2
168857
0 1
0 1
0 1
1 2
1 0
1 2
0 3
0 1
1 2
2 1
1 2
0 3
1 2
1 2
2 1
1 0
1 0
0 1
1 2
0 3
3 0
1 0
0 1
0 1
2 1
2 1
1 0
1 2
1 0
2 1
1 0
1 0
1 2
2 1
1 0
0 1
0 1
2 1
1 2
0 1
1 2
1 2
1 0
1 2
2 1
1 0
2 1
1 0
1 0
3 0
1 2
2 1
1 2
0 1
2 1
1 2
1 2
0 1
0 1
1 0
1 2
0 1
1 0
1 2
1 0
2 1
2 1
0 1
0 1
1 2
1 0
1 0
0 1...

output:

Yes
5 168850 W
16 168849 W
17 168843 W
22 168821 W
27 168761 W
29 168755 W
31 168750 W
32 168722 W
35 168668 W
43 168642 W
46 168566 W
48 168560 W
49 168553 W
60 168551 W
63 168550 W
65 168530 W
71 168509 W
72 168507 W
74 168490 W
77 168470 W
80 168467 W
86 168458 W
92 168436 W
100 168426 W
101 1684...

result:

ok 2 'Yes' out of 2 cases (2 test cases)

Test #28:

score: 0
Accepted
time: 675ms
memory: 67196kb

input:

1
300000
1 0
0 1
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
1 0
1 0
0 1
1 0
1 0
1 0
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
1 0
1 0
1 0
0 1
0 1
1 0
0 1
0 1
0 1
0 1
0 1
1 0
1 0
0 1
0 1
0 1
1 0
1 0
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
0 1
1 0
1 0
0 1
0 1
0 1
1 0
1 0
1 0
0 1
0 1
0 1
0 1
0 1
0 1
1 0
0 1
0 1
0 1
0 1...

output:

Yes
1 237601 W
4 237601 W
5 237601 W
6 237601 W
8 237601 W
9 237601 W
12 237601 W
13 237601 W
15 237601 W
16 237601 W
17 237601 W
27 237601 W
28 237601 W
29 237601 W
32 237601 W
38 237601 W
39 237601 W
43 237601 W
44 237601 W
45 237601 W
47 237601 W
50 237601 W
51 237601 W
52 237601 W
55 237601 W
56...

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #29:

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

input:

1
20
1 0
0 1
1 0
1 0
0 1
1 0
0 1
1 0
0 1
1 0
0 1
1 0
1 0
12 7
1 0
1 0
0 1
0 1
1 0
1 0

output:

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

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #30:

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

input:

400
598
1 0
0 1
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
0 1
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
0 1
1 0
1 0
0 1
1 0
0 1
1 0
0 1
1 0
1 0
1 0
1 0
1 0
0 1
1 0
0 1
0 1
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
0 1
0 1
0 1
1 0
1 0
1 0
0 1
1 0
0 1
0 1
0 1
1 0
...

output:

Yes
1 474 W
5 474 W
6 474 W
7 474 W
8 474 W
9 474 W
10 474 W
11 474 W
14 474 W
15 474 W
18 474 W
21 474 W
22 474 W
23 474 W
26 474 W
27 474 W
28 474 W
29 474 W
34 474 W
35 474 W
37 474 W
39 474 W
41 474 W
42 474 W
43 474 W
44 474 W
45 474 W
47 474 W
50 474 W
51 474 W
53 474 W
54 474 W
58 474 W
60 47...

result:

ok 400 'Yes' out of 400 cases (400 test cases)

Test #31:

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

input:

4
59759
0 1
1 0
0 1
0 1
0 1
1 0
0 1
0 1
0 1
1 0
1 0
1 0
0 1
1 0
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
1 0
0 1
1 0
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
0 1
0 1
1 0
0 1
0 1
0 1
0 1
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
0 1
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
0 1
0 1
1 0
...

output:

Yes
2 28143 W
6 28143 W
10 28143 W
11 28143 W
12 28143 W
14 28143 W
20 28143 W
22 28143 W
23 28143 W
24 28143 W
25 28143 W
27 28143 W
29 28143 W
31 28143 W
33 28143 W
34 28143 W
35 28143 W
37 28143 W
40 28143 W
46 28143 W
47 28143 W
51 28143 W
53 28143 W
54 28143 W
55 28143 W
57 28143 W
61 28143 W
6...

result:

ok 4 'Yes' out of 4 cases (4 test cases)

Test #32:

score: 0
Accepted
time: 305ms
memory: 5908kb

input:

396
985
2 1
1 0
1 2
0 3
0 1
2 1
0 3
2 1
0 1
0 3
3 0
0 1
3 0
2 1
1 0
1 0
0 1
1 0
1 0
1 2
0 1
1 0
1 2
0 1
2 1
3 0
1 0
1 2
1 2
2 1
1 0
2 1
0 1
0 1
1 2
1 0
1 2
1 2
1 2
3 0
1 2
2 1
1 0
0 3
2 1
1 2
0 1
1 2
1 0
1 2
1 0
0 1
1 0
1 2
0 1
2 1
2 1
3 0
0 3
2 1
0 1
1 2
1 2
0 1
0 1
2 1
1 2
0 1
0 1
0 1
0 1
2 1
3 0
...

output:

Yes
2 973 W
15 969 W
16 958 W
18 954 W
19 949 W
22 919 W
27 900 W
31 880 W
36 820 W
43 800 W
49 797 W
51 770 W
53 767 W
74 735 W
75 720 W
80 706 W
83 688 W
89 655 W
91 632 W
92 630 W
98 611 W
99 605 W
111 581 W
115 578 W
117 555 W
125 554 W
129 516 W
130 504 W
132 495 W
134 484 W
136 472 W
137 463 W...

result:

ok 396 'Yes' out of 396 cases (396 test cases)

Test #33:

score: 0
Accepted
time: 353ms
memory: 7736kb

input:

4011
76
1 1
0 2
2 0
1 1
1 1
1 1
2 0
1 1
1 1
1 1
1 1
1 1
1 1
0 2
2 0
2 0
1 1
2 0
0 2
2 0
2 0
1 0
0 1
2 0
1 1
0 2
1 1
2 0
1 1
1 1
2 0
0 2
2 0
0 2
1 1
1 1
2 0
2 0
0 2
0 2
1 1
1 1
0 2
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
0 2
1 1
2 0
1 1
1 1
0 2
2 0
2 0
2 0
1 1
2 0
1 1
1 1
2 0
1 1
2 0
1 1
2 0
0 2
0 2
1 1
0 2
...

output:

Yes
22 76 W
74 75 W
75 69 W
69 67 W
67 65 W
65 62 W
62 60 W
60 59 W
59 58 W
58 54 W
54 38 W
38 37 W
37 33 W
33 31 W
31 28 W
28 24 W
24 21 W
21 20 W
20 18 W
18 16 W
16 15 W
15 7 W
7 3 W
3 72 W
68 66 W
64 63 W
61 56 W
55 53 W
51 50 W
49 48 W
47 46 W
45 44 W
42 41 W
36 35 W
30 29 W
27 25 W
17 13 W
12 1...

result:

ok 4005 'Yes' out of 4011 cases (4011 test cases)

Test #34:

score: 0
Accepted
time: 45ms
memory: 5876kb

input:

300000
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0
1
0 0...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 300000 'Yes' out of 300000 cases (300000 test cases)

Test #35:

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

input:

14
9
0 1
3 2
0 1
1 1
0 1
0 1
1 0
1 2
0 1
5
1 0
2 1
1 0
0 2
0 1
10
0 2
1 0
1 1
0 2
0 2
1 1
1 2
2 0
0 1
0 1
9
0 1
1 0
2 1
1 3
1 0
0 1
1 0
0 2
2 0
6
0 1
2 2
1 0
1 0
2 0
0 1
7
0 1
0 2
1 0
1 1
0 3
0 2
0 1
10
0 1
0 1
1 0
2 1
1 3
0 2
1 1
0 1
0 2
1 0
7
0 2
0 1
0 2
0 2
0 1
0 2
0 2
6
1 0
1 1
0 1
0 1
1 1
3 0
9...

output:

Yes
7 2 W
8 2 W
2 4 W
1 2 B
3 8 B
5 2 B
6 8 B
4 9 B
Yes
1 2 W
3 2 W
2 4 B
4 5 B
Yes
2 8 W
8 7 W
6 3 W
9 7 B
7 5 B
5 4 B
4 1 B
1 6 B
3 10 B
Yes
2 3 W
5 9 W
7 4 W
3 9 W
1 4 B
6 4 B
4 8 B
8 3 B
Yes
3 2 W
4 5 W
5 2 W
1 2 B
2 6 B
Yes
3 4 W
1 5 B
4 6 B
6 5 B
5 2 B
2 7 B
Yes
3 4 W
7 5 W
4 10 W
1 5 B
2 5 B
...

result:

ok 14 'Yes' out of 14 cases (14 test cases)

Test #36:

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

input:

1328
7
1 1
2 1
0 1
1 1
1 1
0 1
1 0
6
2 0
1 1
1 0
0 1
0 3
0 1
8
2 2
1 0
1 1
1 0
1 0
1 0
0 2
1 1
9
2 0
0 1
1 0
1 4
0 1
0 1
1 0
1 0
2 1
7
2 0
1 0
1 1
1 1
1 0
1 0
3 0
9
0 1
1 1
2 2
0 1
1 0
0 1
1 0
1 0
2 2
10
1 1
1 1
0 3
0 1
1 0
1 1
2 1
1 0
2 0
1 0
8
0 1
1 0
0 2
2 0
0 1
0 1
2 2
1 1
9
1 3
2 1
0 2
0 2
1 0
...

output:

Yes
5 2 W
2 4 W
1 7 W
3 2 B
6 5 B
4 1 B
Yes
3 1 W
1 2 W
2 5 B
4 5 B
5 6 B
Yes
2 1 W
4 1 W
5 8 W
6 3 W
3 7 B
7 1 B
1 8 B
Yes
3 9 W
7 1 W
1 9 W
8 4 W
2 4 B
5 4 B
6 4 B
4 9 B
Yes
2 7 W
5 7 W
6 1 W
1 4 W
3 7 W
4 3 B
Yes
5 9 W
7 3 W
3 9 W
8 2 W
1 9 B
4 3 B
6 3 B
2 9 B
Yes
5 7 W
8 9 W
9 7 W
6 2 W
1 10 W
4...

result:

ok 1328 'Yes' out of 1328 cases (1328 test cases)

Test #37:

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

input:

666
10
2 2
1 0
1 2
1 0
0 1
1 1
0 1
1 2
0 1
1 0
12
1 1
0 1
0 1
2 0
1 0
1 0
2 1
0 1
1 1
1 1
2 1
1 2
11
0 1
0 3
0 1
0 1
1 0
1 0
0 1
2 2
1 0
1 0
2 3
10
0 1
2 0
1 1
1 1
2 0
1 0
1 0
0 1
2 1
2 1
16
1 1
0 1
0 1
1 0
1 1
1 0
1 3
1 0
0 3
0 1
2 0
1 2
2 1
1 2
0 1
0 1
18
1 0
1 0
0 1
1 1
0 1
2 0
2 0
0 1
2 0
2 2
1 ...

output:

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

result:

ok 666 'Yes' out of 666 cases (666 test cases)

Test #38:

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

input:

13385
12
1 0
1 0
1 1
1 0
3 0
2 1
1 0
1 0
2 0
1 0
3 2
1 0
15
1 2
0 2
1 1
1 1
1 0
1 0
1 1
0 1
4 1
0 2
1 1
1 0
1 0
1 1
0 1
18
0 1
1 0
0 1
1 0
1 1
2 1
1 0
0 1
2 0
1 1
1 2
0 1
0 1
1 1
1 1
1 4
1 1
0 3
18
1 1
1 2
0 1
1 0
0 1
0 2
0 1
0 1
1 0
1 2
1 2
1 1
1 3
0 1
0 1
0 2
0 1
2 2
10
1 0
1 0
1 1
0 2
1 0
0 2
1 0...

output:

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

result:

ok 13385 'Yes' out of 13385 cases (13385 test cases)

Test #39:

score: 0
Accepted
time: 273ms
memory: 5752kb

input:

19978
10
3 1
0 1
2 0
1 1
1 2
0 1
1 0
1 0
2 0
1 0
20
2 0
2 1
1 0
2 1
0 3
1 0
1 1
1 1
0 1
0 1
1 0
1 0
3 1
2 1
2 1
1 0
1 1
0 1
0 1
1 1
17
0 1
1 0
0 2
1 1
1 0
1 1
1 0
0 3
0 2
2 0
2 0
1 1
1 2
1 0
3 1
0 1
1 1
10
1 4
1 0
0 2
0 1
1 0
0 1
0 1
1 2
0 1
0 2
11
0 1
0 3
0 1
1 1
0 1
0 1
1 3
1 1
0 2
0 1
1 1
17
1 0
...

output:

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

result:

ok 19978 'Yes' out of 19978 cases (19978 test cases)

Test #40:

score: 0
Accepted
time: 679ms
memory: 43296kb

input:

2
169106
1 0
2 0
1 2
0 2
3 1
0 1
0 1
0 1
1 0
0 1
3 1
2 1
1 0
1 0
0 1
1 0
1 1
0 1
1 1
0 1
1 2
1 1
4 4
0 1
1 0
0 1
1 0
1 0
0 1
0 1
1 0
0 1
3 0
0 1
1 0
1 3
3 0
1 1
2 3
0 1
1 0
1 0
5 2
0 1
1 0
0 1
1 0
1 1
0 1
1 0
2 1
0 1
1 3
2 1
0 1
3 3
1 1
1 1
2 1
0 1
0 1
1 0
0 1
1 1
2 0
0 1
1 0
1 0
0 1
1 1
2 2
1 1
1 0...

output:

Yes
1 83947 W
9 42564 W
13 85243 W
14 83947 W
16 26304 W
25 129822 W
27 94831 W
28 90140 W
31 42564 W
35 67201 W
41 147493 W
42 136806 W
45 85243 W
47 30219 W
50 32795 W
62 138058 W
67 83947 W
68 29628 W
73 26304 W
78 129822 W
80 128494 W
86 94831 W
87 43995 W
88 36649 W
89 7639 W
92 135682 W
95 101...

result:

ok 2 'Yes' out of 2 cases (2 test cases)

Test #41:

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

input:

4
50069
1 1
1 1
2 1
0 1
1 0
2 0
0 1
2 0
1 1
1 0
0 1
2 2
1 0
1 0
0 2
1 0
1 0
3 0
1 0
0 3
1 1
1 0
1 3
1 3
0 1
0 1
0 1
0 1
0 3
0 1
1 0
1 0
0 1
0 1
1 0
1 1
1 0
1 0
0 1
0 1
1 0
2 0
2 2
4 1
1 0
1 4
1 0
2 1
1 1
1 1
0 1
1 0
0 2
1 1
0 1
1 0
3 2
1 2
1 0
0 2
0 2
1 1
2 0
1 0
1 0
1 0
1 0
0 2
0 1
1 2
1 1
0 1
0 2
...

output:

Yes
5 18408 W
10 44606 W
13 18408 W
14 48889 W
16 21551 W
17 16868 W
19 24075 W
22 44606 W
31 18408 W
32 7216 W
35 25999 W
37 29350 W
38 14362 W
41 3794 W
45 12016 W
47 3770 W
52 48889 W
56 23013 W
59 21551 W
64 16868 W
65 12122 W
66 48175 W
67 24075 W
83 12804 W
86 8217 W
92 14889 W
94 44606 W
96 1...

result:

ok 4 'Yes' out of 4 cases (4 test cases)

Test #42:

score: 0
Accepted
time: 522ms
memory: 10144kb

input:

20
18335
0 1
1 2
1 0
0 2
0 3
0 1
1 0
0 1
1 1
1 2
1 2
1 2
1 2
1 1
0 1
1 0
2 0
0 1
1 3
1 0
1 2
0 1
1 0
1 1
2 1
0 1
1 1
1 3
1 3
3 1
2 0
0 1
2 0
1 2
1 0
3 1
1 0
2 1
1 3
1 0
1 0
5 5
1 0
1 0
2 1
0 1
2 5
0 1
1 0
2 1
1 0
1 1
2 3
0 1
0 2
4 1
1 0
0 1
0 1
0 1
2 1
0 1
0 1
2 0
1 0
0 4
1 1
1 0
1 0
1 0
1 0
0 2
0 1...

output:

Yes
3 3318 W
7 6911 W
16 12380 W
20 11760 W
23 3318 W
35 14260 W
37 14905 W
40 3135 W
41 2894 W
43 17302 W
44 15513 W
49 13761 W
51 11403 W
57 6911 W
65 2878 W
68 16344 W
69 14284 W
70 13933 W
71 12380 W
85 10271 W
88 7118 W
90 5376 W
92 17288 W
94 13614 W
109 15731 W
111 11947 W
114 11760 W
129 633...

result:

ok 20 'Yes' out of 20 cases (20 test cases)

Test #43:

score: 0
Accepted
time: 743ms
memory: 69844kb

input:

1
300000
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0...

output:

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

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #44:

score: 0
Accepted
time: 703ms
memory: 66704kb

input:

1
300000
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1...

output:

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

result:

ok 1 'Yes' out of 1 cases (1 test case)

Test #45:

score: 0
Accepted
time: 640ms
memory: 66468kb

input:

1
300000
1 0
1 0
1 0
0 1
1 0
0 1
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
0 1
0 1
1 0
0 1
0 1
1 0
0 1
1 0
0 1
1 0
1 0
0 1
1 0
0 1
1 0
0 1
0 1
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
1 0
0 1
0 1
0 1
0 1
1 0
0 1
0 1
0 1
1 0
0 1
0 1
0 1
0 1
1 0
1 0
0 1
0 1
1 0
0 1
1 0
0 1
1 0
1 0
0 1
0 1
1 0
0 1
0 1
0 1
1 0
1 0
0 1...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #46:

score: 0
Accepted
time: 246ms
memory: 68188kb

input:

1
300000
1 0
0 1
0 1
0 1
1 0
0 1
0 1
0 1
1 0
1 0
0 1
0 1
1 0
0 1
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
0 1
1 0
0 1
1 0
1 0
1 0
1 0
1 0
1 0
0 1
1 0
0 1
1 0
0 1
1 0
1 0
0 1
0 1
0 1
1 0
1 0
0 1
1 0
0 1
0 1
1 0
1 0
0 1
0 1
1 0
0 1
0 1
0 1
1 0
0 1
0 1
0 1
0 1
0 1
1 0
1 0
1 0
0 1
0 1
1 0
0 1
0 1
0 1
1 0
1 0
0 1...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #47:

score: 0
Accepted
time: 644ms
memory: 66452kb

input:

1
300000
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
0 1
0 1
0 1
1 0
1 0
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
1 0
0 1
1 0
0 1
0 1
1 0
0 1
0 1
0 1
0 1
0 1
1 0
0 1
0 1
1 0
0 1
1 0
0 1
0 1
1 0
0 1
0 1
1 0
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
0 1
0 1
0 1
1 0
1 0
1 0
0 1
1 0
1 0
1 0
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
1 0...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #48:

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

input:

405
524
0 1
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
0 1
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
1 0
1 0
1 0
0 1
0 1
7 4
0 1
0 1
0 1
1 0
1 0
1 0
1 0
1 0
0 1
1 0
1 0
1 0
1 0
1 0
0 1
0 1
1 0
0 1
0 1
50 15
0 1
0 1
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
0 1
1 0
1 0
0 1
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 7 'Yes' out of 405 cases (405 test cases)

Test #49:

score: 0
Accepted
time: 145ms
memory: 5864kb

input:

3997
67
1 0
1 0
1 1
0 1
0 1
0 1
0 1
0 1
1 0
0 1
0 1
2 2
1 0
0 1
0 1
1 0
1 0
0 1
0 1
0 1
0 1
1 0
0 1
0 1
0 1
0 1
1 0
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
1 0
2 0
0 1
3 6
0 1
0 1
0 1
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
1 0
0 1
7 17
1 0
1 0
1 0
28 2
0 1
1 0
0 1
0 1
1 0
0 1
95
1 0
1 0
3 2
0 1
1 0...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
4 17 W
5 17 W
6 17 W
7 17 W
9 17 W
13 17 W
14 17 W
18 17 W
19 17 W
21 17 W
22 17 W
24 17 W
27 17 W
30 17 W
33 17 W
35 17 W
36 17 W
37 71 W
38 17 W
39 71 W
40 17 W
42 71 W
43 17 W
44 71 W
46 17 W
49 71 W
50 17 W
51 71 W
53 17 W
62 71 W
65 17 W
67 84...

result:

ok 315 'Yes' out of 3997 cases (3997 test cases)

Test #50:

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

input:

4025
67
1 0
1 0
1 0
1 0
1 0
1 0
1 0
8 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
5 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
23 0
1 0
1 0
1 0
1 0
18 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
3 0
1 0
12 0
1 0
1 0
1 0
1 0
1 0
1 0
3 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
54
1 0
1 0
1 0
1 0
1 ...

output:

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

result:

ok 4025 'Yes' out of 4025 cases (4025 test cases)

Test #51:

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

input:

2011
179
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 2
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 79
0 1
0 1
0 1
0 1
0 2
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 ...

output:

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

result:

ok 2011 'Yes' out of 2011 cases (2011 test cases)

Test #52:

score: 0
Accepted
time: 785ms
memory: 67056kb

input:

1
300000
262675 267778
43279 175147
121184 171593
235566 120418
140167 34601
89828 129090
207278 255877
133629 104994
212162 130149
83462 37339
148883 251891
223122 247624
293652 14655
19958 103437
210431 168892
283885 28109
14352 277760
241524 6771
236581 156296
56271 145418
290148 77745
36067 2884...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #53:

score: 0
Accepted
time: 277ms
memory: 67172kb

input:

1
300000
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 299999
299999 2999...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #54:

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

input:

1
300000
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #55:

score: 0
Accepted
time: 1055ms
memory: 67704kb

input:

1
300000
15000 20784
9103 22377
3737 17620
16793 26158
26669 6007
3319 8421
1424 2350
16536 887
22865 14935
12957 22768
5477 5775
1645 29025
13797 25593
25601 9393
4220 24398
21672 12615
24074 15096
6949 29842
25668 19365
12044 4146
15489 5754
9384 22716
10174 6574
7080 8137
7435 5370
11054 14615
15...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #56:

score: 0
Accepted
time: 1039ms
memory: 70028kb

input:

1
300000
1971 2294
2945 25
2868 2904
2843 2105
1769 1096
364 1934
2566 2049
2091 2052
2939 2912
1617 436
1156 1737
1252 306
2127 1786
1397 1871
2201 1951
138 2728
1674 980
757 2253
2468 686
2506 2171
2176 1155
581 1435
2681 1980
722 1864
2190 1522
1987 941
700 1159
574 1277
1379 1449
1668 2353
1028 ...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #57:

score: 0
Accepted
time: 874ms
memory: 67044kb

input:

1
300000
101 248
255 37
168 55
278 215
21 288
117 230
226 98
129 93
289 138
220 65
11 265
38 172
152 177
46 81
270 187
35 182
82 32
31 53
261 23
87 115
45 33
189 112
285 197
21 117
104 28
289 60
107 298
140 40
114 147
295 230
279 67
99 161
131 250
28 215
180 213
21 178
125 60
114 116
264 22
177 243
...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #58:

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

input:

4009
59
1 1
0 0
2 1
1 0
2 0
2 2
2 1
0 0
2 1
1 2
0 1
2 1
1 2
1 1
1 0
1 0
0 1
2 2
0 1
1 1
0 2
2 0
0 2
2 2
1 1
2 2
0 1
0 1
0 1
2 1
2 1
1 1
2 2
0 2
0 2
2 2
0 0
0 0
0 2
2 0
0 2
2 2
0 0
1 1
1 0
2 0
0 0
0 2
2 1
2 2
1 1
2 2
1 2
2 1
2 2
1 1
2 0
1 0
2 0
63
2 0
2 0
3 2
0 0
0 1
1 1
3 0
0 3
2 1
1 1
3 3
0 0
2 1
0...

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 0 'Yes' out of 4009 cases (4009 test cases)

Test #59:

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

input:

4020
93
3 71
14 80
80 47
2 10
50 21
78 59
12 61
63 28
7 59
61 6
90 45
56 51
73 24
65 40
65 61
41 43
67 54
72 92
80 12
56 40
7 11
79 75
61 74
8 52
34 88
56 49
24 50
78 85
16 20
15 24
56 49
2 77
34 90
43 70
84 90
70 25
58 69
74 46
83 14
55 56
17 25
82 47
62 82
51 5
81 29
3 36
74 70
64 48
86 19
40 21
3...

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 0 'Yes' out of 4020 cases (4020 test cases)

Test #60:

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

input:

397
602
0 2
0 1
0 4
6 2
6 3
2 3
6 6
5 4
2 1
2 1
6 0
5 0
5 2
0 4
5 3
4 0
5 1
2 1
4 0
3 1
4 2
1 6
0 4
6 1
2 4
2 2
5 1
3 2
4 5
1 4
5 5
0 6
0 6
1 2
5 5
1 4
2 6
4 5
5 5
3 6
2 1
4 2
0 6
4 1
0 2
3 2
2 2
1 2
4 1
6 0
3 4
1 3
0 0
0 6
1 6
2 4
0 4
3 6
5 1
6 0
4 0
6 1
6 1
2 1
6 0
4 3
1 1
0 5
0 3
1 1
5 1
4 1
1 2
...

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 0 'Yes' out of 397 cases (397 test cases)

Test #61:

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

input:

1
300000
1 0
1 0
218829 0
1 0
1 0
248591 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
158281 0
56375 0
1 0
297030 0
1 0
132934 0
148635 0
72063 0
289146 0
1 0
99680 0
206100 0
1 0
8954 0
1 0
1 0
203542 0
1 0
1 0
25207 0
1 0
140934 0
123070 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
83312 0
1 0
179468 0
...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #62:

score: 0
Accepted
time: 314ms
memory: 66468kb

input:

1
300000
0 1
0 1
0 159896
0 1
0 1
0 1
0 20309
0 94091
0 1
0 1
0 1
0 1
0 1
0 112999
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 289698
0 103394
0 1
0 1
0 1
0 182667
0 1
0 105865
0 1
0 1
0 1
0 1
0 1
0 73965
0 1
0 1
0 1
0 1
0 1
0 1
0 43984
0 1
0 1
0 1
0 1
0...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)

Test #63:

score: 0
Accepted
time: 399ms
memory: 66948kb

input:

1
300000
1 0
1 0
1 0
1 0
1 0
51149 244943
54973 75789
0 1
1 0
1 0
0 1
0 1
1 0
7269 32589
0 1
1 0
0 1
1 0
1 0
0 1
1 0
1 0
120809 2039
1 0
0 1
0 1
0 1
1 0
150396 127250
0 1
1 0
0 1
1 0
0 1
1 0
1 0
10042 10308
1 0
0 1
1 0
1 0
110349 107052
0 1
0 1
0 1
1 0
1 0
0 1
0 1
100403 74129
0 1
1 0
0 1
0 1
1 0
1 ...

output:

No

result:

ok 0 'Yes' out of 1 cases (1 test case)