#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, flag = 0, j;
  cin >> n;
  while (n--) {
    int x;
    cin >> x;
    flag = 0;
    for (i = 0; i <= 33; i++) {
      for (j = 0; j <= 14; j++) {
        if (i * 3 + j * 7 == x) {
          cout << "YES" << endl;
          flag = 1;
          break;
        }
      }
      if (flag == 1) break;
    }
    if (flag == 0) cout << "NO" << endl;
  }
}
