#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
template <class T>
T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
template <class T>
T sqr(T a) {
  return a * a;
}
template <class T>
T sgn(T a) {
  return a > 0 ? 1 : (a < 0 ? -1 : 0);
}
const int N = 2e5 + 10;
const int inf = 2e9 + 10;
const int mod = 1e9 + 7;
int n;
int m;
int a[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    bool ok = true;
    for (int j = 0; j <= x; j += 3)
      if ((x - j) % 7 == 0) {
        cout << "YES" << endl;
        ok = false;
        break;
      }
    if (!ok) continue;
    for (int j = 0; j <= x; j += 7)
      if ((x - j) % 3 == 0) {
        cout << "YES" << endl;
        ok = false;
        break;
      }
    if (ok) cout << "NO" << endl;
  }
  return 0;
}
