#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    bool ok = 0;
    for (int j = 0; j < 34; j++)
      for (int k = 0; k < 34; k++) {
        if (j * 3 + k * 7 == a) ok = 1;
      }
    printf(ok ? "YES\n" : "NO\n");
  }
  return 0;
}
