#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a void drop(const T &x){cout<>s; string t; Int zs=0; for(char c:s){ if(c=='0') zs++; else t+=c; } sort(t.rbegin(),t.rend()); if(!prev_permutation(t.begin(),t.end())) drop(-1); cout<