#include <bits/stdc++.h>
#define MODE 0
#if MODE == 1
#define debug(x) cout << #x << ": " << x << endl
#define log(x) cout << x << endl
#else
#define debug(x)
#define log(x)
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
void solve() {
int n;
cin >> n;
int w = 2023 - n;
int diff = n - w;
int v = 0;
while (v * v * v - 3 * v * v < diff && v < 7)
++v;
cout << v << '\n';
/*
for (int i = 0; i < 7; ++i) {
for (int j = 0; j < 17; ++j) {
for (int k = 0; k < 17; ++k) {
if (n == 0) {
cout << '.';
--w;
} else if (w == 0) {
cout << '#';
--n;
} else if (((i^j^k)&1)) {
cout << '#';
--n;
} else {
cout << '.';
--w;
}
}
cout << '\n';
}
cout << '\n';
}*/
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int t;
cin >> t;
while (t--) {
solve();
}
}