#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  map<long long, bool> mymap;
  for (long long i = 0; i <= 1000; i++) {
    for (long long j = 0; j <= 1000; j++) {
      mymap[3 * i + 7 * j] = 1;
    }
  }
  int tc;
  cin >> tc;
  while (tc--) {
    long long n;
    cin >> n;
    if (mymap[n] == 1) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
}
