#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 10;
const int OO = 0x3f3f3f3f;
bool check(int n) {
  for (int i = 0; i < 100; i++)
    for (int j = 0; j < 100; j++)
      if (3 * i + 7 * j == n) return true;
  return false;
}
int main() {
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    cout << (check(n) ? "YES\n" : "NO\n");
  }
  return 0;
}
