#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
int num = 0;
while(cin>>num)
{
vector<string> vec;
string str_temp;
for(int i = 0;i<num;i++)
{
cin>>str_temp;
vec.push_back(str_temp);
}
for(int i = 0;i<vec.size();i++)
{
while(vec[i].size()>=8)
{
//提取特定部分打印
cout<<vec[i].substr(0,8)<<endl;
//删去字符串指定长度
vec[i] = vec[i].substr(8);
}
//避免打印一串零进去
if(vec[i].size()==0)
continue;
while(vec[i].size()<8)
{
vec[i]+="0";
}
cout<<vec[i]<<endl;
}
}
}