#include <bits/stdc++.h>
#pragma GCC optimize("O3")
const long long llnrm = LLONG_MAX;
const int nrm = INT_MAX;
const int nrn = INT_MIN;
const int nmax = 1e5 + 5;
const int mod = 1e9 + 7;
const int lim = 1e8;
using namespace std;
int ans, n, tmp;
bool b;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    b = false;
    cin >> tmp;
    while (b == false && tmp > 0) {
      if (tmp % 3 == 0 || tmp % 7 == 0)
        b = true;
      else
        tmp -= 7;
    }
    if (b)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
