QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#592216#7080. Chiaki ChainAfterlife#AC ✓219ms47324kbC++207.5kb2024-09-26 21:14:202024-09-26 21:14:26

Judging History

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

  • [2024-09-26 21:14:26]
  • 评测
  • 测评结果:AC
  • 用时:219ms
  • 内存:47324kb
  • [2024-09-26 21:14:20]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

using pii=pair<int,int>;

using ull=unsigned long long;

const int N=2e5+1e3+7;

int n,m,k,T;

vector<int> g[N],e[N];

int dfn[N],dc,fa[N];

mt19937_64 rng(58);

vector<pii> ext;

ull dv[N];

void dfs(int x,int f)
{
    dfn[x]=++dc;
    fa[x]=f;
    for(auto v:g[x])
    {
        if(v==f)
            continue;
        if(!dfn[v])
            dfs(v,x),e[x].push_back(v);
        else if(dfn[v]<dfn[x])
            ext.push_back({x,v});
    }
}

void getv(int x)
{
    for(auto v:e[x])
    {
        getv(v);
        dv[x]^=dv[v];
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>T;
    while(T--)
    {
        cin>>n>>m>>k;
        set<pair<int,int> >es;
        int sc=0;
        if(m<n)
        {
            for(int i=1;i<=m;i++)
            {
                int u,v;
                cin>>u>>v;
            }
            cout<<"No\n";
            continue;
        }
        for(int i=1;i<=n;i++)
            g[i].clear(),e[i].clear(),dv[i]=0;
        for(int i=1;i<=m;i++)
        {
            int u,v;
            cin>>u>>v;
            es.insert({min(u,v),max(u,v)});
            sc|=u==v;
            g[u].push_back(v);
            g[v].push_back(u);
        }
        int d4=0;
        for(int i=1;i<=n;i++)
        {
            if(g[i].size()>3)
                d4=1;
        }
        if(d4)
        {
            cout<<"No\n";
            continue;
        }
        if(es.size()!=m||sc)
        {
            cout<<"No\n";
            continue;
        }
        fill(dfn+1,dfn+n+1,0);
        dc=0;
        ext.clear();
        dfs(1,0);
        if(dc!=n)
        {
            cout<<"No\n";
            continue;
        }
        vector<ull> val;
        map<ull,vector<pii> >cir;
        for(auto [u,v]:ext)
        {
            val.push_back(rng());
            cir[val.back()].push_back({u,v});
            dv[u]^=val.back();
            dv[v]^=val.back();
        }
        getv(1);
        int ok=1;
        for(int i=2;i<=n;i++)
        {
            if(!dv[i])
                continue;
            if(!cir.count(dv[i]))
            {
                ok=0;
                break;
            }
            cir[dv[i]].push_back({i,fa[i]});
        }
        if(!ok)
        {
            cout<<"No\n";
            continue;
        }
        if(cir.size()!=k)
        {
            cout<<"No\n";
            continue;
        }

        {
            
            multiset<int> csize;
            for(auto &[x,v]:cir)
                csize.insert(v.size());
            int csz=1;
            for(int i=3;i<=k+2;i++)
                if(csize.count(i)!=1)
                    csz=0;
            if(!csz)
            {
                cout<<"No\n";
                continue;
            }
        }
        vector<ull> onc(n+1);
        for(auto [val,v]:cir)
            for(auto [x,y]:v)
                onc[x]=onc[y]=val;
        vector<vector<vector<int> > >pt(n+1);
        for(auto [val,v]:cir)
        {
            set<int> s3;
            for(auto [x,y]:v)
            {
                if(g[x].size()==3)
                    s3.insert(x);
                if(g[y].size()==3)
                    s3.insert(y);
            }
            if(s3.size()!=1)
            {
                ok=0;
                break;
            }
            auto u=*s3.begin();
            int d=0,la=-1;
            int f3=-1;
            vector<int> path;
            int ou=u;
            while(1)
            {
                path.push_back(u);
                vector<int> tar;
                for(auto v:g[u])
                {
                    if(v==la||onc[v]==onc[ou])
                        continue;
                    tar.push_back(v);
                }
                if(!tar.size())
                    break;
                la=u;
                u=tar[0];
                if(g[u].size()==3)
                {
                    f3=u;
                    break;
                }
            }
            if(f3==-1)
                ok&=(k==1&&path.size()>2);
            else
            {
                if(onc[f3])
                    ok&=(k==2&&path.size()>=3);
                else
                {
                    pt[f3].push_back(path);
                }
            }
        }
        int c2=0,c3=0;
        vector<int> tag(n+1);
        // for(int i=1;i<=n;i++)
        //     if(dv[i]) {
        //         tag[i]=1;
        //         // printf("cir %d\n",i);
        //     }
        for(auto &[x,v] : cir) {
            for(auto [a,b] : v) tag[a] = tag[b] = 1;
        }
        for(int i=1;i<=n;i++)
        {
            if(pt[i].size()==0)
                continue;
            else if(pt[i].size()==1)
            {
                for(auto x:pt[i][0])
                    tag[x]=1;
            }
            else if(pt[i].size()==2)
            {
                c2++;
                int fd=0;
                for(auto v:pt[i])
                {
                    if(v.size()==1)
                        tag[v[0]]=1;
                    else
                    {
                        if(!fd)
                        {
                            fd=1;
                            tag[v[0]]=1;
                        }
                        else
                        {
                            for(auto x:v)
                                tag[x]=1;
                        }
                    }
                }
                if(!fd)
                    ok=0;
            }
            else if(pt[i].size()==3)
            {
                if(k!=3)
                    ok=0;
                else
                {
                    int fd=0;
                    for(auto v:pt[i])
                    {
                        if(v.size()==1)
                            tag[v[0]]=1;
                        else
                        {
                            if(fd<2)
                            {
                                fd++;
                                tag[v[0]]=1;
                            }
                            else
                            {
                                for(auto x:v)
                                    tag[x]=1;
                            }
                        }
                    }
                    if(fd<2)
                        ok=0;
                }
                ++c3;
            }
            else
                ok=0;
        }
        ok&=c2<=2;
        ok&=c3<=1;
        if(!ok)
        {
            cout<<"No\n";
            continue;
        }
        // for(int i = 1;i <= n;i++) {
        //     if(!tag[i]) printf("tg %d\n",i) ;
        // }
        map<int,int> deg;
        for(int i=1;i<=n;i++)
            for(auto j:g[i])
            {
                if(j<i)
                    continue;
                if(tag[i]||tag[j])
                    continue;
                deg[i]++,deg[j]++;
            }
        vector<int> cd(2);
        for(auto [x,d]:deg)
        {
            if(d>2)
            {
                ok=0;
                break;
            }
            cd[d-1]++;
        }
        if(cd[0]!=2&&cd[0]!=0)
            ok=0;
        if(!ok)
        {
            cout<<"No\n";
            continue;
        }
        cout<<"Yes\n";
    }
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

Yes
No

result:

ok 2 tokens

Test #2:

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

input:

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

output:

Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No

result:

ok 31 tokens

Test #3:

score: 0
Accepted
time: 50ms
memory: 5660kb

input:

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

output:

No
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Y...

result:

ok 8018 tokens

Test #4:

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

input:

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

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Ye...

result:

ok 5714 tokens

Test #5:

score: 0
Accepted
time: 51ms
memory: 5664kb

input:

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

output:

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

result:

ok 4447 tokens

Test #6:

score: 0
Accepted
time: 56ms
memory: 5728kb

input:

1324
188 190 3
54 144
146 54
175 146
21 175
158 21
95 158
171 95
169 171
141 169
70 141
102 70
19 102
4 19
159 4
24 159
88 24
15 88
139 15
118 139
27 118
112 27
132 112
125 132
80 125
83 80
58 83
179 58
186 179
73 186
108 73
56 108
173 56
82 173
152 82
153 152
160 153
128 160
90 128
116 90
124 116
4...

output:

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

result:

ok 1324 tokens

Test #7:

score: 0
Accepted
time: 71ms
memory: 6440kb

input:

134
1410 1412 3
106 27
458 106
782 458
1310 782
1125 1310
978 1125
321 978
24 321
619 24
86 619
617 86
320 617
1098 320
1128 1098
718 1128
620 718
256 620
865 256
1405 865
878 1405
875 878
242 875
873 242
131 873
1007 131
389 1007
1117 389
651 1117
1102 651
546 1102
65 546
81 65
1388 81
752 1388
728...

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 134 tokens

Test #8:

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

input:

12
11985 11987 3
11734 6512
1902 11734
9252 1902
9820 9252
8101 9820
3603 8101
7558 3603
7842 7558
10845 7842
9298 10845
1375 9298
9762 1375
9267 9762
4646 9267
1016 4646
4128 1016
8809 4128
11051 8809
6272 11051
8985 6272
9486 8985
6734 9486
1875 6734
6762 1875
11836 6762
6299 11836
10083 6299
1134...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 12 tokens

Test #9:

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

input:

1
108420 108422 3
107664 11603
1478 107664
19044 1478
53540 19044
105029 53540
24800 105029
26109 24800
107534 26109
100472 107534
66646 100472
80884 66646
98924 80884
47833 98924
60451 47833
108061 60451
8683 108061
50909 8683
68228 50909
42038 68228
74380 42038
6647 74380
48902 6647
47084 48902
26...

output:

Yes

result:

ok "Yes"

Test #10:

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

input:

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

output:

Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Y...

result:

ok 8002 tokens

Test #11:

score: 0
Accepted
time: 47ms
memory: 5920kb

input:

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

output:

No
No
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
No
No
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
No
No
No
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
No
No
No
No
Yes
Yes
No
Yes
No
No
Yes
No
Yes
No
Yes
No
Y...

result:

ok 5702 tokens

Test #12:

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

input:

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

output:

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

result:

ok 4441 tokens

Test #13:

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

input:

1334
192 196 5
130 167
143 130
36 143
144 36
152 144
50 152
83 50
110 83
70 110
150 70
162 150
189 162
161 189
177 161
118 177
51 118
6 51
169 6
67 169
45 67
9 45
58 9
129 58
50 92
92 135
135 61
61 158
158 65
65 55
55 4
4 163
163 81
81 106
106 184
184 2
2 41
41 15
15 3
3 75
75 148
148 127
127 31
31 ...

output:

Yes
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Y...

result:

ok 1334 tokens

Test #14:

score: 0
Accepted
time: 61ms
memory: 6568kb

input:

133
1906 1932 27
1870 1737
332 1870
142 332
1293 142
1802 1293
1738 1802
524 1738
81 524
1177 81
1014 1177
498 1014
649 498
368 649
9 368
1164 9
1717 1164
1441 1717
1479 1441
1180 1479
747 1180
15 747
292 15
566 292
1410 566
1827 1410
1289 1827
1697 1289
570 1697
830 570
1628 830
1228 1628
1248 1228...

output:

Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
No
Yes
No
Yes
No
Yes
No
No
No
Yes
No
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
No
No
Yes
Yes
Yes
Ye...

result:

ok 133 tokens

Test #15:

score: 0
Accepted
time: 94ms
memory: 11204kb

input:

13
12586 12608 23
7533 7649
10087 7533
6434 10087
11855 6434
2721 11855
2107 2721
2506 2107
2433 2506
1584 2433
12443 1584
8461 12443
9537 8461
7168 9537
4582 7168
5270 4582
711 5270
3174 711
5259 3174
2058 5259
12168 2058
10935 12168
2349 10935
1437 2349
1294 1437
5298 1294
12512 5298
2662 12512
10...

output:

Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
Yes
Yes

result:

ok 13 tokens

Test #16:

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

input:

1
143811 144013 203
49366 8334
101085 49366
113368 101085
3777 113368
124696 3777
91966 124696
66250 91966
108815 66250
7414 108815
53505 7414
78360 53505
7910 78360
42943 7910
42229 42943
47844 42229
71780 47844
5981 71780
46950 5981
74305 46950
7631 74305
82674 7631
105722 82674
101150 105722
1038...

output:

No

result:

ok "No"

Test #17:

score: 0
Accepted
time: 20ms
memory: 3660kb

input:

8018
113379 28 3
24465 31311
78654 89409
8778 98104
90920 50695
8039 97335
65866 5544
44900 14267
58604 59700
71505 61152
103401 99870
14403 10098
99282 110230
53671 6681
40824 89753
63973 104145
95214 30781
8833 18000
104982 51016
4407 110937
54233 55440
101355 8737
29341 35509
41957 79895
110512 4...

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 8018 tokens

Test #18:

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

input:

128
133197 1584 8
6257 26164
99166 75037
57321 128965
54114 13917
26503 54296
8124 9045
93803 125971
71458 100917
26549 67462
18069 25782
33580 57993
92501 47575
21150 90349
116665 27313
101563 31675
86532 69095
99189 93517
107307 124010
16708 85184
22796 107308
5101 132596
54933 88866
74153 47551
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 128 tokens

Test #19:

score: 0
Accepted
time: 35ms
memory: 5644kb

input:

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

output:

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

result:

ok 10000 tokens

Test #20:

score: 0
Accepted
time: 39ms
memory: 5956kb

input:

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

output:

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

result:

ok 5714 tokens

Test #21:

score: 0
Accepted
time: 36ms
memory: 5672kb

input:

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

output:

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

result:

ok 4447 tokens

Test #22:

score: 0
Accepted
time: 42ms
memory: 5672kb

input:

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

output:

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

result:

ok 3631 tokens

Test #23:

score: 0
Accepted
time: 41ms
memory: 5852kb

input:

1324
188 190 3
54 144
146 54
175 146
21 175
158 21
95 158
171 95
169 171
141 169
70 141
102 70
19 102
4 19
159 4
24 159
88 24
15 88
139 15
118 139
27 118
112 27
132 112
125 132
80 125
83 80
58 83
179 58
186 179
73 186
108 73
56 108
173 56
82 173
152 82
153 152
160 153
128 160
90 128
116 90
124 116
4...

output:

No
No
No
No
Yes
No
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
No
No
Yes
No
Yes
No
No
No
No
Y...

result:

ok 1324 tokens

Test #24:

score: 0
Accepted
time: 56ms
memory: 6440kb

input:

134
1410 1412 3
106 27
458 106
782 458
1310 782
1125 1310
978 1125
321 978
24 321
619 24
86 619
617 86
320 617
1098 320
1128 1098
718 1128
620 718
256 620
865 256
1405 865
878 1405
875 878
242 875
873 242
131 873
1007 131
389 1007
1117 389
651 1117
1102 651
546 1102
65 546
81 65
1388 81
752 1388
728...

output:

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

result:

ok 134 tokens

Test #25:

score: 0
Accepted
time: 38ms
memory: 5672kb

input:

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

output:

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

result:

ok 4435 tokens

Test #26:

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

input:

3639
56 59 4
3 25
32 3
20 32
38 20
54 38
17 54
43 17
16 43
31 16
33 31
39 33
37 39
11 37
27 11
45 27
24 45
40 24
50 40
35 50
47 35
18 47
55 18
19 55
51 19
13 51
29 13
4 29
53 4
42 53
22 42
2 22
41 2
1 41
48 1
5 48
34 5
32 28
28 6
6 15
15 44
44 6
37 21
21 14
14 26
26 9
9 21
55 10
10 36
36 56
56 12
12...

output:

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

result:

ok 3639 tokens

Test #27:

score: 0
Accepted
time: 44ms
memory: 5764kb

input:

1340
132 135 4
108 61
27 108
87 27
38 87
7 38
35 7
114 35
11 114
37 11
50 37
10 50
48 10
28 48
9 28
45 9
81 45
130 81
78 130
5 78
42 5
106 42
83 106
104 83
22 104
19 22
76 19
115 76
6 115
113 6
26 113
44 26
97 44
15 97
88 15
14 88
75 14
89 75
58 89
18 58
12 18
109 12
41 109
122 41
92 122
84 92
23 84...

output:

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

result:

ok 1340 tokens

Test #28:

score: 0
Accepted
time: 55ms
memory: 6404kb

input:

132
1510 1513 4
1210 1014
197 1210
850 197
1018 850
531 1018
1279 531
43 1279
120 43
1 120
1019 1
1160 1019
88 1160
920 88
999 920
858 999
868 858
466 868
577 466
714 577
589 714
54 589
494 54
94 494
1085 94
759 1085
1173 759
33 1173
1411 33
1405 1411
187 1405
560 187
18 560
754 18
648 754
226 648
9...

output:

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

result:

ok 132 tokens

Test #29:

score: 0
Accepted
time: 37ms
memory: 5736kb

input:

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

output:

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

result:

ok 4441 tokens

Test #30:

score: 0
Accepted
time: 37ms
memory: 5660kb

input:

3628
55 58 4
55 26
49 55
39 49
18 39
55 4
4 42
42 30
30 48
48 5
5 24
24 6
6 9
9 47
47 44
44 45
45 31
31 43
43 53
53 27
27 3
3 53
39 12
12 14
14 21
21 8
8 12
18 41
41 50
50 2
2 37
37 23
23 33
33 52
52 22
22 13
13 29
29 16
16 52
49 36
36 40
40 15
15 1
1 20
20 46
46 38
38 7
7 10
10 32
32 28
28 54
54 35...

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

result:

ok 3628 tokens

Test #31:

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

input:

1334
192 196 5
130 167
143 130
36 143
144 36
152 144
50 152
83 50
110 83
70 110
150 70
162 150
189 162
161 189
177 161
118 177
51 118
6 51
169 6
67 169
45 67
9 45
58 9
129 58
50 92
92 135
135 61
61 158
158 65
65 55
55 4
4 163
163 81
81 106
106 184
184 2
2 41
41 15
15 3
3 75
75 148
148 127
127 31
31 ...

output:

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

result:

ok 1334 tokens

Test #32:

score: 0
Accepted
time: 54ms
memory: 6340kb

input:

134
1759 1764 6
1244 131
610 1244
1000 610
1563 1000
999 1563
1124 999
1345 1124
38 1345
1383 38
1312 1383
1418 1312
390 1418
423 390
770 423
723 770
528 723
602 528
690 602
2 690
676 2
1128 676
66 1128
642 66
938 642
242 938
3 242
300 3
62 300
1654 62
1240 1654
1513 1240
141 1513
190 141
984 190
84...

output:

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

result:

ok 134 tokens

Test #33:

score: 0
Accepted
time: 83ms
memory: 8684kb

input:

13
14294 14301 8
10915 10836
9921 10915
4960 9921
168 4960
4398 168
7421 4398
14196 7421
1034 14196
13584 1034
7780 13584
3520 7780
11224 3520
1574 11224
9716 1574
2982 9716
12553 2982
8129 12553
3048 8129
9965 3048
7604 9965
10683 7604
96 10683
9294 96
4551 9294
9503 4551
3234 9503
3755 3234
4761 3...

output:

No
No
No
No
No
Yes
No
No
No
No
Yes
No
No

result:

ok 13 tokens

Test #34:

score: 0
Accepted
time: 37ms
memory: 3640kb

input:

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

output:

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

result:

ok 4455 tokens

Test #35:

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

input:

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

output:

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

result:

ok 3635 tokens

Test #36:

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

input:

1338
166 174 9
156 65
146 156
45 146
27 45
113 27
105 113
147 105
159 147
13 159
113 70
70 41
41 62
62 152
152 120
120 34
34 111
111 53
53 19
19 155
155 91
91 39
39 157
157 93
93 116
116 122
122 145
145 67
67 7
7 26
26 71
71 108
108 60
60 89
89 5
5 161
161 4
4 127
127 135
135 14
14 80
80 44
44 119
1...

output:

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

result:

ok 1338 tokens

Test #37:

score: 0
Accepted
time: 46ms
memory: 4536kb

input:

133
1906 1932 27
1870 1737
332 1870
142 332
1293 142
1802 1293
1738 1802
524 1738
81 524
1177 81
1014 1177
498 1014
649 498
368 649
9 368
1164 9
1717 1164
1441 1717
1479 1441
1180 1479
747 1180
15 747
292 15
566 292
1410 566
1827 1410
1289 1827
1697 1289
570 1697
830 570
1628 830
1228 1628
1248 1228...

output:

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

result:

ok 133 tokens

Test #38:

score: 0
Accepted
time: 70ms
memory: 9652kb

input:

13
12586 12608 23
7533 7649
10087 7533
6434 10087
11855 6434
2721 11855
2107 2721
2506 2107
2433 2506
1584 2433
12443 1584
8461 12443
9537 8461
7168 9537
4582 7168
5270 4582
711 5270
3174 711
5259 3174
2058 5259
12168 2058
10935 12168
2349 10935
1437 2349
1294 1437
5298 1294
12512 5298
2662 12512
10...

output:

Yes
No
No
No
No
No
No
No
No
No
No
No
No

result:

ok 13 tokens

Test #39:

score: 0
Accepted
time: 92ms
memory: 16120kb

input:

5
39998 40000 3
19203 39454
8712 19203
34896 8712
633 34896
26444 633
19452 26444
981 19452
22110 981
15803 22110
16105 15803
13627 16105
1461 13627
3531 1461
14348 3531
31156 14348
24034 31156
15052 24034
24951 15052
29849 24951
26927 29849
3711 26927
34638 3711
9944 34638
4491 9944
13217 4491
1117...

output:

No
No
No
No
Yes

result:

ok 5 tokens

Test #40:

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

input:

5
39998 40000 3
17875 14312
5391 17875
11532 5391
21164 11532
9995 21164
2994 9995
14249 2994
15826 14249
29338 15826
38631 29338
29866 38631
19330 29866
9096 19330
34629 9096
7232 34629
8314 7232
22571 8314
33030 22571
37937 33030
5914 37937
22578 5914
12077 22578
33857 12077
16617 33857
32032 1661...

output:

No
No
No
No
Yes

result:

ok 5 tokens

Test #41:

score: 0
Accepted
time: 94ms
memory: 18180kb

input:

5
39997 40000 4
31691 15766
9964 31691
35578 9964
14305 35578
27305 14305
7854 27305
8942 7854
31729 8942
11871 31729
12663 11871
21501 12663
16907 21501
16975 16907
38065 16975
24609 38065
37429 24609
16881 37429
9273 16881
36208 9273
25075 36208
7699 25075
39812 7699
34147 39812
10938 34147
5370 1...

output:

No
No
No
No
No

result:

ok 5 tokens

Test #42:

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

input:

5
39904 40000 97
36252 14408
14834 36252
17993 14834
35245 17993
34734 35245
24739 34734
17061 24739
7087 17061
14721 7087
8077 14721
20031 8077
27240 20031
19587 27240
3946 19587
36039 3946
18601 36039
37888 18601
7125 37888
19310 7125
38818 19310
694 38818
6868 694
14560 6868
1434 14560
17916 1434...

output:

Yes
No
No
No
No

result:

ok 5 tokens

Test #43:

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

input:

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

output:

Yes
No
Yes
No
No

result:

ok 5 tokens

Test #44:

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

input:

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

output:

No
No
No
No
Yes
No
No
No
Yes
Yes

result:

ok 10 tokens

Test #45:

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

input:

200000
166293 1 86752
60291 129175
152797 1 8137
30268 27298
110416 1 11845
47422 53505
64474 1 18044
26485 34444
39597 1 182372
4994 37537
13607 1 138014
7978 8407
58243 1 152462
5072 31895
121905 1 95473
26222 101860
57460 1 97135
40134 11086
69116 1 98686
37295 65748
28376 1 84113
7574 11783
1851...

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 200000 tokens

Test #46:

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

input:

199837
187164 1 131187
86201 31732
126507 1 17659
29370 11546
155897 1 18150
122441 145079
168153 1 130132
66886 112075
138664 1 80080
89045 43744
192135 1 66546
105316 21932
104155 1 7274
21124 29620
123481 1 117299
2275 32548
89580 1 153699
18414 61421
37199 1 98262
31896 13514
23823 1 110335
2135...

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 199837 tokens

Test #47:

score: 0
Accepted
time: 35ms
memory: 5644kb

input:

107697
65656 2 183519
42992 42397
53349 28191
144563 1 42839
115454 4902
129079 2 109580
4123 122689
91374 103993
18705 1 137710
12985 13894
145072 1 192597
36255 20265
82732 4 70109
11195 57356
22721 45850
82498 81101
20458 11001
48506 1 111856
7396 12448
107159 1 165330
71085 52229
101029 1 154141...

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 107697 tokens

Test #48:

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

input:

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

output:

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

result:

ok 13399 tokens

Test #49:

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

input:

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

output:

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

result:

ok 13414 tokens

Test #50:

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

input:

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

output:

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

result:

ok 13332 tokens

Test #51:

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

input:

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

output:

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

result:

ok 13432 tokens

Test #52:

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

input:

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

output:

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

result:

ok 13316 tokens

Test #53:

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

input:

1
140065 200000 594
135408 28203
32063 15708
9868 17546
44492 11763
69790 4284
78935 71163
107363 21700
92913 98292
49642 106510
19026 39057
106669 23126
132076 40811
39769 108328
103085 72628
33105 120130
78085 89440
106457 129179
32836 128125
120944 54276
114408 104078
74210 58464
48320 130397
535...

output:

No

result:

ok "No"

Test #54:

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

input:

1
199407 200000 594
14833 173262
197459 14833
73975 197459
78889 73975
122208 78889
115193 122208
133022 115193
43267 133022
164131 43267
53176 164131
104950 53176
91963 104950
53973 91963
5097 53973
118717 5097
129913 118717
151477 129913
28971 151477
54025 28971
135919 54025
107750 135919
131212 1...

output:

No

result:

ok "No"

Test #55:

score: 0
Accepted
time: 207ms
memory: 46408kb

input:

1
199526 200000 475
189738 28058
104640 21062
123593 58184
161497 195510
151664 135329
91280 179644
43083 138151
177815 191613
107067 182853
179006 129623
63412 5601
60549 15219
94719 6864
131582 116571
162792 135677
9379 179549
93904 80403
71173 45724
182617 147161
183992 116729
56864 134023
51237 ...

output:

Yes

result:

ok "Yes"

Test #56:

score: 0
Accepted
time: 209ms
memory: 47324kb

input:

1
199394 200000 607
79339 174562
54058 33979
40014 121628
117748 128209
95792 148293
90358 110811
196360 8562
52700 185528
177083 144171
169036 109093
190119 11581
59211 105
63602 195181
51300 49208
137395 81812
114278 86074
131331 73546
186872 44023
68840 190995
161609 60771
194760 23746
153578 937...

output:

Yes

result:

ok "Yes"

Test #57:

score: 0
Accepted
time: 219ms
memory: 45936kb

input:

1
199762 200000 239
190639 29777
99224 35111
167913 114727
5393 167891
135129 171582
23302 190622
20712 36976
199569 152126
117691 160198
42536 159264
16684 143228
68440 84684
196069 193139
166608 39675
121596 41248
197751 112508
193375 122768
174194 85468
119461 46240
64743 78659
48824 97979
20270 ...

output:

Yes

result:

ok "Yes"

Test #58:

score: 0
Accepted
time: 190ms
memory: 46432kb

input:

1
199566 200000 435
156810 143874
77234 154431
68448 81117
76855 143268
120334 49386
118162 22662
55003 141540
183977 116083
54641 109603
65588 195861
120350 75047
95212 175712
195650 153186
57588 61919
4259 4524
173801 153346
114521 145889
158301 113425
69835 44773
147438 163654
168963 1997
143439 ...

output:

Yes

result:

ok "Yes"

Test #59:

score: 0
Accepted
time: 196ms
memory: 46424kb

input:

1
199934 200000 67
88552 77668
129667 194637
90499 10177
141242 87315
92080 39112
56316 26022
135406 71592
12182 183173
113204 8882
8210 108600
132323 56267
126992 107070
37502 39415
178613 53240
46668 54433
121924 125525
168563 165381
150974 16045
58745 103794
122966 130810
47116 145348
104167 1490...

output:

Yes

result:

ok "Yes"