#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, x;
  cin >> t;
  while (t--) {
    cin >> x;
    while (x > 0) {
      if (x % 3 == 0)
        x = x % 3;
      else if (x % 7 == 0)
        x = x % 7;
      else {
        x -= 7;
        x -= 3;
      }
    }
    if (x == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
