#include <bits/stdc++.h>
using namespace std;
vector<string> str;
int len[1000000 + 5];
int main() {
  int n, r, c;
  cin >> n >> r >> c;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    str.push_back(s);
  }
  for (int i = 0; i < n; i++) {
    len[i] = str[i].length();
    if (str[i].length() > c) {
      str[i] = "";
    }
  }
  int cnt = 0;
  int tot = 0;
  for (int i = 0; i < n; i++) {
    if (str[i].length() > 0) {
      cnt += len[i];
      if (cnt <= c) {
        cout << str[i] << " ";
        cnt++;
      } else {
        cout << endl;
        tot++;
        cnt = 0;
        i--;
      }
    } else {
      if (cnt > 0) {
        cnt = 0;
        tot++;
      }
    }
    if (tot == r) {
      break;
    }
  }
  return 0;
}
