#include #include using namespace std; using namespace atcoder; //const long nPrime = 1000000007; //const long nPrime = 998244353; typedef long long ll; int main() { ll n; cin >> n; while(n--){ string s; cin >> s; for(ll i = 0; i < 5; i++){ if(i == 4 || s[i] != '0'){ for(ll j = i; j < 5; j++){ cout << s[j]; } cout << endl; break; } } } return 0; }