#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    if (n % 3 == 0 || n % 7 == 0)
      cout << "YES"
           << "\n";
    else {
      long long int max = n / 3;
      long long int ch = 0;
      for (long long int i = 0; i <= max; i++) {
        long long int left = (n - (i * 3));
        if (left % 7 == 0 || left == 0) {
          ch = 1;
          break;
        }
      }
      if (ch == 1)
        cout << "YES"
             << "\n";
      else
        cout << "NO"
             << "\n";
    }
  }
  return 0;
}
