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