#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  bool x = false;
  int b[a];
  for (int i = 0; i < a; i++) cin >> b[i];
  for (int i = 0; i < a; i++) {
    x = false;
    if (b[i] % 3 == 0 || b[i] % 7 == 0)
      cout << "YES" << endl;
    else {
      while (b[i] > 0) {
        if (b[i] % 3 != 0)
          b[i] = b[i] - 7;
        else if (b[i] % 3 == 0) {
          x = true;
          break;
        }
      }
      if (x == true)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
