#include <bits/stdc++.h>
using namespace std;
int solve() {
  int n;
  cin >> n;
  for (int i = 0; i <= 100; i++) {
    for (int j = 0; j <= 100; j++) {
      if (3 * i + 7 * j == n) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
