#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int v, b = 1;
    cin >> v;
    if (v % 3 == 0 || v % 7 == 0) {
      cout << "YES" << endl;
      b = 0;
    } else {
      for (int j = 1; j < 35; j++) {
        for (int k = 1; k < 35; k++) {
          if (7 * j + 3 * k == v || 7 * k + 3 * j == v) {
            cout << "YES" << endl;
            b = 0;
            break;
          }
        }
        if (b == 0) {
          break;
        }
      }
    }
    if (b != 0) {
      cout << "NO" << endl;
    }
  }
}
