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