#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    for (int j = 0; j < 3; j++) {
      if (x >= 0 && x % 3 == 0) {
        cout << "YES" << endl;
        break;
      }
      if (j == 2)
        cout << "NO" << endl;
      else
        x -= 7;
    }
  }
  return 0;
}
