#include <bits/stdc++.h>
using namespace std;
const int N = 1000100;
char s[8 * N];
int nd[N];
int be[N];
int dp[N][21];
int mx[N];
int main() {
  int n, r, c, L;
  scanf("%d%d%d\n", &n, &r, &c);
  gets(s);
  int cnt = 0;
  queue<int> q;
  q.push(0);
  be[0] = 0;
  for (L = 0; s[L]; L++) {
    if (s[L] == ' ') {
      ++cnt;
      q.push(cnt);
      be[cnt] = L + 1;
    } else {
      if (q.size() && L - c >= be[q.front()]) {
        nd[q.front()] = cnt;
        q.pop();
      }
    }
  }
  ++cnt;
  be[cnt] = L + 1;
  while (q.size()) {
    nd[q.front()] = cnt;
    q.pop();
  }
  nd[cnt] = cnt;
  for (int i = 0; i < n; i++) {
    dp[i][0] = nd[i];
  }
  dp[n][0] = n;
  for (int j = 1; j < 21; j++) {
    for (int i = 0; i < n; i++) {
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
    }
    dp[n][j] = n;
  }
  int ans = -1, pos = 0;
  for (int i = 0; i < n; i++) {
    mx[i] = i;
    for (int j = 20; j >= 0; j--) {
      if ((r >> j) & 1) {
        mx[i] = dp[mx[i]][j];
      }
    }
    if (ans < mx[i] - i) {
      pos = i;
      ans = mx[i] - i;
    }
  }
  for (int x = 0; x < r; x++) {
    for (int j = be[pos]; j < be[nd[pos]]; j++) {
      printf("%c", j == be[nd[pos]] - 1 ? '\n' : s[j]);
    }
    pos = nd[pos];
  }
  return 0;
}
