#include <bits/stdc++.h>
using namespace std;
int main() {
int t,n; cin >> t;
while(t--){
cin >> n;
if(n < 3) cout << "NO\n";
else if(n % 3 == 0 || n % 7 == 0) cout << "YES\n";
else{
bool yum = false;
while(n>9){
n-=7;
if(n%3 == 0){
yum = true;
break;
}
}
yum ? cout << "YES\n" : cout << "NO\n";
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCB0LG47CWNpbiA+PiB0OwoJd2hpbGUodC0tKXsKCQljaW4gPj4gbjsKCQlpZihuIDwgMykJY291dCA8PCAiTk9cbiI7CgkJZWxzZSBpZihuICUgMyA9PSAwIHx8IG4gJSA3ID09IDApCWNvdXQgPDwgIllFU1xuIjsKCQllbHNlewoJCQlib29sIHl1bSA9IGZhbHNlOwoJCQl3aGlsZShuPjkpewoJCQkJbi09NzsKCQkJCWlmKG4lMyA9PSAwKXsKCQkJCQl5dW0gPSB0cnVlOwoJCQkJCWJyZWFrOwoJCQkJfQkKCQkJfQoJCQl5dW0gPyBjb3V0IDw8ICJZRVNcbiIgOiBjb3V0IDw8ICJOT1xuIjsKCQl9Cgl9CglyZXR1cm4gMDsKfQ==