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