//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("trapv")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
const ll mod = 1e9 + 7;
int n, r, c, sm[1000100], p[1000100][20];
vector<string> s;
int main() { //DINIC ORZ
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> r >> c;
	s.resize(n+1);
	for(int i = 1; i <= n; i++) {
		cin >> s[i];
		sm[i] = sm[i-1] + s[i].size();
	}
	int j = 0;
	for(int i = 1; i <= n; i++) {
		while(j<=n&&sm[j]-sm[i]+j-i-1<=c) j++;
		p[i][0] = j;
	}
	for(int i = 0; i < 20; i++)
		p[n+1][i] = n+1;
	int x = 1, ans = 0;
	for(int i = n; i; i--) {
		for(int j = 1; j < 20; j++)
			p[i][j] = p[p[i][j-1]][j-1];
		int z = i;
		for(int j = 19; j; j--) if((r>>j)&1) z = p[z][j];
//		cout << i << " " << z << "\n";
		if(z-i>ans)
			x = i, ans = z-i;
	}
	int curl = 0, rwid = 0;
	while(x < s.size() && rwid < r) {
		if(curl+s[x].size() > c) {
			rwid++;
			curl = 0;
			cout << "\n";
			continue;
		}
		if(curl) cout << " ";
		curl += s[x].size()+1;
		cout << s[x++];
	}
}
