#include<bits/stdc++.h>
using namespace std;
using ll = unsigned long long int;


bool solve()
{
	ll n; cin >> n;
	ll size = cbrt(n) + 1;
	ll arr[size];
	unordered_set<ll> st;
	for (ll i = 1; i < size; i++)
	{
		arr[i] = (i * i * i);
		st.insert(arr[i]);
	}

	for (ll i = 1; i < size + 2; i++)
	{
		if (st.find(n - arr[i]) != st.end())
		{
			return true;
		}
	}

	return false;

}


int main()
{

#ifndef ONLINE_JUDGE
	//for getting input from input.txt
	freopen("input.txt", "r", stdin);
	freopen("error.txt", "w", stderr);
	//for getting output from output.txt
	freopen("output.txt", "w", stdout);
#endif


	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;
	while (t--)
	{
		if (solve()) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	//return 0;
}
