#include<stdio.h> int main() { int t,n; scanf("%d",&t); while(t--) { int m; scanf("%d",&n); m=n-7; if(m>7) printf("%d\n",m); else printf("-1\n"); } }