#include using namespace std; using ll=long long; #include using namespace atcoder; using mints=modint998244353; #pragma GCC target ("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define rep(i,a,b) for(it i=(it)(a);i<=(it)b;i++) #define irep(i,a,b) for(int i=(int)(a);i<=(int)b;i++) #define nrep(i,a,b) for(it i=(it)(a);i>=(it)b;i--) #define inrep(i,a,b) for(int i=(int)(a);i>=(int)b;i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define moda 998244353LL #define modb 1000000007LL #define modc 968244353LL #define gyaku 166374059LL #define dai 2500000000000000000LL #define sho -dai #define aoi 1e+18 #define tyu 2500000000 #define giri 1000000000 #define en 3.14159265358979 #define eps 1e-14 #define endl '\n' #define yn(x) cout<<(x?"Yes\n":"No\n"); #define YN(x) cout<<(x?"YES\n":"NO\n"); #define ci(x) cin>>x; #define fi(x) cout<; using ip=pair; using vi=vector; using ivi=vector; using vd=vector; using vs=vector; using vc=vector; using vb=vector; using vp=vector

; using ivp=vector; using sp=set

; using isp=set; using ss=set; using sc=set; using si=set; using isi=set; using svi=set; using vvi=vector; using ivvi=vector; using vvd=vector; using vvs=vector; using vvb=vector; using vvc=vector; using vvp=vector; using ivvp=vector; using vsi=vector; using ivsi=vector; using vsp=vector; using ivsp=vector; using vvsi=vector; using ivvsi=vector; using vvsp=vector; using ivvsp=vector; using vvvi=vector; using ivvvi=vector; using vvvd=vector; using vvvb=vector; using ivvvp=vector; using vvvvi=vector; using ivvvvi=vector; using vvvvd=vector; using mint=modint; using minto=modint1000000007; using vm=vector; using vms=vector; using vmo=vector; using vvm=vector; using vvms=vector; using vvmo=vector; using vvvm=vector; using vvvms=vector; using vvvmo=vector; using vvvvm=vector; using vvvvms=vector; using vvvvmo=vector; using vvvvvm=vector; using vvvvvms=vector; using vvvvvmo=vector; using vvvvvvm=vector; using vvvvvvms=vector; using vvvvvvmo=vector; const it dx[4]={0,1,0,-1}; const it dy[4]={1,0,-1,0}; st abc="abcdefghijklmnopqrstuvwxyz"; st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; st num="0123456789"; st mb="xo"; st MB="XO"; template void scan(vector &a){ rep(i,0,a.size()-1)cin>>a[i]; } template void scan(vector &a,vector&b){ rep(i,0,a.size()-1)cin>>a[i]>>b[i]; } template void scan(vector> &a){ rep(i,0,a.size()-1)cin>>a[i].first>>a[i].second; } template void dec(vector &a){ rep(i,0,a.size()-1)a[i]--; } it gcda(it a,it b){ if(!a||!b){ return max(a,b); } while(a%b&&b%a){ if(a>b)a%=b; else b%=a; } return min(a,b); } it lcma(it a,it b){ return a/gcda(a,b)*b; } const it MOD=modb; vi fact,fact_inv,inv; /* init_nCk :二項係数のための前処理 計算量:O(n) */ void init_nCk(int SIZE){ fact.resize(SIZE+5); fact_inv.resize(SIZE+5); inv.resize(SIZE+5); fact[0]=fact[1]=1; fact_inv[0]=fact_inv[1]=1; inv[1]=1; rep(i,2,SIZE+4){ fact[i]=fact[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; fact_inv[i]=fact_inv[i-1]*inv[i]%MOD; } } /* nCk :MODでの二項係数を求める(前処理 int_nCk が必要) 計算量:O(1) */ it nCk(int n, int k){ assert(!(nrv)swap(ru,rv); siz[ru]+=siz[rv]; par[rv]=ru; } bool same(int u,int v){ return leader(u)==leader(v); } int size(int u){ return siz[leader(u)]; } }; struct dsu2{ ivvi par,siz;int h,w; dsu2(int h,int w){ init(h,w); } void init(int x,int y){ h=x,w=y;par.resize(h),siz.resize(h); rep(i,0,h-1) rep(j,0,w-1)par[i].emplace_back(i*w+j); rep(i,0,h-1) rep(j,0,w-1)siz[i].emplace_back(1); } int leader(int x,int y){ if(par[x][y]==x*par[0].size()+y)return x*w+y; return par[x][y]=leader(par[x][y]/w,par[x][y]%w); } void merge(int a,int b,int c,int d){ int ru=leader(a,b),rv=leader(c,d); if(ru==rv)return; if(size(ru/w,ru%w) struct potedsu{ ivi par,rank; vector diff_weight; potedsu(int n=1,Abel SUM_UNITY=0){ init(n,SUM_UNITY); } void init(int n=1,Abel SUM_UNITY=0){ par.resize(n);rank.resize(n);diff_weight.resize(n); irep(i,0,n-1)par[i]=i,rank[i]=0,diff_weight[i]=SUM_UNITY; } int root(int x){ if(par[x]==x){ return x; } int r=root(par[x]); diff_weight[x]+=diff_weight[par[x]]; return par[x]=r; } Abel weight(int x){ root(x); return diff_weight[x]; } bool issame(int x,int y){ return root(x)==root(y); } bool merge(int x,int y,Abel w){ w+=weight(x);w-=weight(y); x=root(x);y=root(y); if(x==y)return false; if(rank[x]>n>>s; vb dp(n+1);dp[0]=1; irep(i,0,n-1){ if(!dp[i])continue; if(s[i]=='?'||s[i]=='n')dp[i+1]=1; if(i==n-1)break; if((s[i]=='?'||s[i]=='w')&&(s[i+1]=='?'||s[i+1]=='a'||s[i+1]=='o'))dp[i+2]=1; } yn(dp[n]) }