#include using namespace std; #define REP(i,n) for(int i=0;i<(n);i++) typedef long long ll; typedef vector vi; typedef vector vvi; #define pii pair #define piii pair #define mp make_pair #define pb push_back #define ALL(a) (a).begin(),(a).end() #define FST first #define SEC second const int INF = (INT_MAX/2); const ll LINF = (LLONG_MAX/2); const double eps = 1e-14; const double PI = M_PI; #define DEB cout<<"!"< Array; typedef vector matrix; string s; string f(int i){ if(i == -1 ||(!(s[i]>='0' && s[i] <= '9'))){ s.insert(i+1,"1"); return s; } if(s[i]>='0' && s[i] <= '8'){ s[i] += 1; return s; }else if(s[i] == '9'){ s[i] = '0'; f(i-1); } } int main(){ int n; cin >> n;cin.ignore(); REP(i,n){ getline(cin,s); for(int j = s.size()-1; j >= 0; j--){ if(s[j] >= '0' && s[j] <= '9'){ f(j); break; } } cout << s << endl; } return 0; }