#include <bits/stdc++.h>
int main() {
  int T;
  scanf("%d\n", &T);
  for (int ti = 0, tn = T; ti < tn; ++ti) {
    int X;
    scanf("%d\n", &X);
    bool found = false;
    for (int i = 0; 7 * i <= X && !found; ++i) found = ((X - 7 * i) % 3 == 0);
    printf("%s\n", found ? "YES" : "NO");
  }
  return 0;
}
