fenwickf; f.malloc(2d5); ll@t; rep(t){ ll@n,x[n],y[n]; rep(i,n){ string@s; x[i]=s[0]=='T'; } rep(i,n-1){ string@s; y[i+1]=s[0]; } f.init(n); rep(i,n-1){ ll@s--; ll a=bsearch_min[ll,a,0,n](a-f.get(a)>=s); ll b=bsearch_min[ll,b,0,n](b-f.get(b)>=s+1); f.add(b,1); if(y[b]=='a')x[a]&=x[b]; if(y[b]=='o')x[a]|=x[b]; if(y[b]=='x')x[a]^=x[b]; if(y[b]=='i')x[a]=x[a]<=x[b]; } wt(x[0]?"True":"False"); }