#include #include using namespace std; using ll = long long; using mint = atcoder::modint1000000007; const ll inf = 9e18; struct UnionFind{ vector par; vector size; UnionFind(ll n){ par.resize(2*(n+1),-1); size.resize(2*(n+1),1); } ll root(ll x){ if (par[x]==-1) return x; return par[x]=root(par[x]); } void unite(ll u,ll v){ ll uu=root(u),vv=root(v); if(uu==vv){ return; } if(size[uu]> n; UnionFind tree(n); for(ll x=0;x> m; for(ll i=0;i> y; y--; tree.unite(i,y); } } if(tree.out_size(tree.root(0))==n) cout << "Yes"; else cout << "No"; cout << endl; }