#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, temp;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n;
    if (n == 3 || n == 7 || n % 3 == 0 || n % 7 == 0) {
      cout << "YES\n";
      continue;
    } else if (n < 3 || (n > 3 && n < 7)) {
      cout << "NO\n";
      continue;
    } else {
      int temp = n;
      while (n % 3 != 0 && n >= 0) {
        n -= 7;
      }
      if (n >= 0) {
        cout << "YES\n";
        continue;
      }
      while (temp % 7 != 0 && temp >= 0) {
        temp -= 3;
      }
      if (temp >= 0) {
        cout << "YES\n";
        continue;
      }
    }
    cout << "NO\n";
  }
}
