#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, i, j, temp;
    cin >> n;
    bool check = 0;
    if (n % 7 == 0 || n % 3 == 0) {
      check = 1;
    } else {
      temp = n;
      while (1) {
        temp -= 3;
        if (temp > 0 && temp % 7 == 0) {
          check = 1;
          break;
        }
        if (temp <= 0) {
          break;
        }
      }
      if (check == 0) {
        temp = n;
        while (1) {
          temp -= 7;
          if (temp > 0 && temp % 3 == 0) {
            check = 1;
            break;
          }
          if (temp <= 0) {
            break;
          }
        }
      }
    }
    if (check == 1) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
