#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <string>
#include <cstring>
#include <utility>


using namespace std;

string s,a[1000001];
bool f[1000001];
int n,r,c,tong[1000001],prev[1000001];
vector<int> st;

void khoitao()
{
    int i,p;  p=1;  a[p]="";
    for (i=0;  i<=s.length()-1;  i++)
        if (s[i]==' ')
            {
                p++;  a[p]="";
            }
        else a[p].push_back(s[i]);
    tong[0]=0;
    for (i=1;  i<=n;  i++) tong[i]=tong[i-1]+a[i].length();
}

void taolist()
{
    int i,p;  p=1;  prev[0]=-1;
    for (i=1;  i<=n;  i++)
        {
            while ((p<=i)&&((tong[i]-tong[p-1]+i-p)>c)) p++;
            if (p>i) prev[i]=-1; else prev[i]=p; 
        }
}

void solve()
{
    int i,ans,left,right,t,p,q,len;  memset(f,true,sizeof(f));  ans=0;  
    for (i=n;  i>=1;  i--) if ((f[i])&&(prev[i]!=-1))
        {
            t=i;  st.resize(0);  
            while ((prev[t]!=-1))
                {
                    st.push_back(t);  if (f[t]==false) cout <<"adfafd";  f[t]=false;
                    if (st.size()<r) p=st[0];  else p=st[st.size()-r];
                    q=prev[t];  t=q-1;
                    if (p-q+1>ans)
                        {
                            ans=p-q+1;  left=q;  right=p;
                        }
                }
        }
    if (ans==0) return;  len=c;  i=left;
    while (i<=right)
        {
            p=a[i].length();
            if (len<p)
                {
                    if (r==1) break;
                    else 
                        {
                            r--;  len=c;  printf("\n");
                        }
                }
            else 
                {
                    if (len!=c) printf(" ");  len-=a[i].length();  len--;  
                    for (p=0;  p<=a[i].length()-1;  p++) printf("%c",a[i][p]);
                    i++;
                }
        }
}

main()
{
//    freopen("test.inp","r",stdin);
//    freopen("test.out","w",stdout);
    cin >>n>>r>>c;  scanf("\n");
    getline(cin,s);
    khoitao();
    taolist();
    solve();
}
