#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
constexpr int N = 1.5e7 + 5;
int n;
void Solve() {
  cin >> n;
  for (int i = 0; i * 7 <= n; i++) {
    if ((n - i * 7) % 3 == 0) {
      cout << "YES"
           << "\n";
      return;
    }
  }
  cout << "NO"
       << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t;
  cin >> t;
  while (t--) Solve();
  return 0;
}
