#include<bits/stdc++.h>

#define cinnumber(a) cin >> a;
#define cinvector(vec) for(auto& it: vec) {cinnumber(it);}
#define printcontainer(container) for(auto it: container) {cout << it << " ";} cout << endl;

using namespace std;
typedef long long int ll;

bool isCube(ll b) {
  ll nearest = pow(b, double(1.0)/double(3.0));
  if (nearest * nearest * nearest == b) {
    return true;
  }
  if ((nearest + ll(1)) * (nearest + ll(1)) * (nearest + ll(1)) == b) {
    return true;
  }
  nearest--;
  if ((nearest > 0) && nearest * nearest * nearest == b) {
    return true;
  }
  return false;
}

int main() {

  int t;
  cin >> t;

  while (t--) {
    ll x;
    cin >> x;

    ll a_max = pow(x, double(1.0)/double(3.0));

    if (a_max * a_max * a_max > x) {
      a_max--;
    }
    if ((a_max + 1) * (a_max + 1) * (a_max + 1) <= x) {
      a_max++;
    }
    
    bool good = false;
    for (ll a = 1; a <= a_max; a++) {
      ll b = x - (a * a * a);
      if (b <= 0) {
        continue;
      }
      if (isCube(b)) {
        good = true;
        break;
      }
    }
    if (good) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
  return 0;
}