#include <bits/stdc++.h>
using namespace std;
int solve(int a) {
  vector<int> values = {7, 5, 3};
  if (a == 2) return 1;
  if (a % 2 == 1) {
    for (auto i : values)
      if (a >= i) {
        a -= i;
        break;
      }
    return (a != 0) ? 1 + a / 2 : 1;
  }
  return a / 2;
}
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int N;
  cin >> N;
  int a;
  while (N--) {
    cin >> a;
    cout << solve(a) << "\n";
  }
}
