#include<fstream>
#include<string>
std::ifstream cin("sticks.in");
std::ofstream cout("sticks.out");
void solve(){
	int n;
	cin>>n;
	switch(n%7){
		case 6:
			cout<<6;
			for(int i=(n-6)/7;i--;)cout<<8;
			break;
		case 5:
			cout<<2;
			for(int i=(n-5)/7;i--;)cout<<8;
			break;
		case 4:
			if(n==4) cout<<4;
			else{
				cout<<20;
				for(int i=(n-11)/7;i--;)cout<<8;
			}
			break;
		case 3:
			if(n==3) cout<<7;
			else if(n==10) cout<<22;
			else{
				cout<<200;
				for(int i=(n-17)/7;i--;)cout<<8;
			}
			break;
		case 2:
			cout<<1;
			for(int i=(n-2)/7;i--;)cout<<8;
			break;
		case 1:
			if(n==1) cout<<-1;
			else{
				cout<<10;
				for(int i=(n-8)/7;i--;)cout<<8;
			}
			break;
		case 0:
			for(int i=n/7;i--;)cout<<8;
	}
	cout<<'\n';
}
int main(){
	int T;
	cin>>T;
	while(T--) solve();
	return 0;
}
