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