#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  bool ok = false;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ok = false;
    for (int k = 0; k <= x; k++)
      for (int j = 0; j <= x; j++)
        if (x == k * 3 + j * 7) ok = true;
    if (ok)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
