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