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