#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int s[t];
  int sres[100];
  int mayor = 100;
  for (int i = 0; i < t; ++i) {
    int sd;
    cin >> sd;
    s[i] = sd;
  }
  for (int i = 0; i < t; ++i) {
    int d = s[i];
    int cont = 0;
    while (d > 7) {
      cont += (d / 3);
      d = d / 3;
    }
    cont++;
    cout << cont << endl;
  }
  return 0;
}
