#include <bits/stdc++.h>
int main() {
  int n, i, c, p, t;
  scanf("%d", &t);
  while (t--) {
    p = 0;
    scanf("%d", &n);
    while (n >= 2) {
      c = 2;
      for (i = 1; c <= n; i++) {
        n = n - c;
        c = (i + 1) * 2 + i;
      }
      p++;
    }
    printf("%d\n", p);
  }
}
