#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

class CombinationPascal {
   public:
    CombinationPascal(int n) {
        N = n;
        dp.assign(n + 1, vector<ll>(n + 1));

        dp[0][0] = 1;
        REP(i, 1, n + 1) {
            REP(j, 0, i + 1) {
                if (j - 1 >= 0)
                    dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
                else
                    dp[i][j] = dp[i - 1][j];
            }
        }
    }

    ll cnr(int n, int k) {
        return dp[n][k];
    }

   private:
    int N;
    vector<vector<ll>> dp;
};

CombinationPascal comb(65);

int main() {
    int A, B; ll K; cin >> A >> B >> K;

    string ans = "";
    int L = A + B;
    K--;
    REP(i, 0, L) {
        ll c = comb.cnr(A + B - 1, B);
        if (A && K < c) {
            ans += 'a';
            A--;
        } else {
            ans += 'b';
            B--;
            K -= c;
        }
    }
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using ll = long long;
using std::cin;
using std::cout;
using std::endl;
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

std::chrono::system_clock::time_point  start, end;
void solve()
{
	std::mt19937 kkt(89);
	int _, m; cin >> _ >> m;
	const int n = 20;
	std::vector<std::string> vs(m);
	for (int i = 0; i < m; ++i)
	{
		cin >> vs[i];
	}
	std::vector<std::pair<std::string, std::vector<int>>> a;
	std::vector<int> r, gomi, used(m), nr;
	for (int i = 0; i < m; ++i)
	{
		r.emplace_back(i);
	}
	while (not r.empty() and (int)a.size() < n)
	{
		std::string s;
		std::vector<int> v;
		std::shuffle(r.begin(), r.end(), kkt);
		s = vs[r[0]];
		v.emplace_back(r[0]);
		used[r[0]] = true;
		for (int jupi = 1; jupi < (int)r.size(); jupi++)
		{
			const std::string &t = vs[r[jupi]];
			for (int i = 0; i < (int)s.size(); ++i)
			{
				const int len = std::min((int)s.size() - i, (int)t.size());
				if((int)s.size() + (int)t.size() - len > n)
					continue;
				if(s.substr(i, len) == t.substr(0, len))
				{
					s += t.substr(len, (int)t.size() - len);
					v.emplace_back(r[jupi]);
					used[r[jupi]] = true;
					break;
				}
			}
		}
		for(const auto &e : r)
		{
			if(not used[e])
			{
				const std::string &t = vs[e];
				bool in = false;
				for (int i = 0; i <= (int)s.size() - (int)t.size(); ++i)
				{
					if(s.substr(i, (int)t.size()) == t)
						in = true;
				}
				if(in)
				{
					v.emplace_back(e);
					used[e] = true;
				}
				else
				{
					gomi.emplace_back(e);
				}
			}
		}
		std::swap(gomi, r);
		gomi.clear();
		a.emplace_back(std::make_pair(s, v));
	}
	const double deadline = 2950;
	while(true)
	{
		end = std::chrono::system_clock::now();
		if(std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() > deadline)
			break;
		int h = rnd() % n;
		nr = r;
		for(const auto &e : a[h].second)
		{
			nr.emplace_back(e);
		}
		std::shuffle(nr.begin(), nr.end(), kkt);
		std::string s;
		std::vector<int> v;
		s = vs[nr[0]];
		v.emplace_back(nr[0]);
		for (int jupi = 1; jupi < (int)r.size(); jupi++)
		{
			const std::string &t = vs[nr[jupi]];
			for (int i = 0; i < (int)s.size(); ++i)
			{
				const int len = std::min((int)s.size() - i, (int)t.size());
				if((int)s.size() + (int)t.size() - len > n)
					continue;
				if(s.substr(i, len) == t.substr(0, len))
				{
					s += t.substr(len, (int)t.size() - len);
					v.emplace_back(nr[jupi]);
					break;
				}
			}
		}
		if(v.size() > a[h].second.size())
		{
			for(const auto &e : a[h].second)
			{
				used[e] = false;
			}
			for(const auto &e : v)
			{
				used[e] = true;
			}
			gomi.clear();
			for(const auto &e : nr)
			{
				if(not used[e])
				{
					const std::string &t = vs[e];
					bool in = false;
					for (int i = 0; i <= (int)s.size() - (int)t.size(); ++i)
					{
						if(s.substr(i, (int)t.size()) == t)
							in = true;
					}
					if(in)
					{
						v.emplace_back(e);
						used[e] = true;
					}
					else
					{
						gomi.emplace_back(e);
					}
				}
			}
			std::swap(gomi, r);
			a[h] = std::make_pair(s, v);
		}
	}
	std::vector<std::vector<char>> res(n, std::vector<char>(n, '.'));
	for (int i = 0; i < (int)a.size(); ++i)
	{
		for (int j = 0; j < (int)a[i].first.size(); ++j)
		{
			res[i][j] = a[i].first[j];
		}
	}
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			cout << res[i][j];
		}
		cout << "\n";
	}
}

int main()
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  start = std::chrono::system_clock::now();
  int kkt = 1; 
  //cin >> kkt;
  while(kkt--)
    solve();
  return 0;
}