#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x % 7 == 0 || x % 3 == 0)
      cout << "YES" << endl;
    else {
      bool flag = false;
      for (int j = 0; j < 100; j++) {
        a = x - 7 * j;
        if (a % 3 == 0 && a > 0) {
          cout << "YES" << endl;
          flag = true;
          break;
        }
      }
      if (!flag) cout << "NO" << endl;
    }
  }
  return 0;
}
