#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, flag = 0, j, k;
  cin >> n;
  int arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    flag = 0;
    for (j = 0; j < arr[i]; j++) {
      for (k = 0; k < arr[i]; k++) {
        if (j * 7 + k * 3 == arr[i]) {
          cout << "YES" << endl;
          flag = 1;
          break;
        }
      }
      if (flag == 1) {
        break;
      }
    }
    if (flag == 0) {
      cout << "NO" << endl;
    }
  }
  return 0;
}
