#include <bits/stdc++.h>
using namespace std;
const int32_t mod = 1e9 + 7;
const long long inf = 1e18;
set<long long> S;
void doq() {
  for (long long i = 0; i < 40; i++) {
    for (long long j = 0; j < 40; j++) {
      long long a = 3 * i + 7 * j;
      if (a <= 100) S.insert(a);
    }
  }
}
void solve() {
  long long n;
  cin >> n;
  if (S.find(n) != S.end())
    cout << "YES\n";
  else
    cout << "NO\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  doq();
  long long tcs = 1;
  cin >> tcs;
  while (tcs--) {
    solve();
  }
}
