#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    int x;
    cin >> x;
    if (x % 7 % 3 == 0 || x % 3 == 0)
      cout << "YES\n";
    else if (x / 3 > 1 && x % 3 == 1)
      cout << "YES\n";
    else if (x > 20)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
