#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    char ch = 'n';
    while (n >= 0) {
      if (n % 3 == 0) {
        ch = 'y';
        break;
      }
      n -= 7;
    }
    if (ch == 'y')
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
