#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, x, t = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    t = 0;
    for (int j = 0; j <= x / 3; j++) {
      if ((x - 3 * j) % 7 == 0) {
        cout << "YES" << endl;
        t++;
        break;
      }
    }
    if (!t) {
      cout << "NO" << endl;
    }
  }
  return 0;
}
