#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(T a) {
  return a * a;
}
const int MAX_N = 1e6 + 10, MAX_L = 5e6 + MAX_N, LOG = 22;
int Start[MAX_N], Z[MAX_L], Next[LOG][MAX_N], Len[MAX_N];
char W[MAX_L];
int main() {
  int N, R, C;
  scanf("%d%d%d", &N, &R, &C);
  int pos = 0;
  for (int i = 0; i < int(N); ++i) {
    int n, n0;
    scanf(" %n%s%n", &n0, W + pos, &n);
    for (int j = pos; j <= pos + n - n0; ++j) Z[j] = i;
    Start[i] = pos;
    Len[i] = strlen(W + pos);
    pos += n - n0;
    Z[pos++] = -i - 1;
  }
  for (int i = 0; i < int(N); ++i) {
    Next[0][i] = abs(Z[min(Start[i] + C, pos - 1)]);
  }
  for (int k = 0; k < LOG - 1; ++k)
    for (int i = 0; i < int(N); ++i) Next[k + 1][i] = Next[k][Next[k][i]];
  pair<int, int> Answer(0, 0);
  for (int i = 0; i < int(N); ++i) {
    int x = R, cur = i;
    for (int k = (LOG)-1; k >= 0; --k)
      if ((1 << k) <= x) x -= (1 << k), cur = Next[k][cur];
    Answer = max(Answer, make_pair(min(cur, N) - i, i));
  }
  int l = 0;
  for (int cur = Answer.second, i = 0; i < Answer.first; ++i, ++cur) {
    int n;
    printf("%s%n", W + Start[cur], &n), l += n;
    if (i != Answer.first - 1 && l + 1 + Len[i + 1] > C)
      puts(""), l = 0;
    else if (i != Answer.first - 1)
      putchar(' ');
  }
  return 0;
}
