#include <bits/stdc++.h>
using namespace std;
int n, x;
int main() {
  cin >> n;
  while (n--) {
    cin >> x;
    bool yes = false;
    for (int i = 0; i <= 100 / 3; i++)
      for (int j = 0; j <= 100 / 7; j++) {
        if (x == 3 * i + 7 * j) {
          i = 100;
          yes = true;
          break;
        }
      }
    if (yes)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
