#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
int t, n;
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> n;
string s = to_string(n);
reverse(s.begin(), s.end());
while (s.at(0) == '0')
{
s.erase(s.begin());
}
cout << s;
cout << "
";
}
return 0;
}