#include <bits/stdc++.h>
using namespace std;
const long long N = 2 * 1e5 + 11;
const long double pi = 3.14159265358979323846;
const long long INF = 1e9 + 1;
const long double eps = 1e-18 + 1;
long long t;
int main() {
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long ans = 0;
    while (true) {
      if (n <= 1) break;
      long long i = 1;
      while (true) {
        if (n - (i * 3) + 1 < 0) break;
        n -= i * 3;
        n += 1;
        i++;
      }
      ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
