#include <bits/stdc++.h>
using namespace std;
int main() {
  char *p;
  p = (char *)malloc(50000 * sizeof(char));
  int n, r, c, i, j;
  cin >> n >> r >> c;
  j = 0;
  i = 1;
  while (n--) {
    cin >> p;
  flag:
    if (j + strlen(p) <= c) {
      cout << p << " ";
      j += strlen(p) + 1;
    } else if (strlen(p) <= c) {
      if (i < r) {
        j = 0;
        i++;
        cout << "\n";
        goto flag;
      }
      j = c;
    } else if (strlen(p) > c && i > 1) {
      i = 4;
      j = c;
    }
  }
}
