#include <bits/stdc++.h>
int main() {
  int n;
  int flag = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    flag = 0;
    int x;
    scanf("%d", &x);
    if (x % 7 == 0) {
      flag = 1;
    } else if (x % 3 == 0) {
      flag = 1;
    } else {
      while (x > 10) {
        x = x - 10;
        if (x % 3 == 0 || x % 7 == 0 || x % 10 == 0) {
          flag = 1;
        }
      }
    }
    if (flag == 1 || (x % 3 == 0 || x % 7 == 0 || x % 10 == 0)) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
}
