#include <bits/stdc++.h>
using namespace std;
void solve() {
  int x{};
  cin >> x;
  if (x % 3 == 0 || x % 7 == 0) {
    cout << "YES" << endl;
    return;
  }
  int ms{x / 3};
  int ml{x / 7};
  for (int i{0}; i <= ms; ++i) {
    for (int j{0}; j <= ml; ++j) {
      int chunks{3 * i + 7 * j};
      if (chunks == x) {
        cout << "YES" << endl;
        return;
      }
    }
  }
  cout << "NO" << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t{};
  cin >> t;
  while (t > 0) {
    solve();
    t--;
  }
  return 0;
}
