#include <bits/stdc++.h>
const int Inf = 1e9;
long long LINF = (long long)4e18;
const long long mod = 1e9 + 7;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int(q) = 0; (q) < n; (q)++) {
    int x;
    cin >> x;
    bool fl = false;
    for (int(i) = 0; (i) < 40; (i)++) {
      for (int(j) = 0; (j) < 40; (j)++) {
        if (i * 3 + j * 7 == x) fl = true;
      }
    }
    if (fl)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
