#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
string a[maxn];
int n, r, c;
int main() {
  cin >> n >> r >> c;
  for (int i = 0; i < n; i++) cin >> a[i];
  int cnt = 0;
  int FLAG = 0;
  for (int i = 0; i < r; i++) {
    int flag = 0;
    int j = 0;
    while (j <= c) {
      int tt = 0;
      if (a[cnt].length() + j <= c) {
        FLAG = 1;
        flag = 1;
        j = j + a[cnt].length() + 1;
        cout << a[cnt++] << " ";
      } else {
        if (flag == 1) {
          tt = 1;
          cout << endl;
          break;
        }
        if (flag == 0) {
          if (FLAG == 0) {
            i--;
            cnt++;
          }
          break;
        }
      }
      if (j >= c && tt == 0) {
        cout << endl;
        break;
      }
      if (cnt == n) break;
    }
    if (cnt == n) break;
  }
  return 0;
}
