#include<bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
signed main() {
int n;
cin>>n;
f(i,1,n) {
int t;
cin>>t;
if(t==1) cout<<-1<<endl;
if(t==3) cout<<7<<endl;
if(t==4) cout<<4<<endl;
if(t%7==0) {
f(i,1,t/7) cout<<8;
cout<<endl;
}
if(t%7==1 && t!=1) {
cout<<10;
f(i,1,t/7-1) cout<<8;
cout<<endl;
}
if(t%7==2) {
cout<<1;
f(i,1,t/7) cout<<8;
cout<<endl;
}
if(t%7==3 && t!=3) {
if(t==10) {
cout<<22<<endl;
continue;
}
f(i,1,t/7-1) cout<<8;
cout<<endl;
}
if(t%7==4 && t!=4) {
cout<<20;
f(i,1,t/7-1) cout<<8;
cout<<endl;
}
if(t%7==5) {
cout<<2;
f(i,1,t/7) cout<<8;
cout<<endl;
}
if(t%7==6) {
cout<<6;
f(i,1,t/7) cout<<8;
cout<<endl;
}
}
return 0;
}