#include <bits/stdc++.h>
using namespace std;
long long int SUM(long long int n) {
  if (n <= 0) return 0;
  return ((n * (n + 1)) >> 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  long long int itr_i, itr_j, itr_l, itr_k;
  long long int testCases, num_n, num_k, num_m, minimum;
  cin >> testCases;
  while (testCases--) {
    cin >> num_n >> num_m >> num_k;
    if (num_m < (num_n - 1) or num_m > SUM(num_n - 1)) {
      cout << "NO"
           << "\n";
      continue;
    }
    num_k -= 2;
    if (num_n == 1) {
      if (num_k < 0)
        cout << "NO"
             << "\n";
      else
        cout << "YES"
             << "\n";
      continue;
    }
    if (num_k <= 0) {
      cout << "NO"
           << "\n";
      continue;
    }
    if (num_m == SUM(num_n - 1)) {
      cout << "YES"
           << "\n";
      continue;
    }
    if (num_k >= 2)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
  return 0;
}
