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