//我必须考虑这是否是我此生仅有的机会
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using Heap = __gnu_pbds::priority_queue<T, std::less<T>, pairing_heap_tag>;
template <typename T>
using RBTree =
__gnu_pbds::tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define lc u<<1
#define rc u<<1|1
#define pb push_back
#define vt vector
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define PII pair<int,int>
#define endl "\n"
#define il inline
#define yn(ans) printf("%s\n", (ans)?"Yes":"No");
#define YN(ans) printf("%s\n", (ans)?"YES":"NO");
typedef unsigned long long ULL;
typedef long long ll;
template <typename T>
void debug(vector<T> v) {
cerr << "debug-------debug" << endl;
for (auto& p : v) cerr << p << " ";
cerr << endl << "debug-------debug" << endl;
}
il int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')f = -1;
ch = getchar();
}
while (ch >= '0' &&
ch <= '9')x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
return x * f;
}
mt19937_64 rnd(time(0));
int rndRange(int l, int r) {
return rnd() % (r - l + 1) + l;
}
const ll inf = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const int MOD = 998244353;
const int P = 13331;
const int N = 200005;
void solve() {
vt<int> v, vis(1000, 0);
int n;
cin >> n;
for (int i = 1; i <= 6; i++) {
v.pb(i * i);
vis[i * i] = 1;
}
for (int i = 1; i <= 100; i++) {
if (vis[i]) {
for (auto p : v) {
vis[i - 1 + p] = 1;
}
}
}
if (n > 100) {
cout << "Yes" << endl;
} else {
if (!vis[n]) {
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
}
signed main() {
std::ios::sync_with_stdio(0);
std::cin.tie(0);
std::cout.tie(0);
int times = 1;
cin >> times;
while (times--) {
solve();
}
return 0;
}