#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
int t, x;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> t;
  while (t--) {
    cin >> x;
    bool done = false;
    for (int i = 0; i <= 100; ++i) {
      for (int j = 0; j <= 100; ++j) {
        if (i * 3 + j * 7 == x) {
          done = true;
          break;
        }
      }
    }
    if (done)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
