#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e6;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
struct point {
  long long x, y;
  point() {}
  point(long long _x, long long _y) : x(_x), y(_y) {}
  friend point operator+(point a, point b) {
    return point(a.x + b.x, a.y + b.y);
  }
  friend point operator-(point a, point b) {
    return point(a.x - b.x, a.y - b.y);
  }
  friend long long operator^(point a, point b) { return a.x * b.y - a.y * b.x; }
  friend bool operator<(point a, point b) {
    return (a.x == b.x) ? (a.y < b.y) : (a.x < b.x);
  }
};
set<point> S;
set<point>::iterator pre, nxt, pre2, nxt2;
long long mana;
void Insert(point p) {
  nxt = S.lower_bound(p);
  pre = nxt;
  --pre;
  if (nxt != S.end() && ((p - *pre) ^ (*nxt - p)) <= 0) return;
  if (nxt != S.end()) {
    nxt2 = nxt;
    ++nxt2;
    while (nxt2 != S.end() && ((*nxt - p) ^ (*nxt2 - *nxt)) <= 0) {
      S.erase(nxt);
      nxt = nxt2;
      ++nxt2;
    }
  }
  if (pre != S.begin()) {
    pre2 = pre;
    --pre2;
    while (pre != S.begin() && ((*pre - *pre2) ^ (p - *pre)) <= 0) {
      S.erase(pre);
      pre = pre2;
      --pre2;
    }
  }
  S.insert(p);
}
bool Query(long long t, long long h) {
  nxt = S.lower_bound(point((h - 1) / t + 1, 0));
  if (nxt == S.end()) return 0;
  pre = nxt;
  --pre;
  long long xl = pre->x, yl = pre->y, xr = nxt->x, yr = nxt->y;
  return yl * (xr * t - h) + yr * (h - xl * t) <= mana * (xr - xl);
}
void solve() {
  int q, op, j = 0;
  long long a, b;
  read(q);
  read(mana);
  S.insert(point(0, 0));
  for (int i = 1; i <= q; ++i) {
    read(op);
    read(a);
    read(b);
    a = (a + j) % MOD + 1;
    b = (b + j) % MOD + 1;
    if (op == 1) {
      Insert(point(a, b));
    } else {
      if (Query(a, b)) {
        puts("YES");
        j = i;
      } else {
        puts("NO");
      }
    }
  }
}
int main() {
  solve();
  return 0;
}
