#include <bits/stdc++.h>
int main() {
  int num_test;
  std::cin >> num_test;
  while (num_test--) {
    int chicken, a, b;
    std::cin >> chicken;
    if (chicken % 3 == 0 || chicken % 7 == 0)
      std::cout << "YES" << std::endl;
    else {
      bool ok = true;
      while (chicken % 3 != 0) {
        chicken -= 7;
        if (chicken < 0) {
          ok = false;
        }
      }
      if (chicken >= 0 && ok)
        std::cout << "YES" << std::endl;
      else
        std::cout << "NO" << std::endl;
    }
  }
  return 0;
}
