QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#374942#7640. Colorful Cyclesliuzhenhao09#TL 810ms249468kbC++201.9kb2024-04-02 19:45:142024-04-02 19:45:16

Judging History

你现在查看的是测评时间为 2024-04-02 19:45:16 的历史记录

  • [2024-10-14 08:06:03]
  • 管理员手动重测本题所有获得100分的提交记录
  • 测评结果:TL
  • 用时:823ms
  • 内存:267084kb
  • [2024-07-04 22:58:32]
  • hack成功,自动添加数据
  • (/hack/728)
  • [2024-04-02 19:45:16]
  • 评测
  • 测评结果:100
  • 用时:810ms
  • 内存:249468kb
  • [2024-04-02 19:45:14]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
struct edge{
	int to,nxt,w;
}e[2000010];
int T,n,m,nE = 0,timer = 0,tp = 0,rt,oo = 0;
int hd[2000010],dfn[2000010],low[2000010],stk[2000010];
vector<int>ans[2000010];
int id[2000010];
void add(int u,int v,int w){
	e[++nE] = (edge){v,hd[u],w};
	hd[u] = nE;
}
void tarjan(int u){
	dfn[u] = low[u] = ++timer;
	stk[++tp] = u;
	if(u == rt && !hd[u]){
		ans[++oo].push_back(u);
		return;
	}
	for(int i = hd[u]; i; i = e[i].nxt){
		int v = e[i].to;
		if(!dfn[v]){
			tarjan(v);
			low[u] = min(low[u],low[v]);
			if(low[v] >= dfn[u]){
				oo++;
				int z;
				do{
					z = stk[tp--];
					ans[oo].push_back(z);
				}
				while(z != v);
				ans[oo].push_back(u);
			}
		}
		else low[u] = min(low[u],dfn[v]);
	}
}
int col[2000010];
signed main(){
	scanf("%lld",&T);
	int tt = 0;
	while(T--){
		tt++;
		for(int i = 1; i <= oo; i++) ans[i].clear();
		oo = 0;
		nE = 0;
		scanf("%lld %lld",&n,&m);
		for(int i = 1; i <= n; i++) hd[i] = dfn[i] = low[i] = id[i] = col[i] = 0;
		for(int i = 1,u,v,w; i <= m; i++){
			scanf("%lld %lld %lld",&u,&v,&w),add(u,v,w),add(v,u,w);
		}
		timer = 0;
		for(int i = 1; i <= n; i++) if(!dfn[i]) tp = 0,rt = i,tarjan(i);
		bool flag = 0;
		for(int u = 1; u <= oo; u++){
			int cnt[4];
			cnt[0] = cnt[1] = cnt[2] = cnt[3] = 0;
			for(auto v : ans[u]) id[v] = u,col[v] = -1;
			int cc = 0;
			set<int>s;
			for(auto v : ans[u]){
				for(int i = hd[v]; i; i = e[i].nxt){
					int vv = e[i].to,w = e[i].w;
					if(id[vv] != u) continue;
					cnt[w]++;
					if(col[v] == -1) col[v] = w;
					else if(col[v] != w) s.insert(v);
					if(col[vv] == -1) col[vv] = w;
					else if(col[vv] != w) s.insert(vv);
				}
			}
			if((int)(s.size()) >= 3 && cnt[1] && cnt[2] && cnt[3]) flag = 1;
		}
		puts(flag ? "Yes" : "No");
	}
 	return 0;
}
 

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 15972kb

input:

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

output:

Yes
No

result:

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

Test #2:

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

input:

100000
7 10
7 2 2
6 4 2
6 1 2
7 1 3
3 4 1
6 7 1
2 6 3
3 1 2
5 3 1
2 1 1
7 10
5 7 3
7 1 1
4 6 3
6 3 1
3 4 3
4 2 2
3 2 3
1 3 3
3 7 1
1 4 2
7 10
5 6 3
3 5 2
7 2 3
7 3 3
1 2 2
4 3 2
7 4 2
6 1 2
2 6 1
7 5 2
7 10
7 1 3
7 5 3
6 4 1
7 6 1
1 4 1
3 4 2
2 7 2
1 3 1
3 5 3
5 1 3
7 10
6 7 2
3 4 3
1 4 2
5 3 2
7 4 ...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
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
No
...

result:

ok 100000 token(s): yes count is 92314, no count is 7686

Test #3:

score: 0
Accepted
time: 157ms
memory: 15948kb

input:

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

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
No
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
No
Yes
Yes
Yes
Yes
Ye...

result:

ok 50000 token(s): yes count is 49364, no count is 636

Test #4:

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

input:

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

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 50000 token(s): yes count is 49941, no count is 59

Test #5:

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

input:

1000
200 1000
42 68 2
101 170 2
79 159 2
65 106 3
82 28 2
92 196 3
28 37 1
5 103 1
93 183 1
117 119 3
48 127 3
139 70 2
68 100 2
95 104 1
123 134 1
65 142 2
54 69 3
45 63 1
38 60 3
142 130 2
117 36 3
43 89 2
41 143 2
49 47 1
91 130 2
151 7 1
194 149 1
24 85 2
157 41 2
177 132 2
145 40 3
124 138 2
11...

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 1000 token(s): yes count is 1000, no count is 0

Test #6:

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

input:

1000
400 1000
372 17 2
321 365 2
357 136 3
185 231 1
359 328 1
142 164 1
75 280 2
55 6 2
37 329 3
259 302 3
222 304 3
70 130 1
114 120 2
314 291 1
396 41 2
77 111 2
35 275 3
348 145 3
346 2 2
351 158 2
173 172 2
68 122 1
147 11 3
160 391 1
30 360 2
120 174 3
145 296 3
170 311 1
107 313 1
282 211 1
3...

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 1000 token(s): yes count is 1000, no count is 0

Test #7:

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

input:

1000
400 1000
372 17 2
321 365 2
357 136 2
185 231 2
359 328 2
142 164 2
75 280 2
55 6 1
37 329 1
259 302 2
222 304 2
70 130 2
114 120 2
314 291 1
396 41 2
77 111 2
35 275 2
348 145 1
346 2 1
351 158 1
173 172 1
68 122 1
147 11 1
160 391 2
30 360 1
120 174 2
145 296 2
170 311 2
107 313 1
282 211 1
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 1000 token(s): yes count is 0, no count is 1000

Test #8:

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

input:

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

output:

No

result:

ok NO

Test #9:

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

input:

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

output:

No

result:

ok NO

Test #10:

score: 0
Accepted
time: 15ms
memory: 23924kb

input:

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

output:

No

result:

ok NO

Test #11:

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

input:

1
50002 80241
41804 9985 3
41015 531 1
32475 43357 1
27804 45331 1
37830 10818 1
9140 8762 1
3221 23343 3
28197 44388 3
12185 41625 1
44450 9756 2
38350 14775 1
9757 19481 1
20858 17104 1
7807 24256 3
32044 37846 3
46885 27385 1
39738 9906 1
44158 35304 3
16289 43980 2
23066 24757 1
42969 19561 3
46...

output:

No

result:

ok NO

Test #12:

score: 0
Accepted
time: 337ms
memory: 97064kb

input:

1
455002 812001
313782 211383 2
408674 310967 1
3243 335360 3
401421 177274 3
308321 237341 2
96981 83503 3
72406 169080 3
33154 273727 1
213486 241588 3
45112 90708 1
445073 252383 1
337069 283893 1
183445 167972 1
147552 226440 1
139659 55742 3
237507 63881 1
315650 309664 1
25601 309502 3
103898 ...

output:

No

result:

ok NO

Test #13:

score: 0
Accepted
time: 434ms
memory: 108988kb

input:

1
550002 960001
457067 193767 1
342478 12620 1
457744 335514 1
539768 376061 1
138263 362120 3
470645 351694 2
378812 275543 3
433382 61920 3
80042 190753 1
416842 239041 3
210707 333641 1
136495 292903 3
231177 488035 1
161882 335528 1
109575 231095 1
460301 391728 1
482079 202050 1
267924 42252 1
...

output:

No

result:

ok NO

Test #14:

score: 0
Accepted
time: 374ms
memory: 98452kb

input:

1
460002 920000
320036 139429 1
135428 96743 3
275092 149008 3
209374 131707 1
209240 89841 1
233222 421629 2
299800 140778 1
23130 393279 2
238254 172231 3
357686 310469 1
150177 271638 1
243817 405084 1
6505 215324 3
209374 58689 1
76592 261906 1
212083 19077 3
166663 198182 3
315013 269131 1
4783...

output:

No

result:

ok NO

Test #15:

score: 0
Accepted
time: 376ms
memory: 96932kb

input:

1
460002 920001
320036 139429 1
135428 96743 3
275092 149008 3
209374 131707 1
209240 89841 1
233222 421629 2
299800 140778 1
23130 393279 2
238254 172231 3
357686 310469 1
150177 271638 1
243817 405084 1
6505 215324 3
209374 58689 1
76592 261906 1
212083 19077 3
166663 198182 3
315013 269131 1
4783...

output:

No

result:

ok NO

Test #16:

score: 0
Accepted
time: 328ms
memory: 58548kb

input:

1
46002 812001
35705 43426 3
34108 16494 1
41906 23632 2
10383 38713 3
21287 376 1
19192 42771 1
12929 39593 3
12445 41713 3
40539 10156 3
34068 1475 1
43112 27026 3
4848 22576 3
8555 27001 2
18061 591 2
9393 8636 2
11566 107 1
34515 38738 2
14051 30826 1
7051 21119 1
34094 44258 1
5265 26902 3
1810...

output:

No

result:

ok NO

Test #17:

score: 0
Accepted
time: 495ms
memory: 137484kb

input:

1
950002 973221
432170 467373 1
313927 855724 1
535785 39167 3
511760 195368 1
540939 494584 1
675511 477904 2
749903 47829 1
815904 545905 2
234727 419470 1
471623 27706 1
733030 871395 3
367265 853892 1
713692 137647 3
517373 864580 1
173098 514005 1
603460 439442 3
252197 936650 3
696344 701263 1...

output:

No

result:

ok NO

Test #18:

score: 0
Accepted
time: 339ms
memory: 100320kb

input:

1
305002 900601
234230 166160 3
26402 110441 1
260382 269800 2
71590 126859 3
86708 36255 3
62480 159002 1
254009 163584 2
99193 162990 2
216761 86741 1
132905 69651 3
107697 116171 3
167683 282132 1
245344 138538 2
95489 203036 3
123220 46895 3
6670 298595 1
207696 204780 3
213024 50207 3
203048 92...

output:

No

result:

ok NO

Test #19:

score: 0
Accepted
time: 335ms
memory: 93504kb

input:

1
305002 900602
234230 166160 3
26402 110441 1
260382 269800 2
71590 126859 3
86708 36255 3
62480 159002 1
254009 163584 2
99193 162990 2
216761 86741 1
132905 69651 3
107697 116171 3
167683 282132 1
245344 138538 2
95489 203036 3
123220 46895 3
6670 298595 1
207696 204780 3
213024 50207 3
203048 92...

output:

Yes

result:

ok YES

Test #20:

score: 0
Accepted
time: 377ms
memory: 100916kb

input:

1
500002 960002
113869 183432 2
196294 70838 2
67872 28519 2
382076 338251 1
18718 488743 1
328776 158876 3
84117 128660 3
129467 430532 3
290609 332064 2
107282 269274 2
86300 34853 1
298735 297069 3
417810 452318 3
484522 443788 2
192609 424418 1
340205 391642 1
301144 412588 1
394805 82253 1
4832...

output:

Yes

result:

ok YES

Test #21:

score: 0
Accepted
time: 405ms
memory: 103916kb

input:

1
500002 960002
113869 183432 2
196294 70838 2
67872 28519 3
382076 338251 1
18718 488743 1
328776 158876 3
84117 128660 3
129467 430532 3
290609 332064 2
107282 269274 3
86300 34853 1
298735 297069 3
417810 452318 3
484522 443788 3
192609 424418 1
340205 391642 1
301144 412588 1
394805 82253 1
4832...

output:

Yes

result:

ok YES

Test #22:

score: 0
Accepted
time: 442ms
memory: 100512kb

input:

1
365002 990026
297221 169644 2
324790 294481 1
311368 259468 1
68680 63215 1
293803 83376 1
189253 264951 2
15264 357829 2
233472 175890 2
321846 155907 3
262992 40940 3
267973 150362 1
51071 50300 3
234449 288932 1
152179 359396 2
12420 147592 1
22925 172093 3
321802 225482 3
81094 118143 2
98500 ...

output:

Yes

result:

ok YES

Test #23:

score: 0
Accepted
time: 436ms
memory: 175144kb

input:

1
703102 907242
452857 588580 3
571875 132705 3
81309 273501 3
436277 26431 3
287126 405490 3
356124 344599 3
178172 218862 3
366603 458120 3
362090 413825 3
407972 54135 3
166718 220954 3
314851 422259 3
345337 126054 3
418392 599524 3
364564 340012 3
215679 156796 3
512028 297296 3
677500 666398 3...

output:

Yes

result:

ok YES

Test #24:

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

input:

1
703102 907242
200723 109796 3
79161 191067 3
278934 373426 3
115228 507102 3
280088 177873 3
175112 154690 3
453374 649133 3
337832 430230 3
433387 554596 3
228668 631976 3
551078 667309 3
378868 359861 3
546859 398334 3
454352 401271 3
293328 460601 3
611023 58430 3
574354 291106 3
570153 84002 3...

output:

Yes

result:

ok YES

Test #25:

score: 0
Accepted
time: 428ms
memory: 176208kb

input:

1
703102 907242
313203 564643 2
172338 526504 3
558624 363884 2
318202 470844 1
66599 248897 2
89091 414680 2
131518 594746 2
342885 691732 2
178862 87191 2
291125 419468 2
315526 603657 2
452084 93932 2
408142 428811 2
527217 106504 2
177918 236288 1
668803 395920 2
369361 327624 2
25447 285136 2
5...

output:

Yes

result:

ok YES

Test #26:

score: 0
Accepted
time: 238ms
memory: 116452kb

input:

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

output:

Yes

result:

ok YES

Test #27:

score: 0
Accepted
time: 455ms
memory: 159604kb

input:

1
606002 912202
58494 9359 1
117049 336381 1
550062 174252 1
109803 15075 1
368512 545753 1
396151 600541 1
244945 531138 1
254774 210934 1
205413 496724 1
388871 193665 1
571489 219820 1
344242 4295 1
19138 364354 1
158852 392781 1
38424 563588 1
589177 467175 1
236248 242664 1
429730 463245 1
5299...

output:

Yes

result:

ok YES

Test #28:

score: 0
Accepted
time: 469ms
memory: 142544kb

input:

1
506002 912202
272178 281302 2
122546 36080 2
300255 245681 2
329254 262497 2
370115 271066 2
339538 33855 2
417517 500770 2
269381 425081 2
114262 210589 2
370642 141290 2
434941 344399 2
185721 200862 2
349936 191601 2
250077 7554 2
332765 412970 2
481232 302028 2
437827 243189 2
75492 308869 2
4...

output:

Yes

result:

ok YES

Test #29:

score: 0
Accepted
time: 456ms
memory: 141364kb

input:

1
505502 911102
62676 393998 3
132604 24978 3
326958 477610 3
263365 463302 3
216242 183065 3
368687 469939 3
435584 78101 3
30705 144437 3
157505 291736 3
197319 87575 3
496881 280211 3
50383 164695 3
222173 442785 3
304732 98835 3
139977 492951 3
327471 177924 3
230778 20215 3
218520 59782 3
90538...

output:

Yes

result:

ok YES

Test #30:

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

input:

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

output:

No

result:

ok NO

Test #31:

score: 0
Accepted
time: 373ms
memory: 198076kb

input:

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

output:

No

result:

ok NO

Test #32:

score: 0
Accepted
time: 705ms
memory: 166496kb

input:

1
799999 1000000
647901 426820 3
118997 504898 2
660496 176495 2
275628 67692 2
56289 640043 2
651576 374013 2
1550 146735 2
374832 90894 2
531816 36800 3
545027 11761 2
277066 441979 1
112324 321405 2
304280 454565 2
473152 309503 2
22289 714368 1
532823 622847 3
624859 564290 3
739170 646043 1
350...

output:

No

result:

ok NO

Test #33:

score: 0
Accepted
time: 416ms
memory: 94188kb

input:

1
400001 920002
41454 50731 2
373323 351526 2
223023 299253 1
279239 140351 1
364158 104342 3
93321 159513 3
383783 315644 2
200452 372500 2
117445 278286 1
234541 385316 1
334011 217233 1
258282 189973 1
6536 398621 1
271538 280897 1
104069 298675 3
94610 349306 1
41454 80444 1
217668 50178 3
10298...

output:

Yes

result:

ok YES

Test #34:

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

input:

1
500001 912007
120761 83435 1
333763 256671 1
167491 187401 2
412320 326763 1
183572 372684 3
357353 341130 3
68766 13823 1
157335 492269 1
418458 235267 2
85078 304600 2
206784 127587 3
431133 55392 3
462347 121547 2
220543 423040 3
81431 206736 2
201802 255749 1
50755 437061 2
331900 443476 1
158...

output:

Yes

result:

ok YES

Test #35:

score: 0
Accepted
time: 394ms
memory: 98680kb

input:

1
500001 912007
120761 83435 1
333763 256671 1
167491 187401 2
412320 326763 1
183572 372684 3
357353 341130 3
68766 13823 1
157335 492269 1
418458 235267 2
85078 304600 2
206784 127587 2
431133 55392 3
462347 121547 2
220543 423040 3
81431 206736 2
201802 255749 1
50755 437061 2
331900 443476 1
158...

output:

Yes

result:

ok YES

Test #36:

score: 0
Accepted
time: 444ms
memory: 113628kb

input:

1
700001 940007
78570 404550 2
480464 514711 3
610354 281206 1
1874 483803 3
577060 221995 1
610354 181697 1
259724 150691 1
667348 670427 1
610354 51055 2
683768 657830 2
605966 633225 2
635578 124939 2
136231 258262 2
292774 353321 3
111290 416068 3
152903 130797 1
273230 52716 1
25803 453424 1
46...

output:

Yes

result:

ok YES

Test #37:

score: 0
Accepted
time: 719ms
memory: 211672kb

input:

1
860001 934007
709545 428712 2
443540 718567 1
151146 537057 2
432556 300233 1
35951 587972 1
799748 473501 2
441928 228669 2
701772 626562 1
400369 379244 1
283754 696199 2
347827 232387 2
817439 762831 2
818164 434840 1
542945 175131 1
777276 359758 2
126034 652798 1
761353 462925 1
667403 680961...

output:

Yes

result:

ok YES

Test #38:

score: 0
Accepted
time: 469ms
memory: 133504kb

input:

1
530001 958007
291830 347365 2
344719 16087 1
393995 401168 1
599 100119 1
468059 106186 1
390193 345648 1
295142 88196 1
124318 207884 1
516189 183949 1
184795 445753 1
457456 402663 1
115661 322909 1
508002 122444 1
202208 202188 2
336090 468104 1
382138 421426 1
348921 526606 1
184283 411558 1
2...

output:

Yes

result:

ok YES

Test #39:

score: 0
Accepted
time: 485ms
memory: 155040kb

input:

1
633001 941567
408761 234741 1
433317 555380 1
531617 381516 1
489864 79672 1
385641 250907 3
199353 333889 1
10978 15452 1
604218 106220 1
57852 522554 1
129485 246962 1
29864 85570 1
156079 526329 2
312289 229376 1
21262 91411 1
622004 603050 1
468850 354050 1
540879 328701 2
106038 495719 1
1661...

output:

Yes

result:

ok YES

Test #40:

score: 0
Accepted
time: 472ms
memory: 166676kb

input:

1
714501 939567
644466 33905 2
606351 584553 2
362510 134753 2
232928 157396 2
433020 301993 2
546626 585927 2
548858 681031 2
492956 93660 1
652488 155513 2
203171 324057 2
249199 663276 2
417206 504625 2
334367 408840 2
670618 250313 2
406613 269421 2
420524 86327 2
60007 405440 2
675143 332895 2
...

output:

Yes

result:

ok YES

Test #41:

score: 0
Accepted
time: 470ms
memory: 167780kb

input:

1
710501 935567
134352 665232 2
369891 470931 2
671649 248724 2
492792 405869 2
83545 113302 2
314566 494269 2
683378 177646 2
73077 293614 2
358009 8709 2
692992 126345 2
116334 496263 2
690881 93517 2
420547 143441 2
35676 646212 2
570119 435751 2
246252 618785 2
200880 168574 2
192466 633457 2
33...

output:

Yes

result:

ok YES

Test #42:

score: 0
Accepted
time: 501ms
memory: 85732kb

input:

1
211001 970507
47094 119553 3
197842 150413 3
194930 39628 2
73373 208858 3
115540 14772 3
208245 104792 3
41435 86283 3
26828 92281 2
186013 59534 3
118713 60572 3
50322 187919 3
194471 168247 2
197491 149981 3
193781 21701 3
167409 116307 2
161507 54199 3
58413 57389 3
152925 68028 3
44139 95369 ...

output:

Yes

result:

ok YES

Test #43:

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

input:

1
211001 970506
1102 119553 3
197842 150413 3
194930 33550 2
73373 208858 3
115540 11187 3
208245 104792 3
31488 86283 3
23246 92281 2
186013 59534 3
118713 60572 3
27536 187919 3
194471 168247 2
197491 149981 3
193781 21702 3
167409 116307 2
161507 54199 3
58413 57389 3
152925 68028 3
37324 95369 3...

output:

No

result:

ok NO

Test #44:

score: 0
Accepted
time: 516ms
memory: 168712kb

input:

1
706001 932706
334572 193216 3
60163 309317 3
367642 220151 3
110431 225398 3
212113 84183 3
211509 46905 3
380667 402139 3
393936 409270 3
287434 180644 3
561044 460134 3
593123 591117 3
109664 183026 3
124458 630566 3
485003 298400 3
463607 181103 3
643660 143646 3
336535 368966 1
209066 455153 1...

output:

No

result:

ok NO

Test #45:

score: 0
Accepted
time: 454ms
memory: 129716kb

input:

1
493001 866926
7652 263861 1
48238 155001 1
484618 350468 1
39864 279861 1
173609 25426 1
19712 128367 1
257135 28953 1
419864 100518 1
245102 447965 1
217821 478552 1
97524 407285 1
88931 469891 1
38985 165579 1
411148 325949 1
412851 144237 1
302743 96600 1
213387 299959 1
459482 437933 1
103762 ...

output:

No

result:

ok NO

Test #46:

score: 0
Accepted
time: 499ms
memory: 147000kb

input:

1
592001 917506
427957 15318 1
332937 117544 1
441026 187658 1
515802 493658 1
499607 12969 1
251475 97684 1
308191 292781 1
315703 226355 1
350547 345911 1
1878 229496 1
20803 45849 1
38662 67515 1
375459 264856 1
186329 156009 1
320347 268589 1
353712 162847 1
152800 413282 1
72110 337593 1
297687...

output:

No

result:

ok NO

Test #47:

score: 0
Accepted
time: 810ms
memory: 210000kb

input:

1
817001 890551
221306 499474 1
313111 161111 1
161200 357154 1
81531 140199 2
264863 379463 1
80320 484111 2
7464 215375 1
254134 80289 1
273235 213838 1
489547 677769 1
722978 363107 2
526171 441812 1
610389 73981 2
406670 102045 1
91738 24368 2
566106 181605 2
13516 728557 2
456767 399704 2
26572...

output:

No

result:

ok NO

Test #48:

score: 0
Accepted
time: 456ms
memory: 109300kb

input:

1
608001 909701
556257 601849 3
184427 172887 3
263480 352306 1
416413 209662 1
505581 472806 1
46493 520949 1
493206 559803 1
384412 594674 1
519119 123336 2
604938 600514 1
469226 285378 1
33830 427939 1
509869 105331 1
234533 183318 2
594920 298131 1
530422 148209 3
553421 363990 3
558266 528427 ...

output:

No

result:

ok NO

Test #49:

score: 0
Accepted
time: 386ms
memory: 86708kb

input:

1
368001 848501
163510 182887 2
96818 240351 1
235816 162152 3
99237 322545 3
73794 307668 3
167151 48163 1
99237 205304 3
239609 211462 3
314422 323504 1
99237 319546 2
20736 59459 1
205478 90143 3
56096 305615 3
142691 216112 3
209820 156223 2
197581 298210 1
238614 128092 2
193881 358346 3
99237 ...

output:

No

result:

ok NO

Test #50:

score: 0
Accepted
time: 460ms
memory: 108120kb

input:

1
600003 997002
225384 372825 2
277523 151308 1
494142 139664 3
581150 570029 1
537943 63207 2
492375 448285 1
29018 309529 1
42004 575732 3
87723 344070 3
278477 506561 2
277704 256891 1
190709 103657 1
595623 355653 2
212001 362256 2
81494 403099 2
155833 487780 2
486638 386425 1
281282 159465 3
9...

output:

No

result:

ok NO

Test #51:

score: 0
Accepted
time: 481ms
memory: 82404kb

input:

1
180003 922652
14825 205 1
108206 5586 1
171289 78672 1
118683 38841 1
28360 62941 1
44131 9347 1
61489 168072 1
40293 97999 1
116541 127917 1
150097 71239 1
130363 112647 1
160032 174277 1
77688 49268 1
43287 83728 1
156667 129090 1
34128 156205 3
3191 32841 1
106603 130431 1
112785 72128 1
60734 ...

output:

No

result:

ok NO

Test #52:

score: 0
Accepted
time: 472ms
memory: 154388kb

input:

1
580003 992652
118455 48665 2
450015 63073 2
173041 68740 1
185013 440310 1
24551 202909 2
109336 258057 2
340992 300127 2
75897 473164 2
286500 189075 2
391859 399288 1
560008 465455 2
396696 431252 2
375609 54915 2
204253 25796 2
233896 332237 2
50771 95969 2
550717 84438 1
395647 272294 1
509714...

output:

No

result:

ok NO

Test #53:

score: 0
Accepted
time: 472ms
memory: 114532kb

input:

1
375003 984652
124802 208707 3
5973 226386 3
287566 325184 2
190942 151675 3
127483 239736 1
346743 320828 3
119882 61221 3
122288 68248 3
38489 216863 1
369744 130766 3
316226 106522 3
248827 312746 3
98829 243936 3
63894 218990 1
7316 116687 3
212438 205783 3
85463 293118 3
323425 116239 3
28233 ...

output:

No

result:

ok NO

Test #54:

score: 0
Accepted
time: 446ms
memory: 123216kb

input:

1
470003 976652
469370 337450 3
208722 319153 3
270896 272024 1
192864 127221 3
123877 264055 3
304652 128152 3
336337 72969 3
380669 55435 3
48009 30371 3
60289 393906 3
105215 226952 1
288691 346380 3
344428 299751 3
24306 50163 3
312160 19084 3
159744 352949 3
283660 392735 3
101408 224604 3
3270...

output:

No

result:

ok NO

Test #55:

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

input:

1
806003 999940
635676 715540 2
3628 784774 2
112602 317346 2
453895 710325 2
656768 83258 2
147882 697247 2
567164 712043 2
363852 65455 1
729243 212820 2
317948 300090 2
605315 753038 3
579357 15804 1
301325 403307 2
329322 284404 2
776686 403142 2
732544 146799 3
747836 508822 3
386951 423229 3
2...

output:

No

result:

ok NO

Test #56:

score: 0
Accepted
time: 526ms
memory: 142812kb

input:

1
590003 906940
258172 13774 1
41725 503336 1
167786 429035 1
553058 461790 3
207128 556371 1
26627 151143 3
159646 567088 1
246519 573523 1
34571 538027 1
441866 291928 3
343719 206335 3
523415 269891 3
88995 325058 3
248226 367733 1
342160 436755 1
565870 65726 1
80071 292485 1
63474 305768 3
4456...

output:

No

result:

ok NO

Test #57:

score: 0
Accepted
time: 484ms
memory: 141968kb

input:

1
590003 906941
258172 13774 1
41725 503336 1
167786 429035 1
553058 461790 3
207128 556371 1
26627 151143 3
159646 567088 1
246519 573523 1
34571 538027 1
441866 291928 3
343719 206335 3
523415 269891 3
88995 325058 3
248226 367733 1
342160 436755 1
565870 65726 1
80071 292485 1
63474 305768 3
4456...

output:

Yes

result:

ok YES

Test #58:

score: 0
Accepted
time: 442ms
memory: 82612kb

input:

1
194003 987953
127774 124164 3
151122 18695 3
70153 80208 3
14458 30963 3
160471 173040 3
91527 1230 3
51670 71635 3
106364 91107 1
124894 116161 3
142418 109184 3
49753 7229 3
109026 87939 3
18002 167895 3
62858 88312 3
20565 103322 3
27145 181172 3
50099 91982 3
101483 47301 3
18137 48688 3
75046...

output:

Yes

result:

ok YES

Test #59:

score: 0
Accepted
time: 334ms
memory: 84968kb

input:

1
359003 868803
261641 4679 3
38294 253118 2
99011 88293 1
273852 282771 1
248105 217740 2
701 133752 1
15480 36933 3
174431 304814 1
293608 29755 1
104106 270724 2
90710 121811 3
331000 97839 3
1913 49709 1
125627 183984 3
257898 265453 3
60648 343120 2
7483 235728 1
153933 21195 2
256495 296930 2
...

output:

Yes

result:

ok YES

Test #60:

score: 0
Accepted
time: 341ms
memory: 100176kb

input:

1
590003 868803
278174 128411 1
22315 206635 1
412503 457479 1
397589 503064 1
231026 560991 1
237467 337042 3
303838 112360 2
249141 6295 2
313717 375165 2
359957 186807 3
396534 302121 1
472944 543065 3
319619 194480 2
237853 270331 1
224090 301315 3
70521 478166 1
530543 319915 1
281713 457121 1
...

output:

Yes

result:

ok YES

Test #61:

score: 0
Accepted
time: 469ms
memory: 150704kb

input:

1
654903 977091
64291 114592 2
212895 312953 2
398474 66378 2
346431 283812 2
443471 49631 2
473901 441871 2
320012 458922 2
572621 113093 2
174477 200188 1
435606 579180 2
277458 99801 2
209510 182744 1
314228 393191 2
144825 557162 2
280657 84767 1
414911 599696 2
645392 411731 1
484076 57532 1
13...

output:

Yes

result:

ok YES

Test #62:

score: 0
Accepted
time: 442ms
memory: 142812kb

input:

1
659403 884391
42239 226212 3
658348 587943 3
371291 33621 3
553390 89344 3
627569 464010 3
249506 409296 3
456811 343674 3
260019 589263 1
406583 552698 3
562256 106927 3
55963 366134 3
59769 652913 3
338157 332746 1
511160 128086 3
120099 124533 3
307774 174912 1
332622 397895 1
380718 625737 3
1...

output:

Yes

result:

ok YES

Test #63:

score: 0
Accepted
time: 431ms
memory: 121244kb

input:

1
459503 890693
19748 114223 3
364316 157600 3
339341 341475 3
57381 252873 3
96945 161930 1
265454 20678 1
119368 251401 1
245494 283837 3
234343 129332 3
369811 442742 3
136688 293230 1
217393 139812 1
293482 250551 3
197851 79851 3
422031 421215 1
227148 216134 3
408771 197817 1
200039 189573 1
4...

output:

Yes

result:

ok YES

Test #64:

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

input:

1
459503 890693
19748 114223 3
364316 157600 3
339341 341475 3
57381 252873 3
96945 161930 1
265454 20678 1
119368 251401 1
245494 283837 3
234343 129332 3
369811 442742 3
136688 293230 1
217393 139812 1
293482 250551 3
197851 79851 3
422031 421215 1
227148 216134 3
408771 197817 1
200039 189573 1
4...

output:

Yes

result:

ok YES

Test #65:

score: 0
Accepted
time: 430ms
memory: 116500kb

input:

1
604003 905298
454512 264187 2
12938 592457 2
392172 303301 1
167594 36304 1
601642 151026 1
353628 103430 1
558117 249421 1
493741 314328 2
41824 398876 1
43696 139505 1
461064 541972 1
64328 72675 1
29300 169841 2
349556 90479 2
19083 199293 1
190511 119110 1
405402 22382 1
253339 94947 1
280479 ...

output:

Yes

result:

ok YES

Test #66:

score: 0
Accepted
time: 402ms
memory: 113512kb

input:

1
653003 802898
415787 467077 2
124367 611295 1
303533 438234 2
514910 56618 2
625732 45251 1
471318 92597 2
382948 213095 1
276864 260409 1
199735 217099 2
404664 238195 1
445833 444642 2
190474 630229 2
383493 536110 1
214463 50458 3
226067 152589 1
629156 99130 2
390577 540954 1
332306 550053 2
6...

output:

Yes

result:

ok YES

Test #67:

score: 0
Accepted
time: 416ms
memory: 117948kb

input:

1
653003 802898
415787 467077 2
124367 611295 1
303533 438234 2
514910 56618 2
625732 45251 1
471318 92597 2
382948 213095 1
276864 260409 1
199735 217099 2
404664 238195 1
445833 444642 2
190474 630229 2
383493 536110 1
214463 50458 3
226067 152589 1
629156 99130 2
390577 540954 1
332306 550053 2
6...

output:

Yes

result:

ok YES

Test #68:

score: 0
Accepted
time: 428ms
memory: 148100kb

input:

1
553503 914898
450592 474761 3
106845 415101 1
350102 485573 1
188451 405719 1
478891 481282 1
536285 72658 1
27857 326993 1
275437 10459 1
168881 498142 1
547913 440025 1
292393 310821 1
339949 473549 1
512543 308405 1
344073 496779 1
468213 143377 1
149759 116713 1
496329 315968 1
41644 95438 1
2...

output:

Yes

result:

ok YES

Test #69:

score: 0
Accepted
time: 373ms
memory: 139564kb

input:

1
544003 795698
272294 328376 3
199316 537059 3
527922 219924 3
445704 35807 3
460753 40803 3
187429 427003 3
455005 9896 3
377157 113736 3
253400 272445 3
78348 330535 3
112032 398928 3
351691 70453 3
120786 285790 3
269049 231719 3
332560 279257 3
342227 1915 3
127666 190172 3
306199 95213 3
25811...

output:

Yes

result:

ok YES

Test #70:

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

input:

2
2 1
1 2 3
2 1
1 2 3

output:

No
No

result:

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

Test #71:

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

input:

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

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 #72:

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

input:

500000
2 1
2 1 2
2 1
2 1 3
2 1
2 1 2
2 1
2 1 2
2 1
2 1 1
2 1
2 1 2
2 1
2 1 3
2 1
2 1 2
2 1
2 1 2
2 1
2 1 2
2 1
2 1 1
2 1
2 1 2
2 1
2 1 1
2 1
2 1 1
2 1
2 1 1
2 1
2 1 3
2 1
2 1 3
2 1
2 1 3
2 1
2 1 1
2 1
2 1 2
2 1
2 1 1
2 1
2 1 2
2 1
2 1 1
2 1
2 1 2
2 1
2 1 3
2 1
2 1 3
2 1
2 1 3
2 1
2 1 1
2 1
2 1 2
2 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 500000 token(s): yes count is 0, no count is 500000

Test #73:

score: 0
Accepted
time: 143ms
memory: 15868kb

input:

100000
10 9
2 1 2
3 2 2
4 2 1
5 4 3
6 5 2
7 1 3
8 3 1
9 4 3
10 3 1
10 9
2 1 1
3 2 1
4 3 3
5 2 1
6 2 1
7 5 3
8 6 3
9 5 2
10 9 1
10 9
2 1 2
3 1 1
4 2 3
5 1 1
6 3 3
7 1 1
8 2 3
9 5 3
10 2 3
10 9
2 1 3
3 1 2
4 2 1
5 2 1
6 5 3
7 1 1
8 1 3
9 4 2
10 2 1
10 9
2 1 1
3 2 2
4 2 3
5 1 1
6 5 3
7 5 3
8 1 3
9 7 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 100000 token(s): yes count is 0, no count is 100000

Test #74:

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

input:

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

output:

Yes
No
Yes
No
No
No
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
No
No
No
No
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
No
No
No
Yes
Yes
Yes
No
No
No
No
No
Yes
No
No
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
Yes
No
No
Yes
Yes
No
No
Yes
Yes
Yes
No
No
No
No
No
No
No
No
No
No
Yes
N...

result:

ok 100000 token(s): yes count is 44253, no count is 55747

Test #75:

score: 0
Accepted
time: 349ms
memory: 249468kb

input:

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

output:

No

result:

ok NO

Test #76:

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

input:

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

output:

Yes
No
No
Yes
Yes
Yes
No
No
Yes
No
No
Yes
No
Yes
No
No
No
No
No
Yes
Yes
No
No
No
Yes
No
No
No
No
No
Yes
Yes
No
No
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
Yes
Yes
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
No
Yes
No
Yes
No
No
No
No
No
No...

result:

ok 23256 token(s): yes count is 6232, no count is 17024

Test #77:

score: 0
Accepted
time: 168ms
memory: 15896kb

input:

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

output:

Yes
Yes
No
No
Yes
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
No
No
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
No
No
No
Yes
No
Yes
No
No
Yes
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No...

result:

ok 25000 token(s): yes count is 5949, no count is 19051

Test #78:

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

input:

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

output:

Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
No
No
Yes
No
No
Yes
No
No
No
Yes
No
No
No
Yes
Yes
No
Yes
No
No
Yes
No
No
No
Yes
No
No
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
No
No
Yes
No
No
Yes
Yes
Yes
No
No
No
No
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No...

result:

ok 22222 token(s): yes count is 11103, no count is 11119

Test #79:

score: 0
Accepted
time: 304ms
memory: 85656kb

input:

1
400026 800023
65030 146057 3
352225 342416 3
103378 152668 1
342416 106501 3
110509 325347 2
79070 392741 3
379561 342416 3
363373 16095 3
64288 65030 3
371902 341968 3
316294 57971 3
170534 128862 3
142244 317950 1
341455 342416 3
8213 316294 3
342416 149894 3
41474 209928 3
116278 160899 1
34241...

output:

Yes

result:

ok YES

Test #80:

score: 0
Accepted
time: 368ms
memory: 99360kb

input:

1
480026 960023
96294 463895 3
45142 58855 3
424798 170995 2
220369 303078 2
303078 117701 2
101342 170642 3
133626 317062 2
170642 435672 2
424798 211977 2
376417 424798 2
4971 7869 2
358252 424798 2
42896 159688 3
368108 170642 3
173051 356548 3
438517 424798 3
445930 191452 3
58855 450023 3
32004...

output:

Yes

result:

ok YES

Test #81:

score: 0
Accepted
time: 381ms
memory: 96632kb

input:

1
480026 960023
392942 343841 1
225681 369205 1
219408 177676 2
219408 389732 1
219408 237701 1
219408 16896 2
288764 927 2
242864 147272 2
153112 435399 3
153112 227201 3
423873 381459 2
117075 419061 2
153112 302446 3
72895 418676 2
423447 153112 3
225681 443064 1
403702 86932 1
6852 325730 3
1170...

output:

Yes

result:

ok YES

Test #82:

score: 0
Accepted
time: 388ms
memory: 93676kb

input:

1
480005 960001
22844 124030 2
124030 190122 2
311218 3970 1
4576 286560 3
4576 139099 3
119645 62955 1
311218 70813 1
311218 305370 1
82085 26987 1
77756 311218 1
454707 183689 2
4576 298615 3
391231 412422 2
412422 345133 2
124030 460442 3
314268 417316 1
305586 4576 3
367117 138155 1
124496 41242...

output:

No

result:

ok NO

Test #83:

score: 0
Accepted
time: 381ms
memory: 94136kb

input:

1
480005 960001
78635 41194 3
41194 144320 3
382557 245906 2
208817 343721 2
98652 23256 1
94261 326926 2
382557 82522 2
62283 382557 2
139623 316382 2
408196 205652 2
364058 41194 3
400267 382557 2
267515 41933 2
382557 210520 2
186559 350598 1
276297 382557 2
382557 434819 2
445495 229333 1
41194 ...

output:

No

result:

ok NO

Test #84:

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

input:

1
729634 999902
418191 616883 2
513218 475754 3
606766 334069 2
91303 644546 2
675352 32469 3
118148 144341 2
418977 82810 3
120495 108819 3
715913 548231 2
509405 579427 3
67048 686173 2
323456 361580 1
583988 408611 3
542883 391609 1
426315 279356 2
296693 724217 3
553190 713066 3
64339 146793 1
4...

output:

Yes

result:

ok YES

Test #85:

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

input:

1
729982 999903
156256 414074 1
527652 233465 2
341089 202579 1
722317 171567 2
531949 69929 1
159630 353333 1
550047 11309 2
679287 617806 2
100420 251636 2
598678 525031 1
377448 270021 2
33603 210434 3
541175 391703 3
367655 27250 2
66064 451585 1
466228 570900 1
248464 155656 2
678358 684840 3
6...

output:

Yes

result:

ok YES

Test #86:

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

input:

1
729903 999901
236811 609533 2
367560 91872 3
414692 421046 2
276738 252902 2
716486 609803 1
707774 601412 3
122264 202080 3
503204 654462 3
355380 505557 3
83584 572305 3
314741 436492 2
615566 525437 1
173032 661302 2
314870 208445 2
213826 456122 2
289126 544275 2
94368 505849 2
620639 341109 1...

output:

No

result:

ok NO

Test #87:

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

input:

1
729930 999901
419350 446993 1
251543 194174 1
217817 413610 2
590688 704111 2
338909 78936 2
85131 117603 1
577144 494795 1
141582 210774 1
644284 611557 1
562320 719946 3
134539 422254 3
125941 90037 1
687300 650656 2
302151 407113 2
164735 268391 2
616022 285392 3
275522 51590 2
219627 619065 2
...

output:

No

result:

ok NO

Test #88:

score: 0
Accepted
time: 410ms
memory: 91680kb

input:

1
480044 960043
166181 378231 3
369115 326851 3
402828 64868 2
231788 858 1
166181 95182 3
144135 400287 2
83112 356906 3
135983 191536 2
300011 20500 3
235731 189079 1
289062 311330 1
183422 149870 2
286394 383846 3
136635 438098 1
409163 274609 1
245591 309196 1
179566 363976 1
274234 365840 3
674...

output:

Yes

result:

ok YES

Test #89:

score: 0
Accepted
time: 429ms
memory: 95904kb

input:

1
480044 960043
458600 430733 2
78653 406655 1
389898 236799 1
137371 340845 1
15333 346083 2
351491 53234 3
49705 336706 2
389898 442589 1
379605 444654 1
10064 156076 3
114550 156076 3
91560 142024 2
430733 342780 2
156076 248406 3
57324 276905 2
426490 421503 1
298040 388839 2
389898 17280 1
1232...

output:

Yes

result:

ok YES

Test #90:

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

input:

1
480023 960021
297249 192450 3
249217 129792 3
27481 163843 2
252300 119351 3
93056 217086 1
144196 276387 3
68900 217086 1
417692 369576 3
353177 57419 1
279401 192396 2
297082 241529 2
339351 167779 2
108713 454037 2
241529 133287 2
44533 298515 2
46875 217086 1
439169 76168 3
186563 76168 3
2270...

output:

No

result:

ok NO

Test #91:

score: 0
Accepted
time: 414ms
memory: 92420kb

input:

1
480023 960021
239345 336533 2
93615 57524 2
424858 342301 3
121824 138620 1
57524 92942 2
299254 13365 1
64444 92855 1
37958 266090 1
381832 440744 1
130866 102494 1
160140 382599 3
33796 401934 2
362683 294566 1
16113 33796 2
61016 330911 1
410359 156783 1
47466 4554 1
185459 182775 2
449429 4005...

output:

No

result:

ok NO

Test #92:

score: 0
Accepted
time: 197ms
memory: 25900kb

input:

10
48005 96001
25235 30249 3
29231 21155 2
36278 8240 2
18393 19437 3
44983 39209 1
6541 39230 2
7158 5873 2
18393 24130 3
40554 31617 2
3514 12486 1
42253 18393 3
36308 19712 3
36278 31429 2
26315 27654 2
20220 21613 3
807 21613 1
4505 44983 1
10091 43049 2
21613 16557 1
21850 1787 1
44327 14407 3
...

output:

No
Yes
No
No
No
No
Yes
No
No
Yes

result:

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

Test #93:

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

input:

10
48005 96001
21832 46823 2
29322 6712 2
31083 36155 2
34376 20337 3
32279 16598 3
19044 33517 2
28370 47749 3
45369 6955 2
29350 19044 2
12187 21107 1
21533 37606 3
34298 29220 2
41605 29257 1
36729 31083 3
12187 5773 1
31083 46556 3
6666 41247 3
47749 18323 2
16177 35006 2
47749 31949 2
32919 190...

output:

No
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes

result:

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

Test #94:

score: 0
Accepted
time: 199ms
memory: 28108kb

input:

10
48026 96023
17282 13809 2
43744 23356 3
4615 44952 1
33993 34181 2
30268 44952 1
6176 35000 3
20377 2713 2
16876 32753 2
47122 19999 3
14837 17400 3
19935 28857 1
39489 19892 1
34824 17400 3
45570 5 3
33993 7040 2
2088 39185 3
16364 29788 2
7593 20746 1
10801 17400 3
23186 4703 2
26377 43093 1
36...

output:

Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No

result:

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

Test #95:

score: 0
Accepted
time: 208ms
memory: 23692kb

input:

10
48026 96023
27140 24987 2
20224 10490 1
47149 46952 1
11859 47149 1
11253 10487 1
47149 12988 1
28183 12339 2
33747 47112 2
30186 45623 2
46361 10490 1
10490 37965 1
36976 28174 3
3441 8818 2
10643 47149 2
47613 38995 1
44160 9875 1
35791 25944 2
2832 10490 1
10490 20400 1
31093 47149 1
45429 324...

output:

Yes
No
Yes
No
No
No
No
No
Yes
Yes

result:

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

Test #96:

score: 0
Accepted
time: 332ms
memory: 85216kb

input:

1
410044 950091
146081 162910 3
162910 292050 1
392484 162910 1
9032 328791 2
240759 91511 3
231177 35436 3
356486 162910 1
398899 317503 1
127688 166237 3
380790 104685 3
132731 231177 3
47327 215977 1
277256 309128 3
162910 183164 3
267830 56012 3
18482 162910 1
200580 298648 1
248516 234198 3
204...

output:

Yes

result:

ok YES

Test #97:

score: 0
Accepted
time: 337ms
memory: 87036kb

input:

1
410044 950091
236570 154112 1
107859 368221 1
107859 77185 2
265568 139529 1
90874 223599 3
90881 236570 2
18847 364209 3
82574 107859 1
236570 174191 2
408545 41510 1
359257 109939 2
291093 258880 2
107859 234682 2
115257 302439 2
46173 236570 1
275564 397124 1
327692 52103 1
291093 360105 2
1057...

output:

Yes

result:

ok YES

Test #98:

score: 0
Accepted
time: 342ms
memory: 91136kb

input:

1
475044 971890
419770 366831 1
179181 466558 3
122903 77454 1
60102 205546 1
445588 378551 1
38463 163037 1
141013 378551 1
37318 60102 3
5938 261761 3
156198 250404 3
77315 137513 3
133138 304166 3
365077 60102 3
31107 284475 3
378551 346650 1
336645 354297 3
9829 133138 3
393454 266042 2
11894 21...

output:

Yes

result:

ok YES

Test #99:

score: 0
Accepted
time: 359ms
memory: 93032kb

input:

1
475044 971713
42246 22808 3
170414 118978 2
415655 14266 3
94000 87552 1
223563 179860 1
467908 124488 1
392928 103031 1
153604 223563 3
45274 84827 1
270701 311436 3
233321 392835 3
109828 92716 3
152553 210916 1
238802 395259 3
238335 435092 3
32763 257201 3
65607 459155 3
472770 439328 1
286750...

output:

Yes

result:

ok YES

Test #100:

score: 0
Accepted
time: 525ms
memory: 117520kb

input:

1
719647 999901
106178 101858 2
88655 645536 3
163088 633827 2
238115 487288 2
192969 402840 2
556456 121846 3
7580 241830 1
381106 513634 2
287497 92500 1
240239 432689 3
116189 678212 2
439916 52410 1
305051 435431 3
624237 714747 3
251093 365313 2
36363 162347 1
490231 76527 2
460230 139704 2
244...

output:

Yes

result:

ok YES

Test #101:

score: 0
Accepted
time: 534ms
memory: 121492kb

input:

1
719423 999901
430824 96104 2
207411 542668 3
236366 220898 2
110307 462573 2
167224 125906 3
419918 679668 2
689576 206114 2
191118 552052 3
334332 429887 3
220525 43187 1
375321 574041 1
104276 19120 3
17505 671342 1
620917 429552 2
124826 452755 1
620762 558411 1
638622 425630 3
414778 107656 2
...

output:

Yes

result:

ok YES

Test #102:

score: 0
Accepted
time: 536ms
memory: 119652kb

input:

1
724578 999901
470712 158463 1
427972 163020 2
645004 305530 3
676963 132928 1
436439 2323 1
413746 420757 1
564531 289690 2
572337 413568 2
195159 88724 2
95555 479700 2
67843 577121 2
217243 521486 1
718369 542692 2
670792 669863 1
428836 645001 1
492462 698195 2
551401 363290 3
592066 682173 2
2...

output:

Yes

result:

ok YES

Test #103:

score: 0
Accepted
time: 555ms
memory: 121812kb

input:

1
724790 999901
206160 479260 1
630910 289665 3
424119 376793 3
103741 6730 1
715415 571853 3
481241 377455 1
263317 384102 1
657353 539935 3
606062 652900 3
455095 654307 3
606507 535183 2
324799 549328 2
456456 457514 1
452310 169954 2
114760 219982 2
714705 49145 2
502500 603623 2
483491 264486 1...

output:

Yes

result:

ok YES

Test #104:

score: 0
Accepted
time: 379ms
memory: 80748kb

input:

1
410092 950208
370718 337745 3
259956 318621 1
168175 11418 3
296163 155868 2
25679 234289 3
73132 207723 1
333596 68028 3
25388 100889 3
333596 133885 3
288959 262547 2
175512 11418 3
115655 105800 3
283879 238703 2
314084 58616 3
339680 75824 3
287200 100889 3
45292 115655 3
17900 333596 3
17043 ...

output:

Yes

result:

ok YES

Test #105:

score: 0
Accepted
time: 349ms
memory: 82812kb

input:

1
410092 950208
149451 211836 2
168720 42818 2
48155 312922 2
82841 331984 3
150945 56286 2
31801 172209 2
302972 167120 2
259071 90963 2
309652 287566 2
406605 243315 1
116794 227566 1
135694 408775 1
103610 90963 1
227566 297496 2
90963 404216 2
3456 28206 2
130118 28206 2
264753 356381 3
46940 12...

output:

Yes

result:

ok YES

Test #106:

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

input:

1
475090 971656
332195 59465 3
446585 253018 1
375471 375167 3
239857 30503 3
64028 473471 3
347168 202813 1
259385 215339 3
4425 435096 3
216007 244693 1
13727 51783 1
218796 464104 3
468282 63098 1
432352 470873 3
396327 435721 2
29366 335787 2
302536 139491 1
224109 199129 3
224122 337082 1
21191...

output:

Yes

result:

ok YES

Test #107:

score: 0
Accepted
time: 336ms
memory: 89064kb

input:

1
475090 971571
283388 159979 2
457684 107465 3
205123 209559 1
14713 83540 2
156713 291467 1
342943 396244 1
172380 21335 2
84138 43818 1
212187 19775 2
469395 461929 1
438630 138930 1
466675 316741 3
252889 227265 2
190327 260868 2
77166 50689 2
471037 319317 1
342886 431221 1
212187 281763 2
2020...

output:

Yes

result:

ok YES

Test #108:

score: 0
Accepted
time: 188ms
memory: 21108kb

input:

10
41023 95055
31383 674 3
21754 5136 1
30475 27863 2
5136 7620 3
38172 34206 3
32980 15142 1
9329 5136 3
22164 5136 1
3659 5136 3
3214 1285 3
38172 5094 3
38172 19031 1
9245 25468 1
11445 11556 2
34039 5136 1
5136 650 1
11451 13095 1
1739 28754 1
5201 27881 1
2322 38172 1
29588 16039 3
38172 5017 3...

output:

No
No
Yes
Yes
No
No
Yes
No
No
No

result:

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

Test #109:

score: 0
Accepted
time: 178ms
memory: 21248kb

input:

10
41023 95055
25939 35692 2
6104 19286 1
38597 31728 1
5877 4697 2
12546 17200 2
38555 39525 1
20766 8318 1
37595 38555 2
8051 19286 1
19286 29907 1
31728 34860 1
7837 32604 1
40446 31728 1
37475 19286 2
38555 35647 1
19286 32898 2
39094 3901 3
2272 14152 2
14454 32305 2
33611 29088 2
33594 39094 3...

output:

No
No
No
No
Yes
No
Yes
Yes
No
No

result:

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

Test #110:

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

input:

10
47523 97263
19578 4472 1
14711 7754 1
27440 13937 2
3536 7617 1
18522 31957 1
3406 8309 2
14026 363 2
17662 23503 2
15212 31080 2
32957 27914 2
5675 1563 2
41528 7199 1
44946 33394 2
36508 34930 1
25611 24726 2
34930 38502 1
39721 30810 1
46096 27343 1
42537 17975 2
15150 29713 1
26924 5422 1
339...

output:

No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes

result:

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

Test #111:

score: 0
Accepted
time: 199ms
memory: 22876kb

input:

10
47523 97316
39711 11460 1
38362 18709 2
30397 18016 2
31163 27995 1
6466 16943 1
16290 29372 3
3717 3312 1
2053 6233 2
12275 41311 1
33789 35185 2
16206 19656 1
20242 11223 2
43368 37526 1
18111 30410 1
2124 5198 2
10875 45065 1
40483 16879 1
448 11456 2
790 35234 2
29162 36704 3
33033 13151 2
40...

output:

No
Yes
Yes
Yes
No
No
No
No
No
No

result:

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

Test #112:

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

input:

1
410023 950055
104997 111582 3
87168 60634 3
188987 408434 1
77230 14392 3
48174 14392 3
354386 341086 1
222242 121432 2
100163 408434 3
274270 14392 1
282691 408434 3
206078 408434 1
5997 14392 3
365496 46099 3
199862 387072 1
408434 210897 1
128015 203931 2
14392 289981 1
404275 97753 1
174323 21...

output:

No

result:

ok NO

Test #113:

score: 0
Accepted
time: 319ms
memory: 87608kb

input:

1
410023 950055
335059 65978 2
408726 285960 3
396350 408726 3
408726 387461 2
266588 277181 2
387185 14511 3
408726 88959 3
128108 292572 2
387185 171818 3
116260 369578 3
408726 365292 3
408726 111840 3
387185 399919 2
308711 46310 2
387185 28972 3
84289 387185 3
245378 298527 1
408726 327198 2
12...

output:

No

result:

ok NO

Test #114:

score: 0
Accepted
time: 334ms
memory: 90436kb

input:

1
475023 971156
212253 396242 2
440184 52311 1
335670 442308 1
92308 63300 2
374602 411778 3
199659 142358 3
401494 442308 1
99341 139044 2
212869 436463 1
286455 442308 1
338137 149252 2
370014 242192 2
99320 390393 2
467546 310799 3
57056 467126 3
462492 40497 3
112200 352360 2
262845 291197 1
917...

output:

No

result:

ok NO

Test #115:

score: 0
Accepted
time: 319ms
memory: 91032kb

input:

1
475023 971468
459158 229927 3
131323 326265 3
106717 241780 3
323247 212054 2
370783 131323 3
289656 20488 2
87873 225973 2
39490 69623 2
221095 27529 3
326815 425109 3
354470 225973 3
229271 241780 3
244674 250609 3
304317 469214 2
377931 473842 2
212583 465259 3
165271 384087 1
165271 258412 1
4...

output:

No

result:

ok NO

Test #116:

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

input:

1
719475 999902
653868 305746 3
339375 458377 2
647660 489210 3
603483 238741 1
718905 437078 3
660499 79702 3
482816 482188 2
215659 211337 1
398592 594254 1
154753 705231 1
162011 179760 1
205774 643230 3
226028 509596 2
76721 513597 2
78956 595533 3
399874 3247 3
546888 42224 3
77321 356820 2
213...

output:

No

result:

ok NO

Test #117:

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

input:

1
719290 999901
472154 272154 3
78199 545051 3
51739 352054 1
592045 585488 1
471932 679276 1
506813 371491 1
342805 708570 2
234028 64607 3
150147 324640 3
140984 464367 2
692896 94426 1
13630 692375 1
601368 714477 2
216149 414361 2
319813 411215 2
443222 125261 1
334306 494231 3
508216 701257 2
5...

output:

No

result:

ok NO

Test #118:

score: 0
Accepted
time: 525ms
memory: 119616kb

input:

1
724310 999902
337117 467596 2
721128 213640 2
321318 115078 1
693793 646545 2
596178 6496 1
221845 337137 1
610541 598465 1
1491 308320 1
439187 188393 2
366742 550570 2
244630 274653 2
432578 59966 3
1350 337634 2
583640 442595 3
183584 663894 3
298007 41616 1
234412 697441 2
132020 269560 3
3633...

output:

No

result:

ok NO

Test #119:

score: 0
Accepted
time: 533ms
memory: 119864kb

input:

1
724528 999901
293699 384473 1
522760 348133 1
563066 605960 3
701599 112140 2
535694 176291 2
404185 591374 3
477649 555247 2
508143 370415 1
653450 221887 2
278694 403106 1
38560 670876 2
87707 478490 3
518340 691488 3
43249 183036 1
107057 503659 3
200221 454602 1
143091 538400 3
200729 470895 2...

output:

No

result:

ok NO

Test #120:

score: 0
Accepted
time: 340ms
memory: 84428kb

input:

1
410071 950172
352641 287347 1
196739 55226 3
150499 151015 1
19628 174385 3
75832 49888 3
274857 10672 1
226246 87445 1
19628 317654 1
241056 226246 3
335987 132172 2
108584 368118 3
368118 40663 1
369849 287347 3
32524 274857 3
287347 144000 1
274857 170759 3
124042 131302 1
254611 230490 1
11167...

output:

No

result:

ok NO

Test #121:

score: 0
Accepted
time: 379ms
memory: 87736kb

input:

1
410071 950172
325793 166599 3
58226 166498 3
78061 73902 2
155316 381658 2
28906 268822 2
38979 398102 2
328395 157518 2
34256 166498 2
339343 182900 3
156070 104631 2
231973 32588 2
258777 84462 3
359386 1256 3
385596 113626 1
23062 144989 1
166498 139028 3
202337 145769 2
391724 83889 1
325793 3...

output:

No

result:

ok NO

Test #122:

score: 0
Accepted
time: 382ms
memory: 90276kb

input:

1
475069 971654
433237 66512 1
128383 445104 3
222488 286012 1
10653 413081 1
18629 431010 3
165688 435680 3
181450 132822 3
293962 245923 1
269988 260106 3
458826 84186 1
268122 271374 1
159691 18664 3
441428 271989 1
378487 129282 3
173506 20211 1
330415 52670 3
277767 274387 3
443579 432196 1
326...

output:

No

result:

ok NO

Test #123:

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

input:

1
475069 971882
384925 362777 3
299792 121160 1
221650 140824 1
89876 177677 3
54700 431925 1
109255 67575 2
450115 472196 2
153432 452552 2
27551 396781 2
64622 429172 1
285589 14159 3
100251 466717 2
184355 369778 3
176363 167491 1
75892 364242 3
296336 403106 3
30532 24445 3
384406 427656 2
38528...

output:

No

result:

ok NO

Test #124:

score: 0
Accepted
time: 182ms
memory: 24736kb

input:

10
41023 95055
11272 12530 2
7479 39228 1
40623 27834 2
21914 21869 1
28423 21914 1
31236 26890 1
18528 21914 1
31276 34601 1
5498 21914 2
37857 21914 1
20334 39628 2
21998 21914 2
21782 27834 1
5788 27834 2
24666 1951 2
35312 12120 1
745 12120 1
6129 20173 2
719 35263 1
10486 4107 2
40498 17478 1
2...

output:

No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes

result:

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

Test #125:

score: 0
Accepted
time: 183ms
memory: 20788kb

input:

10
41023 95055
34371 23258 2
21928 33990 2
18773 2518 1
2463 26909 1
21928 41010 2
35288 9760 3
21928 37479 2
25008 26394 3
34371 25166 2
21928 17853 2
6234 34103 2
11008 32559 1
38090 21928 1
34371 8511 1
4051 34371 1
41023 6600 2
21928 37332 1
36823 34371 1
21928 1894 2
14919 15005 1
22602 40237 1...

output:

No
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes

result:

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

Test #126:

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

input:

10
47544 97290
40601 42638 1
20753 15639 3
9749 43264 1
9002 15639 3
42290 18769 2
45428 5565 2
23889 41388 2
33066 3338 2
19722 38184 1
26452 6537 2
9225 20862 1
15639 4590 3
19557 44882 1
24678 23681 1
40714 39255 2
40136 20224 2
42281 16086 1
42865 10308 1
8179 3616 2
32461 41995 2
30070 44663 2
...

output:

Yes
Yes
Yes
No
No
Yes
No
No
Yes
Yes

result:

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

Test #127:

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

input:

10
47544 97204
30924 25118 2
6155 19929 2
26179 14250 2
11380 26154 3
11300 5505 1
47204 1491 2
20596 11992 1
34222 44342 1
20862 7689 2
43277 19083 2
33264 6709 1
3533 43517 2
8634 14044 2
10904 44586 2
21531 11501 1
3190 42286 1
12645 32846 2
47223 45834 2
41984 43827 1
2324 42726 1
39068 5582 3
2...

output:

Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No

result:

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

Test #128:

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

input:

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

output:

Yes

result:

ok YES

Test #129:

score: 0
Accepted
time: 426ms
memory: 119112kb

input:

1
500002 999999
322614 219049 2
91379 268127 2
91379 62325 2
31521 91379 2
91379 440140 2
60367 315649 2
204478 331024 2
264258 39450 2
393425 480897 2
122437 480887 2
433550 204478 2
352781 492104 2
322663 204478 2
198946 117613 2
394029 204478 2
242077 91379 2
91379 208745 2
204478 85739 2
325991 ...

output:

Yes

result:

ok YES

Extra Test:

score: 0
Extra Test Passed