#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, MOD = 1e9 + 7, MAXN = 1e5 + 10;
const long long inf = 1e10 + 10;
int a[N];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    bool sw = false;
    for (int j = 0; j < 100; j++) {
      if (a[i] >= 3 * j && (a[i] - 3 * j) % 7 == 0) {
        sw = true;
      }
    }
    if (sw == true) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
