#include <bits/stdc++.h>
using namespace std;
int x, k3, k7, n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    k7 = x / 7;
    k3 = (x % 7) / 3;
    while ((k7 > 0 || k3 > 0) && ((x - k3 * 3 - k7 * 7) > 0)) {
      k7--;
      k3 = (x - k7 * 7) / 3;
    }
    if (k7 >= 0 && k3 >= 0 && (k3 * 3 + k7 * 7 == x)) {
      cout << "YES" << '\n';
    } else
      cout << "NO" << '\n';
  }
}
