#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  while (n--) {
    long long x;
    cin >> x;
    long long flag = 0;
    for (long long i = 0; i < 34; i++) {
      for (long long j = 0; j < 15; j++) {
        if (x == (i * 3 + j * 7)) {
          flag = 1;
          break;
        }
      }
      if (flag == 1) break;
    }
    if (flag == 1) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
