#include <bits/stdc++.h>
using namespace std;
inline void Boost() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  Boost();
  int i, j;
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    if (n % 3 == 0 || n % 7 == 0) {
      cout << "YES\n";
      continue;
    }
    bool flag = false;
    while (n > 0) {
      if (n % 7 == 0) flag = true;
      n -= 3;
    }
    if (flag)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
