#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const int MOD = 1e+6;
struct node_t {
  node_t* l;
  node_t* r;
  int key;
  int val;
  int prior;
  node_t(int key, int val) : key(key), val(val) {
    l = r = nullptr;
    prior = rand();
  }
};
using pnode_t = node_t*;
void split(pnode_t t, pnode_t& l, pnode_t& r, int key) {
  if (!t) return (void)(l = r = nullptr);
  if (t->key <= key) {
    split(t->r, t->r, r, key);
    l = t;
  } else {
    split(t->l, l, t->l, key);
    r = t;
  }
}
void smart_split(pnode_t t, pnode_t& l, pnode_t& r, int x, int y) {
  if (!t) return (void)(l = r = nullptr);
  if (1LL * t->key * y <= x) {
    smart_split(t->r, t->r, r, x, y);
    l = t;
  } else {
    smart_split(t->l, l, t->l, x, y);
    r = t;
  }
}
pnode_t merge(pnode_t l, pnode_t r) {
  if (!l) return r;
  if (!r) return l;
  if (l->prior < r->prior) {
    l->r = merge(l->r, r);
    return l;
  } else {
    r->l = merge(l, r->l);
    return r;
  }
}
pnode_t get_leftmost(pnode_t t) {
  if (!t) return t;
  while (t->l) t = t->l;
  return t;
}
pnode_t get_rightmost(pnode_t t) {
  if (!t) return t;
  while (t->r) t = t->r;
  return t;
}
bool is_need(pnode_t l, pnode_t m, pnode_t r) {
  if (!r || !l) return true;
  long long dx = r->key - l->key;
  long long dy = r->val - l->val;
  long long left_val = l->val * dx + dy * (m->key - l->key);
  long long right_val = m->val * dx;
  return left_val >= right_val;
}
void show(pnode_t t) {
  if (!t) return;
  show(t->l);
  cout << t->key << ' ';
  show(t->r);
}
void add(pnode_t& root, int x, int y) {
  pnode_t l = nullptr, r = nullptr, m = nullptr;
  split(root, l, r, x);
  split(l, l, m, x - 1);
  if (m) y = min(y, m->val);
  pnode_t newbie = new node_t(x, y);
  pnode_t left = get_rightmost(l);
  pnode_t right = get_leftmost(r);
  if (!is_need(left, newbie, right)) {
    root = merge(l, r);
    return;
  }
  while (true) {
    pnode_t ll = nullptr, lr = nullptr;
    right = get_rightmost(l);
    split(l, ll, lr, right->key - 1);
    if (!ll) {
      l = merge(ll, lr);
      break;
    } else {
      left = get_rightmost(ll);
      if (is_need(left, right, newbie)) {
        l = merge(ll, lr);
        break;
      }
      l = ll;
    }
  }
  while (r) {
    pnode_t rl = nullptr, rr = nullptr;
    left = get_leftmost(r);
    split(r, rl, rr, left->key);
    if (!rr) {
      r = merge(rl, rr);
      break;
    } else {
      right = get_leftmost(rr);
      if (is_need(newbie, left, right)) {
        r = merge(rl, rr);
        break;
      }
      r = rr;
    }
  }
  root = merge(l, merge(newbie, r));
}
bool get_res(pnode_t root, int t, int h, long long m) {
  pnode_t l = nullptr, r = nullptr;
  smart_split(root, l, r, h, t);
  if (!r) {
    bool res = false;
    pnode_t left = get_rightmost(l);
    if (1LL * left->key * t == h && 1LL * left->val * t <= m) res = true;
    root = merge(l, r);
    return res;
  }
  pnode_t left = get_rightmost(l);
  pnode_t right = get_leftmost(r);
  long long dx = right->key - left->key;
  long long dy = right->val - left->val;
  long long left_part = dx * left->val * t + dy * (h - left->key * t);
  long long right_part = m * dx;
  bool res = left_part <= right_part;
  root = merge(l, r);
  return res;
}
int main() {
  auto start = high_resolution_clock::now();
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  srand(time(nullptr));
  int q;
  long long m;
  cin >> q >> m;
  pnode_t root = new node_t(0, 0);
  int last = 0;
  for (int i = 0; i < q; ++i) {
    int type, a, b;
    cin >> type >> a >> b;
    if (type == 1) {
      int x = (a + last) % MOD + 1;
      int y = (b + last) % MOD + 1;
      add(root, x, y);
    } else {
      int t = (a + last) % MOD + 1;
      int h = (b + last) % MOD + 1;
      bool res = get_res(root, t, h, m);
      cout << (res ? "YES" : "NO") << '\n';
      if (res) last = i + 1;
    }
  }
  cerr << "Total execution time : "
       << duration_cast<milliseconds>(high_resolution_clock::now() - start)
              .count()
       << " ms" << endl;
  return 0;
}
