#include using namespace std; int main() { int match = 0; string lock = "locked"; string s; for(int i=0;i<=10;i++) { if(i != 0) cin >> match >> lock; if(match == 10) break; else { string ss(match, '0' + i - 1); s += ss; } if(i != 10) { string t(10, '0' + i); cout << t << endl; } } if(lock == "unlocked") return 0; do { cout << s << endl; cin >> match >> lock; } while(next_permutation(s.begin(), s.end()) || lock == "locked"); return 0; }