#include<bits/stdc++.h>
using namespace std;
int query(string str);
string combine(string s, string t)
{
if(s.size() < t.size()) swap(s, t);
if(t.size() == 0) return s;
//Combine two string
int j = t.size()-1;
for(int i = s.size()-1; i >= 0; i--){
while(j >= 0){
string str = s; str.insert(str.begin() + i + 1, t[j]);
if(query(str) == str.size()){s = str; j--;}
else break;
}
}
while(j >= 0) s.insert(s.begin(), t[j--]);
return s;
}
string guess(int n, int s)
{
vector<string> ans;
for(int i = 0; i < s; i++){
string cur;
for(int j = 1; j <= n; j++) cur.push_back(i+'a');
int num = query(cur);
cur.clear();
for(int j = 1; j <= num; j++) cur.push_back(i+'a');
if(num > 0) ans.push_back(cur);
}
while(ans.size() > 1){
sort(ans.begin(), ans.end(), [&](string x, string y){return x.size() > y.size();});
string s = ans.back(); ans.pop_back();
string t = ans.back(); ans.pop_back();
//cerr<<s<<" "<<t<<endl;
ans.push_back(combine(s, t));
}
return ans[0];
}