#include <bits/stdc++.h>
using namespace std;
float fn(int x1, int y1, int x2, int y2) {
  float q = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  return q;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int x, y;
    y = 0;
    int z;
    float q;
    int flag = 0;
    while ((n - 7 * y) >= 0) {
      z = ((n - 7 * y) / 3);
      q = ((n - 7 * y) / 3.0);
      if (z == q) {
        flag = 1;
        break;
      }
      y++;
    }
    if (flag == 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
