#include <vector>
#include <algorithm>
using namespace std;

/*
 * 演算法 / Algorithm:
 *  離線 + 逆向掃描。先放好所有障礙物，由後往前處理，type-1 視為「移除」(合併兩個間隙)。
 *  segGap 維護相鄰障礙物間的最大間隙，segPos 找出不超過 x 的最大障礙物座標。
 *  Offline + reverse scan: place all obstacles, walk backwards, treat type-1 as removal
 *  (merging two gaps). segGap = max gap between consecutive obstacles; segPos = largest
 *  obstacle position <= x. Each type-2 query is two O(log) lookups.
 */
class Solution {
    // 線段樹：點更新 + 區間最大值 / point-assign + range-max segment tree
    struct Seg {
        int n;                  // 葉子數 / number of leaves
        vector<int> tree;       // 隱式樹，vector 會自動管理記憶體 / implicit tree; vector manages memory
        Seg(int n) : n(n), tree(4 * (n + 1), 0) {}  // 建構：開 4*(n+1) 個 0 / build with zeros

        // 內部遞迴版點更新 / internal recursive point update
        void update(int node, int lo, int hi, int pos, int val) {
            if (lo == hi) { tree[node] = val; return; }      // 葉子直接賦值 / assign at leaf
            int mid = lo + (hi - lo) / 2;                    // 中點 / midpoint
            if (pos <= mid) update(2 * node, lo, mid, pos, val);        // 往左 / go left
            else            update(2 * node + 1, mid + 1, hi, pos, val);// 往右 / go right
            tree[node] = max(tree[2 * node], tree[2 * node + 1]);       // 父=子的最大 / parent = max of children
        }
        void update(int pos, int val) { update(1, 1, n, pos, val); }    // 對外簡化介面 / public wrapper

        // 內部遞迴版區間最大查詢 / internal recursive range-max query
        int query(int node, int lo, int hi, int ql, int qr) {
            if (qr < lo || hi < ql) return 0;                // 無交集 / no overlap
            if (ql <= lo && hi <= qr) return tree[node];     // 完全覆蓋 / fully covered
            int mid = lo + (hi - lo) / 2;
            return max(query(2 * node, lo, mid, ql, qr),
                       query(2 * node + 1, mid + 1, hi, ql, qr)); // 左右取最大 / combine by max
        }
        int query(int ql, int qr) { return query(1, 1, n, ql, qr); }    // 對外簡化介面 / public wrapper
    };

public:
    vector<bool> getResults(vector<vector<int>>& queries) {
        int n = queries.size();
        int maxX = 1;
        vector<int> obs;                                  // 所有障礙物座標 / all obstacle positions
        for (auto& q : queries) {                          // range-for：逐一取出每個查詢 / iterate each query
            maxX = max(maxX, q[1]);                         // q[1] 是 x / x for both types
            if (q[0] == 1) obs.push_back(q[1]);             // type-1 收集障礙物 / collect obstacles
        }
        sort(obs.begin(), obs.end());                       // 由小到大排序 / sort ascending
        int m = obs.size();

        vector<int> pos2idx(maxX + 1, -1);                  // 座標 -> 排序索引，-1 表示無 / position -> sorted index
        for (int i = 0; i < m; i++) pos2idx[obs[i]] = i;

        vector<int> prevArr(m + 1), nextArr(m + 1);         // 雙向鏈結串列 / doubly linked list
        for (int i = 0; i < m; i++) { prevArr[i] = i - 1; nextArr[i] = i + 1; }
        // prevArr[0] = -1：左邊視為座標 0；nextArr[m-1] = m：右邊無障礙物
        // prevArr[0] = -1 acts as coord 0; nextArr[m-1] = m means no right obstacle

        Seg segGap(maxX), segPos(maxX);                     // 兩棵線段樹 / two segment trees
        for (int i = 0; i < m; i++) {
            int gapLeft = obs[i] - (i > 0 ? obs[i - 1] : 0); // 與左鄰的間隙，無左鄰用 0 / gap to left neighbor
            segGap.update(obs[i], gapLeft);
            segPos.update(obs[i], obs[i]);
        }

        vector<int> outSlot(n, -1);                          // 每個查詢的輸出位置 / output slot per query
        int q2 = 0;
        for (int i = 0; i < n; i++) if (queries[i][0] == 2) outSlot[i] = q2++;
        vector<bool> ans(q2);                                // 答案陣列 / answers

        for (int i = n - 1; i >= 0; i--) {                   // 逆向掃描 / reverse scan
            if (queries[i][0] == 1) {
                // --- 移除障礙物 / remove obstacle ---
                int x = queries[i][1], idx = pos2idx[x];
                int l = prevArr[idx], r = nextArr[idx];      // 左右鄰居 / neighbors
                segGap.update(x, 0);                         // 間隙消失 / gap gone
                segPos.update(x, 0);                         // 不再是障礙物 / not an obstacle
                if (l >= 0) nextArr[l] = r;                  // 重接 / relink
                if (r < m)  prevArr[r] = l;                  // 重接 / relink
                if (r < m) {                                 // 右鄰間隙擴大 / right neighbor's gap grows
                    int prevPos = (l >= 0) ? obs[l] : 0;     // 合併後的左界 / merged left bound
                    segGap.update(obs[r], obs[r] - prevPos);
                }
            } else {
                // --- 回答 type-2 / answer type-2 ---
                int x = queries[i][1], sz = queries[i][2];
                int lastObs = segPos.query(1, x);            // 不超過 x 的最近障礙物 / nearest obstacle <= x
                int trailing = x - lastObs;                  // 尾段空白 / trailing span
                int internalMax = segGap.query(1, x);        // 內部最大間隙 / max internal gap (right end <= x)
                ans[outSlot[i]] = max(trailing, internalMax) >= sz; // 取較大者與 sz 比 / fits iff best >= sz
            }
        }
        return ans;
    }
};
