#include <bits/stdc++.h>
using namespace std;
const long long INF = 987654321;
const long long MOD = 1e9 + 7;
const int N = 10100;
bool flag[N];
int main() {
  int t, m;
  cin >> t;
  memset(flag, false, sizeof(flag));
  for (int i = 0; i < 50; i++)
    for (int j = 0; j < 20; j++) flag[i * 3 + j * 7] = true;
  while (t--) {
    scanf("%d", &m);
    if (flag[m])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
