#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#define FOR(i,a,b) for(i=(a);i<=(b);i++)
#define ROF(i,a,b) for(i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define mmt(a,b) memset(a,b,sizeof(a))
#define lc(x) (x<<1)
#define rc(x) ((x<<1)+1)
#define N 300100
using namespace std;
typedef long long LL;
typedef long double LD;
struct value{bool b[2][2],lb,rb;void init(){mmt(b,0);lb=rb=0;}};
bool street[N][2],te[2],f[2][2];int n,k1,k2;char op[10];
struct segtree
{
int l[N],r[N];value v[N];
value merge(value L,value R,int pos)
{
mmt(te,0);int k,i,j;value res;res.init();
te[0]=street[pos][0];te[1]=street[pos][1];
f[0][0]=te[0]||(te[1]&&L.rb&&R.lb);
f[1][1]=te[1]||(te[0]&&L.rb&&R.lb);
f[0][1]=(te[0]&&R.lb)||(te[1]&&L.rb);
f[1][0]=(te[0]&&L.rb)||(te[1]&&R.lb);
FOR(k1,0,1) FOR(k2,0,1) FOR(i,0,1) FOR(j,0,1)
res.b[i][j]=res.b[i][j]||(L.b[i][k1]&&f[k1][k2]&&R.b[k2][j]);
res.lb=L.lb||(L.b[0][0]&&L.b[1][1]&&te[0]&&te[1]&&R.lb);
res.rb=R.rb||(R.b[0][0]&&R.b[1][1]&&te[0]&&te[1]&&L.rb);
return res;
}
void upd(int x){v[x]=merge(v[lc(x)],v[rc(x)],(l[x]+r[x])>>1);}
void build(int x,int L,int R)
{
l[x]=L;r[x]=R;v[x].init();int mid=(L+R)>>1;
if (L==R) {v[x].b[0][0]=v[x].b[1][1]=1;return;}
build(lc(x),L,mid);build(rc(x),mid+1,R);
}
value query(int x,int L,int R)
{
if (l[x]==L&&r[x]==R) return v[x];
int mid=(l[x]+r[x])>>1;
if (R<=mid) return query(lc(x),L,R);
if (L>mid) return query(rc(x),L,R);
return merge(query(lc(x),L,mid),query(rc(x),mid+1,R),mid);
}
void modify1(int x,int p,int nd)
{
if (l[x]==r[x]) {v[x].lb=v[x].rb=v[x].b[0][1]=v[x].b[1][0]=nd;return;}
int mid=(l[x]+r[x])>>1;
if (p<=mid) modify1(lc(x),p,nd);else modify1(rc(x),p,nd);
upd(x);
}
void modify2(int x,int L,int R)
{
if (l[x]==L&&r[x]==R) {if (L!=R) upd(x);return;}
int mid=(l[x]+r[x])>>1;
if (R<=mid) modify2(lc(x),L,R);
else if (L>mid) modify2(rc(x),L,R);
else {modify2(lc(x),L,mid);modify2(rc(x),mid+1,R);}
upd(x);
}
}Tree;
void swap(int &a,int &b){int t=a;a=b;b=t;}
int main()
{
ios::sync_with_stdio(false);
scanf("%d",&n);int x1,y1,x2,y2;
Tree.build(1,1,n);scanf("%s",op);
while (op[0]!='E')
{
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
int nd=(op[0]=='A'?2:(op[0]=='O'?1:0));
if (nd<2)
{
if (x1==x2)
{
if (y1>y2) swap(y1,y2);
street[y1][x1-1]=nd;
Tree.modify2(1,y1,y2);
}else
Tree.modify1(1,y1,nd);
}else
{
if (y1>y2) {swap(x1,x2);swap(y1,y2);}
value r1=Tree.query(1,y1,y2);
value r2=Tree.query(1,1,y1);
value r3=Tree.query(1,y2,n);
x1--,x2--;bool ans;
if (r1.b[x1][x2]) ans=1;
else if (x1==x2) ans=r2.rb&&r3.lb&&r1.b[x1^1][x2^1];
else ans=(r2.rb&&r1.b[x2][x2])||(r3.lb&&r1.b[x1][x1]);
printf("%c\n",ans?'Y':'N');
}
scanf("%s",op);
}
return 0;
}