#include <iostream> #include <cstring> #include <cstdio> using namespace std; int small_num; int big_num; int number; int num; int Jam[30]; inline int is_right() { bool v[30]; memset(v,true,sizeof(v)); for(int i=1;i<=number;i++) { if(!v[Jam[i]]) return false; else v[Jam[i]]=false; if(Jam[i]<Jam[i-1]) return false; } return true; } int main() { scanf("%d %d %d",&small_num,&big_num,&number); for(int i=1;i<=number;i++) { char c; cin>>c; Jam[i]=c-'a'+1; } while(Jam[1]<big_num) { Jam[number]+=1; for(int i=number;i>=1;i--) { if(Jam[i]>big_num) { Jam[i-1]+=1; Jam[i]=Jam[i-1]-1; } } if(is_right()) { for(int i=1;i<=number;i++) cout<<(char)(Jam[i]-1+'a'); num++; cout<<endl; } if(num==5) return 0; } return 0; }