#include <bits/stdc++.h>
using namespace std;
void fun(long long x) {
  if (x % 7 == 0 || x % 3 == 0 || x % 3 == 1 && x > 7 || x % 3 == 2 && x > 14)
    printf("YES\n");
  else
    printf("NO\n");
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    fun(n);
  }
}
