#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e6;
set<pair<long long, long long> > node;
long long N, M, O, lst;
pair<long long, long long> operator-(pair<long long, long long> A,
                                     pair<long long, long long> B) {
  return pair<long long, long long>(A.first - B.first, A.second - B.second);
}
long long operator%(pair<long long, long long> A,
                    pair<long long, long long> B) {
  return A.first * B.second - A.second * B.first;
}
void insert(pair<long long, long long> now) {
  auto p = node.lower_bound(now);
  if (p != node.end() && p->first == now.first) return;
  if (p != node.begin()) (--p)->first == now.first ? node.erase(p++) : ++p;
  if (p != node.begin() && p != node.end()) {
    auto p1 = p;
    --p1;
    if ((now - *p1) % (*p - *p1) >= 0) return;
  }
  auto p1 = p;
  if (p != node.begin()) {
    if (--p1 != node.begin()) {
      auto p2 = p1;
      --p2;
      while ((*p1 - *p2) % (now - *p2) >= 0) {
        node.erase(p1);
        if (p2 != node.begin())
          p1 = p2--;
        else {
          p1 = p2;
          break;
        }
      }
    }
    ++p1;
  }
  if (p != node.end())
    while (++p != node.end() && (*p1 - now) % (*p - now) >= 0) {
      node.erase(p1);
      p1 = p;
    }
  node.insert(now);
  if (node.size() >= 2 && (--node.end())->second < (-- --node.end())->second)
    node.erase(--node.end());
}
bool check(long long A, long long B) { return 2e18 / B <= A; }
signed main() {
  ios::sync_with_stdio(0);
  cin >> N >> M;
  node.insert(pair<long long, long long>(0, 0));
  for (long long i = 1; i <= N; ++i) {
    long long X, A, B;
    cin >> X >> A >> B;
    A = (A + lst) % MOD + 1;
    B = (B + lst) % MOD + 1;
    if (X == 1)
      insert(pair<long long, long long>(B, A));
    else {
      auto t = node.lower_bound(
          pair<long long, long long>(M / A - (M % A ? 0 : 1), 1e18));
      if (t == node.end())
        lst = (--t)->second * A >= B ? i : lst;
      else {
        auto q = t--;
        lst = check(q->second - t->second, M - A * t->first) ||
                      check(A * t->second, q->first - t->first) ||
                      B * (q->first - t->first) <=
                          (q->second - t->second) * (M - A * t->first) +
                              A * t->second * (q->first - t->first)
                  ? i
                  : lst;
      }
      puts(i == lst ? "YES" : "NO");
    }
  }
  return 0;
}
