#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <queue>

#define rep(i, l, r) for(int i = l; i <= r; i++)
#define down(i, l, r) for(int i = l; i >= r; i--)
#define MS 345678
#define MAX 1037471823
#define Q 103

using namespace std;

struct node
{
	bool a, b, c, d, e, f;
} t[MS], p[MS], a, ll, mm, rr, ls, k;
int n, a1, b1, a2, b2, x, y, kk;
char s[9];
bool c, b[5];

void Change3(int o)
{
	ls.a = a.a || (a.b && t[o].a && a.d) || (a.e && t[o].a && a.f);
	ls.b = (a.b && t[o].b) || (a.e && t[o].f);
	ls.c = t[o].c || (t[o].b && a.c && t[o].d) || (t[o].e && a.c && t[o].f);
	ls.d = (a.d && t[o].d) || (a.f && t[o].e);
	ls.e = (a.e && t[o].d) || (a.b && t[o].e);
	ls.f = (a.f && t[o].b) || (a.d && t[o].f);
	a.a = ls.a, a.b = ls.b, a.c = ls.c, a.d = ls.d, a.e = ls.e, a.f = ls.f;
}

void Change2(int o, int x)
{
	t[o].a = p[x].a || (p[x].b && p[x].c && p[x].d);
	t[o].b = p[x].b || (p[x].c && p[x].d && p[x].a);
	t[o].c = p[x].c || (p[x].d && p[x].a && p[x].b);
	t[o].d = p[x].d || (p[x].a && p[x].b && p[x].c);
	t[o].e = (p[x].a && p[x].d) || (p[x].b && p[x].c);
	t[o].f = (p[x].a && p[x].b) || (p[x].c && p[x].d);
}

void Change(int o)
{
	t[o].a = t[o*2].a || (t[o*2].b && t[o*2+1].a && t[o*2].d) || (t[o*2].e && t[o*2+1].a && t[o*2].f);
	t[o].b = (t[o*2].b && t[o*2+1].b) || (t[o*2].e && t[o*2+1].f);
	t[o].c = t[o*2+1].c || (t[o*2+1].b && t[o*2].c && t[o*2+1].d) || (t[o*2+1].e && t[o*2].c && t[o*2+1].f);
	t[o].d = (t[o*2].d && t[o*2+1].d) || (t[o*2].f && t[o*2+1].e);
	t[o].e = (t[o*2].e && t[o*2+1].d) || (t[o*2].b && t[o*2+1].e);
	t[o].f = (t[o*2].f && t[o*2+1].b) || (t[o*2].d && t[o*2+1].f);
}

void Edit1(int l, int r, int o)
{
	if (l == r) 
	{
		if (a1 == 1) p[l].b = c; else p[l].d = c;
		Change2(o, l);
		return;
	}
	int m = (l+r)/2;
	if (b1 <= m) Edit1(l, m, o*2); else Edit1(m+1, r, o*2+1);
	Change(o);
}

void Edit2(int l, int r, int o)
{
	if (l == r)
	{
		if (l == b1) p[l].a = c; else p[l].c = c;
		Change2(o, l);
		return;
	}
	int m = (l+r)/2;
	if (b1-1 <= m) Edit2(l, m, o*2); 
	else if (m+1 <= b1) Edit2(m+1, r, o*2+1);
	Change(o);
}

void Ask(int l, int r, int o)
{
	if (x <= l && r <= y) 
	{
		Change3(o);
		return;
	}
	int m = (l+r)/2;
	if (x <= m) Ask(l, m, o*2); 
	if (m+1 <= y) Ask(m+1, r, o*2+1);
}

int main()
{
	scanf("%d%s", &n, s);
	k.b = k.d = true, k.a = k.c = k.e = k.f = false;
	while (s[0] != 'E')
	{
		scanf("%d%d%d%d", &a1, &b1, &a2, &b2);
		if (b1 > b2) kk = a1, a1 = a2, a2 = kk, kk = b1, b1 = b2, b2 = kk;
		if (s[0] == 'O')
		{
			c = true;
			if (a1 == a2) Edit1(1, n-1, 1); else Edit2(1, n-1, 1);
		}
		else if (s[0] == 'C')
		{
			c = false; 
			if (a1 == a2) Edit1(1, n-1, 1); else Edit2(1, n-1, 1);
		}
		else if (s[0] == 'A')
		{
			ll.a = k.a, ll.b = k.b, ll.c = k.c, ll.d = k.d, ll.e = k.e, ll.f = k.f;
			mm.a = k.a, mm.b = k.b, mm.c = k.c, mm.d = k.d, mm.e = k.e, mm.f = k.f;
			rr.a = k.a, rr.b = k.b, rr.c = k.c, rr.d = k.d, rr.e = k.e, rr.f = k.f;
			if (1 <= b1-1)
			{ 
				x = 1, y = b1-1; 
				a.a = k.a, a.b = k.b, a.c = k.c, a.d = k.d, a.e = k.e, a.f = k.f;
				Ask(1, n-1, 1); 
				ll.a = a.a, ll.b = a.b, ll.c = a.c, ll.d = a.d, ll.e = a.e, ll.f = a.f;
			}
			if (b1 <= b2-1)
			{ 
				x = b1, y = b2-1; 
				a.a = k.a, a.b = k.b, a.c = k.c, a.d = k.d, a.e = k.e, a.f = k.f;
				Ask(1, n-1, 1); 
				mm.a = a.a, mm.b = a.b, mm.c = a.c, mm.d = a.d, mm.e = a.e, mm.f = a.f;
			}
			if (b2 <= n-1)
			{ 
				x = b2, y = n-1; 
				a.a = k.a, a.b = k.b, a.c = k.c, a.d = k.d, a.e = k.e, a.f = k.f;
				Ask(1, n-1, 1); 
				rr.a = a.a, rr.b = a.b, rr.c = a.c, rr.d = a.d, rr.e = a.e, rr.f = a.f;
			}
			if ((a1 == 1 && a2 == 1 && (mm.b || (ll.c && mm.f) || (mm.e && rr.a) || (ll.c && mm.d && rr.a))) || 
				(a1 == 1 && a2 == 2 && (mm.e || (ll.c && mm.d) || (mm.b && rr.a) || (ll.c && mm.f && rr.a))) ||
				(a1 == 2 && a2 == 1 && (mm.f || (ll.c && mm.b) || (mm.d && rr.a) || (ll.c && mm.e && rr.a))) ||
				(a1 == 2 && a2 == 2 && (mm.d || (ll.c && mm.e) || (mm.f && rr.a) || (ll.c && mm.b && rr.a))) )
				printf("Y\n"); 
			else printf("N\n");
		}
		scanf("%s", s);
	}
	return 0;
}
