#include<bits/stdc++.h>
using namespace std;
int main(){
int t,n; cin >> t;
while(t--){
cin >> n;
if(n == 2) cout << "1\n";
else if(n == 3) cout << "7\n";
else{
map<int,int> mp = {{2,1},{3,7},{4,4},{5,5},{6,9},{7,8}};
int dcount = n/2;
string ans = "";
for(int i=0;i<dcount-1;++i){
ans = "1" + ans;
n -= 2;
}
cout << mp[n] << ans << endl;
}
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CglpbnQgdCxuOwljaW4gPj4gdDsKCXdoaWxlKHQtLSl7CgkJY2luID4+IG47CgkJaWYobiA9PSAyKQljb3V0IDw8ICIxXG4iOwoJCWVsc2UgaWYobiA9PSAzKQljb3V0IDw8ICI3XG4iOwoJCWVsc2V7CgkJCW1hcDxpbnQsaW50PiBtcCA9IHt7MiwxfSx7Myw3fSx7NCw0fSx7NSw1fSx7Niw5fSx7Nyw4fX07CgkJCQoJCQlpbnQgZGNvdW50ID0gbi8yOwoJCQlzdHJpbmcgYW5zID0gIiI7CgkJCWZvcihpbnQgaT0wO2k8ZGNvdW50LTE7KytpKXsKCQkJCWFucyA9ICIxIiArIGFuczsKCQkJCW4gLT0gMjsKCQkJfQoJCQljb3V0IDw8IG1wW25dIDw8IGFucyA8PCBlbmRsOwoJCX0KCX0KfQ==