#include <stdio.h>
#include <set>
#include <algorithm>
#define INF 1000000010
#define MAXN 200010
using namespace std;
multiset<int> up;
multiset<int, greater<int> > down;
int Q, cnt, rt;
struct Node {
int val, lc, rc;
} t[50*MAXN];
void modify(int& p, int l, int r, int x, int d) {
if (!p) {
p = ++cnt;
t[p].val = INF;
}
if (l == r) {
t[p].val = d;
return;
}
int mid = ((long long)l + (long long)r) >> 1;
if (x <= mid) modify(t[p].lc, l, mid, x, d);
if (x > mid) modify(t[p].rc, mid + 1, r, x, d);
t[p].val = min(t[t[p].lc].val, t[t[p].rc].val);
}
int query(int& p, int l, int r, int ll, int rr) {
if (!p) {
p = ++cnt;
t[p].val = INF;
}
if (ll <= l && r <= rr) {
return t[p].val;
}
int mid = ((long long)l + (long long)r) >> 1, ans = INF;
if (ll <= mid) ans = min(ans, query(t[p].lc, l, mid, ll, rr));
if (rr > mid) ans = min(ans, query(t[p].rc, mid + 1, r, ll, rr));
return ans;
}
int main() {
scanf("%d", &Q);
up.insert(-INF);
up.insert(INF);
up.insert(-INF);
up.insert(INF);
down.insert(-INF);
down.insert(INF);
down.insert(-INF);
down.insert(INF);
t[0].val = INF;
for (int i = 1, opt, x; i <= Q; ++i) {
scanf("%d%d", &opt, &x);
if (opt == 1) {
int y1 = *up.lower_bound(x), y2 = *down.lower_bound(x);
up.insert(x);
down.insert(x);
modify(rt, 1, INF, x, x - y2);
if (down.count(y1) <= 1) modify(rt, 1, INF, y1, y1 - x);
} else if (opt == 2) {
multiset<int>::iterator iter1 = up.find(x);
up.erase(iter1);
int y1 = *up.upper_bound(x);
multiset<int, greater<int >>::iterator iter2 = down.find(x);
down.erase(iter2);
int y2 = *down.lower_bound(x), y3;
if (down.count(y2) <= 1) y3 = *down.upper_bound(y2);
else y3 = *down.lower_bound(y2);
modify(rt, 1, INF, x, INF);
if (down.count(y1) <= 1) modify(rt, 1, INF, y1, y1 - y2);
if (y2 != -INF) modify(rt, 1, INF, y2, y2 - y3);
} else {
int b = *down.lower_bound(x), cb = down.count(b), a;
if (cb > 1) a = b;
else a = *down.lower_bound(b - 1);
if (a != -INF && a + b > x) {
printf("Yes\n");
} else {
int d = query(rt, 1, INF, x, INF);
if (d != INF && d < x) {
printf("Yes\n");
} else {
printf("No\n");
}
}
}
}
return 0;
}