#include <bits/stdc++.h>
bool debug = 1;
const double PI = acos(-1.0);
const double eps = 1e-9;
using namespace std;
int main() {
  int n;
  cin >> n;
  int a;
  while (n--) {
    cin >> a;
    bool res = 0;
    for (int i = 0; i <= a; i++) {
      int y = (a - 3 * i) / 7;
      if (y < 0) continue;
      if (3 * i + 7 * y == a) {
        res = 1;
        break;
      }
    }
    if (res) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
  return 0;
}
