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