#include #include #include #include using namespace std; //1-indexed #include template struct BIT{ int n; vectorbit; BIT(int n_=0):n(n_),bit(n_+1){} T sum(int i) { T ans=0; for(;i>0;i-=i&-i)ans+=bit[i]; return ans; } void add(int i,T a) { if(i==0)return; for(;i<=n;i+=i&-i)bit[i]+=a; } int lower_bound(T k)//k<=sum(ret) { if(k<=0)return 0; int ret=0,i=1; while((i<<1)<=n)i<<=1; for(;i;i>>=1) if(ret+i<=n&&bit[ret+i]op(pairl,pairr){return max(l,r);} paire(){return make_pair(-1,-1);} int N; string X[2<<17]; string Y[2<<17]; atcoder::segtree,op,e>seg; bool f(int l,int r) { if(l==r)return X[l]=="True"; int idx=seg.prod(l,r).second; bool L=f(l,idx),R=f(idx+1,r); //cout<>T; for(;T--;) { cin>>N; for(int i=0;i>X[i]; for(int i=0;i>Y[i]; BITbit(N-1); for(int i=1;i<=N-1;i++)bit.add(i,1); vector >init(N-1,e()); for(int i=0;i>s; int idx=bit.lower_bound(s)-1; assert(init[idx]==e()); init[idx]=make_pair(i,idx); bit.add(idx+1,-1); } seg=atcoder::segtree,op,e>(init); cout<<(f(0,N-1)?"True\n":"False\n"); } }