#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10 * 1000;
const int MAXW = 100 * 1000;
bool d[MAXW + 10];
int p[MAXW + 10];
int a[MAXN + 10];
int w;
int main() {
  ios::sync_with_stdio(false);
  a[0] = 7;
  a[1] = 3;
  int q;
  cin >> q;
  for (int i = 1; i <= q; i++) {
    cin >> w;
    d[0] = 1;
    for (int i = 0; i < 2; i++)
      for (int j = 1; j <= w; j++)
        if (j >= a[i] && d[j - a[i]] == 1) {
          d[j] = 1;
          p[j] = j - a[i];
        }
    if (d[w] == 0)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
    }
  }
  return 0;
}
