#include <bits/stdc++.h>
#define int long long
#define double long double
#define fi first
#define se second
#define endl "\n"
#define ii pair<int,int>
using namespace std;
const int mod=998244353;
const int N=3e5+5;
int sum(int n){
int ans=n*(n+1)*(2*n+1)/6;
return ans;
}
signed main(){
cin.tie(0) -> sync_with_stdio(false);
freopen("BAI4.INP","r",stdin);
freopen("BAI4.OUT","w",stdout);
int q; cin >> q;
while (q--){
int n; cin >> n;
int l=1,r=1500000;
int ans=0;
while(l<=r){
int m=(l+r)/2;
if (sum(m)<=n){
ans=max(ans,m);
l=m+1;
}
else {
r=m-1;
}
}
cout << ans << " ";
}
return 0;
}
// đứng ở dưới thì code mạnh tay lên ai sợ thì đi về
// phong cách phong cách
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgaW50IGxvbmcgbG9uZwojZGVmaW5lIGRvdWJsZSBsb25nIGRvdWJsZQojZGVmaW5lIGZpIGZpcnN0CiNkZWZpbmUgc2Ugc2Vjb25kCiNkZWZpbmUgZW5kbCAiXG4iCiNkZWZpbmUgaWkgcGFpcjxpbnQsaW50Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgbW9kPTk5ODI0NDM1MzsKY29uc3QgaW50IE49M2U1KzU7CmludCBzdW0oaW50IG4pewoJaW50IGFucz1uKihuKzEpKigyKm4rMSkvNjsKCXJldHVybiBhbnM7Cn0Kc2lnbmVkIG1haW4oKXsKCWNpbi50aWUoMCkgIC0+IHN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CglmcmVvcGVuKCJCQUk0LklOUCIsInIiLHN0ZGluKTsKCWZyZW9wZW4oIkJBSTQuT1VUIiwidyIsc3Rkb3V0KTsKCWludCBxOyBjaW4gPj4gcTsKCXdoaWxlIChxLS0pewoJCWludCBuOyBjaW4gPj4gbjsKCQlpbnQgbD0xLHI9MTUwMDAwMDsKCQlpbnQgYW5zPTA7CgkJd2hpbGUobDw9cil7CgkJCWludCBtPShsK3IpLzI7CgkJCWlmIChzdW0obSk8PW4pewoJCQkJYW5zPW1heChhbnMsbSk7CgkJCQlsPW0rMTsKCQkJfQoJCQllbHNlIHsKCQkJCXI9bS0xOwoJCQl9CgkJfQoJCWNvdXQgPDwgYW5zIDw8ICIgIjsKCX0KCXJldHVybiAwOyAKfQovLyDEkeG7qW5nIOG7nyBkxrDhu5tpIHRow6wgY29kZSBt4bqhbmggdGF5IGzDqm4gYWkgc+G7oyB0aMOsIMSRaSB24buBCi8vIHBob25nIGPDoWNoIHBob25nIGPDoWNoIA==