#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    bool f = false;
    cin >> x;
    for (int a = 0; a < 34; a++) {
      for (int b = 0; b < 15; b++) {
        if ((a * 3 + b * 7) == x) {
          f = true;
          break;
        }
      }
      if (f) break;
    }
    if (f)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
