#include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int len = s.size(); for (int i = 1; i < len; i++) { int t = i; while (t > 0 && s[t] - 1 > s[t - 1]) { s[t]--; swap(s[t], s[t - 1]); t--; } } cout << s << endl; } return 0; }