#include <bits/stdc++.h>
using namespace std;
const int mod = 1e6;
int q, lstAns, flag;
long long m;
struct point {
  long long x, y;
  point(long long x, long long y) : x(x), y(y) {}
  inline bool operator<(const point &a) const {
    if (flag) return y < a.y;
    return x < a.x;
  }
  inline point operator-(const point &a) const {
    return point(x - a.x, y - a.y);
  }
  inline long long cross(const point &a) const { return x * a.y - y * a.x; }
};
set<point> mag;
inline int addMod(int a, int b) { return (a += b) >= mod ? a - mod : a; }
inline long long quickpow(long long base, long long pw) {
  long long ret = 1;
  while (pw) {
    if (pw & 1) ret = ret * base % mod;
    base = base * base % mod, pw >>= 1;
  }
  return ret;
}
template <class T>
inline void read(T &x) {
  x = 0;
  char ch = getchar(), w = 0;
  while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  x = w ? -x : x;
  return;
}
int main() {
  int opt, x, y;
  read(q), read(m);
  mag.emplace(0, 0);
  for (register int i = 1; i <= q; ++i) {
    read(opt), read(x), read(y);
    x = (x + lstAns) % mod + 1, y = (y + lstAns) % mod + 1;
    if (opt == 1) {
      point tmp(y, x);
      auto r = mag.lower_bound(point(y + 1, 0)), l = prev(r);
      if (r != mag.end() && (tmp - *l).cross(*r - *l) >= 0) continue;
      while (l != mag.begin()) {
        if ((*l - *prev(l)).cross(tmp - *prev(l)) < 0) break;
        mag.erase(l--);
      }
      while (r != mag.end() && r->y <= x) mag.erase(r++);
      while (r != mag.end() && next(r) != mag.end()) {
        if ((*r - tmp).cross(*next(r) - tmp) < 0) break;
        mag.erase(r++);
      }
      mag.insert(tmp);
    } else {
      flag = 1;
      auto r = mag.lower_bound(point(0, ceil((double)y / x))), l = prev(r);
      if (r == mag.end()) {
        printf("NO\n"), flag = 0;
        continue;
      }
      if ((y - l->y * x) * (r->x - l->x) + l->x * (r->y - l->y) * x <=
          m * (r->y - l->y))
        printf("YES\n"), lstAns = i;
      else
        printf("NO\n");
      flag = 0;
    }
  }
  return 0;
}
