#include <bits/stdc++.h>
using namespace std;
int n, x, a[10000];
int main() {
  cin >> n;
  a[0] = 1;
  for (int i = 0; i <= 100; i++) {
    if (a[i] == 1) {
      a[i + 3] = 1;
      a[i + 7] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (a[x] == 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
