#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned tst{};
  cin >> tst;
  while (tst--) {
    unsigned x{};
    cin >> x;
    bool possible{false};
    for (unsigned i{}; i * 3 <= x; ++i) {
      if ((x - 3 * i) % 7 == 0) {
        possible = true;
        break;
      }
    }
    cout << ((possible) ? "YES" : "NO") << endl;
  }
  return 0;
}
