#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e3 + 4;
long long int s, l, r;
int main() {
  long long int n, f = 0, flag = 0;
  cin >> n;
  while (n--) {
    long long int x, a = 0, b = 0;
    cin >> x;
    for (a = 0; a <= 100; a++) {
      flag = 0;
      for (b = 0; b <= 100; b++) {
        f = 0;
        long long int d = a * 3 + b * 7;
        if (d == x) {
          cout << "YES" << endl;
          f = 1;
          break;
        }
      }
      if (f == 1) {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      cout << "NO" << endl;
    }
  }
  return 0;
}
