#include #define rep(i, n) for(int i = 0; i < (n); i++) using namespace std; using P = pair; using ll = long long; int main(){ int n; cin >> n; rep(i, n){ string s; cin >> s; string t; rep(i, 5){ if(t.empty() && s[i] == '0') continue; t.push_back(s[i]); } if(t.empty()) t.push_back('0'); cout << t << endl; } }