#include using namespace std; struct node { int cnt=0, end=0, pre=0; bool flag = false; map to; }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; node root; vector nodes{&root}; for (int i=0; i> s; node* cur = &root; cur->cnt++; for (auto& c : s) { if (!cur->to.contains(c)) { cur->to[c] = new node; nodes.push_back(cur->to[c]); } cur = cur->to[c]; cur->cnt++; } cur->end++; } for (auto& v : nodes) { for (auto [c, u] : v->to) { u->pre = v->pre + u->end; } } for (auto it=nodes.rbegin(); it!=nodes.rend(); it++) { node* v = *it; if (v!=&root && v->cnt+v->pre-v->end<=n-m) v->flag = true; if (v->pre<=n-m && v->to.size()<26) v->flag = true; for (auto& [c, u] : v->to) v->flag |= u->flag; } if (!root.flag) { cout << "No\n"; return 0; } cout << "Yes\n"; string ans = ""; node* cur = &root; while (true) { if (cur!=&root && cur->cnt+cur->pre-cur->end<=n-m) break; for (char c='a'; c<='z'; c++) { auto it = cur->to.find(c); if (it == cur->to.end()) { if (cur->pre <= n-m) { ans += c; cout << ans << '\n'; return 0; } } else if (it->second->flag) { ans += c; cur = it->second; break; } } } cout << ans << '\n'; }