#include<iostream>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<algorithm>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int x;
cin>>x;
int i;
for(i=2;i<=100;i++)
{
if(7+i==x&&i>7)
{
cout<<i<<endl;
break;
}
}
if(i==101)
{
cout<<"-1"<<endl;
}
}
}