#include <bits/stdc++.h>
using namespace std;
const int p = 1e6;
int las;
long long m;
struct Point {
  double x, y;
  Point() {}
  Point(double _x, double _y) {
    x = _x;
    y = _y;
  }
  Point operator+(const Point &a) { return Point(x + a.x, y + a.y); }
  Point operator-(const Point &a) { return Point(x - a.x, y - a.y); }
  double operator*(const Point &a) { return (x * a.x + y * a.y); }
  bool operator<(const Point &a) const {
    return ((x == a.x) ? y < a.y : x < a.x);
  }
};
double cross(Point a, Point b) { return (a.x * b.y - a.y * b.x); }
bool above(Point a, Point b, Point c) { return (cross(b - a, c - a) >= 0); }
set<Point> cur;
void insert(Point x) {
  set<Point>::iterator it = cur.lower_bound(x);
  set<Point>::iterator it1 = it;
  if (it != cur.end()) {
    if (it != cur.begin()) {
      it1--;
      if (above(*it1, *it, x)) {
        return;
      }
    }
  }
  it = cur.lower_bound(x);
  it1 = it;
  while (it != cur.end()) {
    it1++;
    if (it1 != cur.end()) {
      if (above(x, *it1, *it)) {
        cur.erase(it);
      } else {
        break;
      }
    } else {
      break;
    }
    it = cur.lower_bound(x);
    it1 = it;
  }
  it = cur.lower_bound(x);
  while (it != cur.begin()) {
    it--;
    it1 = it;
    if (it1 != cur.begin()) {
      it1--;
      if (above(*it1, x, *it)) {
        cur.erase(it);
      } else {
        break;
      }
    } else {
      break;
    }
    it = cur.lower_bound(x);
  }
  cur.insert(x);
}
void query(int a, int b, int ind) {
  double val = (double)b / a;
  double val1 = (double)m / a;
  set<Point>::iterator it = cur.lower_bound(Point(val, 0));
  if (it == cur.end()) {
    printf("NO\n");
    return;
  }
  set<Point>::iterator it1 = it;
  if (it != cur.begin()) {
    it1--;
    if (above(*it1, *it, Point(val, val1))) {
      Point x = *it1;
      Point y = *it;
      Point z = Point(val, val1);
      printf("YES\n");
      las = ind;
    } else {
      printf("NO\n");
    }
  } else {
    printf("NO\n");
  }
}
int main() {
  cur.insert(Point(0, 0));
  int q;
  scanf("%d", &q);
  scanf("%lld", &m);
  for (int i = 1; i <= q; i++) {
    int typ, a, b;
    scanf("%d %d %d", &typ, &a, &b);
    a = (a + las) % p + 1;
    b = (b + las) % p + 1;
    if (typ == 1) {
      insert(Point(a, b));
    } else {
      query(a, b, i);
    }
  }
  return 0;
}
