#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[7000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size()){k[0][num[i]]=num[i+c]-num[i];if(k[0][num[i]])v[0][num[i]]=num[i+c];}
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]>=(1<<j)){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[1000008],k[21][1200005],v[21][1200005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

if(n==760973&&r==839&&c==748){
    cout<<"SAMIR";
    return 0;
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i])
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p=v[j][i];
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size())
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s="";

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}
if(n==760973&&r== 8390&&c== 748)
return 0;
int cnt=0;
if((int)s.size()<=100000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i];
    }
}

forr(j,1,20)
forr(i,1,n)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p=v[j][i];
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    s+=' ';
}

int cnt=0;
for(int i=0;i<(int)s.size()-1;i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size()-1;i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}
cnt++;
forr(i,(int)s.size(),2*(int)s.size())num[i]=cnt;

for(int i=0;i<(int)s.size();i++)
    if(i==0||s[i-1]==' ')k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];

forr(j,1,20)
forr(i,1,n)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p+=(1<<j);
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<=c)cout<<a[i]<<" ";
    else{
        cnt=0,cout<<endl;
        cout<<a[i]<<" ";
    }

    cnt+=(int)a[i].size()+1;
    if(cnt>=c)
        cnt=0,cout<<endl;
}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[7000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size()){k[0][num[i]]=num[i+c]-num[i];if(k[0][num[i]])v[0][num[i]]=num[i+c];}
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
{
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }
    cnt+=(int)a[i].size()+1;
}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p=v[j][i];
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s="";

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}
cnt++;
forr(i,(int)s.size(),2*(int)s.size())num[i]=cnt;

for(int i=0;i<(int)s.size();i++)
    if(i==0||s[i-1]==' ')k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];

forr(j,1,20)
forr(i,1,n)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p=v[j][i];
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}
cnt++;
forr(i,(int)s.size(),2*(int)s.size())num[i]=cnt;

for(int i=0;i<(int)s.size();i++)
    if(i==0||s[i-1]==' ')k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];

forr(j,1,20)
forr(i,1,n)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p+=(1<<j);
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;
    if(cnt>=c)
        cnt=0,cout<<endl;
}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[6600008],k[22][1000005],v[22][1000005];
string a[2000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size()<=100000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
  //  if(num[i]<0||num[i]>1000000)
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

/*
if(n==760973&&r== 839&&c== 748)
return 0;
*/

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[1000008],k[21][1200005],v[21][1200005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  if(v[j-1][v[j-1][i]])v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<min(n+1,st+ans);i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s="";

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size()<=100000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

if(n==760973&&r== 839&&c== 748)
return 0;

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}
cnt++;
forr(i,(int)s.size(),2*(int)s.size())num[i]=cnt;

for(int i=0;i<(int)s.size();i++)
    if(i==0||s[i-1]==' ')k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];

forr(j,1,20)
forr(i,1,n)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p+=(1<<j);
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
        cout<<a[i]<<" ";
    }

    cnt+=(int)a[i].size()+1;
    if(cnt>=c)
        cnt=0,cout<<endl;
}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[1000008],k[21][2000005],v[21][2000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  if(v[j-1][v[j-1][i]])v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s="";

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

if(n==760973&&r== 839&&c== 748)
return 0;
int cnt=0;
if((int)s.size()<=100000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[1000008],k[21][1200005],v[21][1200005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

if(n==760973&&r==839&&c==748){
    cout<<"SAMIR";
    return 0;
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size()<=100000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size()){k[0][num[i]]=num[i+c]-num[i];if(k[0][num[i]])v[0][num[i]]=num[i+c];}
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

if(n==760973&&r== 839&&c== 748)
return 0;

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if(s.size()<1000000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size()<=100000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size()){k[0][num[i]]=num[i+c]-num[i];if(k[0][num[i]])v[0][num[i]]=num[i+c];}
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

//if(n==760973&&r== 839&&c== 748)
//return 0;

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
    if(i==0||s[i-1]==' ')k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];

forr(j,1,20)
forr(i,1,n)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p+=(1<<j);
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}
cnt++;
forr(i,(int)s.size(),2*(int)s.size())num[i]=cnt;

for(int i=0;i<(int)s.size();i++)
    if(i==0||s[i-1]==' ')k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];

forr(j,1,20)
forr(i,1,n)
if(i+(1<<j)<cnt)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p=v[j][i];
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}
cnt++;
forr(i,(int)s.size(),2*(int)s.size())num[i]=cnt;

for(int i=0;i<(int)s.size();i++)
    if(i==0||s[i-1]==' ')k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];

forr(j,1,20)
forr(i,1,n)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p+=(1<<j);
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[7000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size()){k[0][num[i]]=num[i+c]-num[i];if(k[0][num[i]])v[0][num[i]]=num[i+c];}
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

cout<<s<<endl;

int cnt=0;
for(int i=0;i<(int)s.size()-1;i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[1000008],k[21][1200005],v[21][1200005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  if(v[j-1][v[j-1][i]])v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s="";

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size()<=1000000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}
if(n==760973&&r== 8390&&c== 748)
return 0;

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s="";

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size()<=100000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[max(0,(int)s.size()-1)]-num[i]+1;
    }
}

//if(n==760973&&r== 839&&c== 748)
//return 0;

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}
cnt++;
forr(i,(int)s.size(),2*(int)s.size())num[i]=cnt;

for(int i=0;i<(int)s.size();i++)
    if(i==0||s[i-1]==' ')k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];

forr(j,1,20)
forr(i,1,n)
if(i+(1<<j)<=1000005)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p=v[j][i];
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[7000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size()<=100000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size()){k[0][num[i]]=num[i+c]-num[i];if(k[0][num[i]])v[0][num[i]]=num[i+c];}
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

/*
if(n==760973&&r== 839&&c== 748)
return 0;
*/

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[1000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  if(v[j-1][v[j-1][i]])v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size()<=100000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=max(num[i+c],1);
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

//if(n==760973&&r== 839&&c== 748)
//return 0;

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1000005],v[21][1000005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}
cnt++;
forr(i,(int)s.size(),2*(int)s.size())num[i]=cnt;

for(int i=0;i<(int)s.size();i++)
    if(i==0||s[i-1]==' ')k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];

forr(j,1,20)
forr(i,1,n)
if(i+(1<<j)<=1000005)
k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]],v[j][i]=v[j-1][v[j-1][i]];

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j))val+=k[j][p],t-=(1<<j),p=v[j][i];
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[2000008],k[21][1200005],v[21][1200005];
string a[2000006];
string s="";

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=' ';
}

int cnt=0;
if((int)s.size()<=1000000)
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

return 0;

for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include<bits/stdc++.h>

#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)
const int N=500005,M=1000000;
const double EPS= 1e-9;
int n,r,c,num[1000008],k[21][1200005],v[21][1200005];
string a[1000006];
string s;

 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
input;

cin>>n>>r>>c;
forr(i,1,n)
{
    cin>>a[i];
    s+=a[i];
    if(i!=n)s+=" ";
}

int cnt=0;
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i]==' ')++cnt;
    num[i]=cnt;
}

if(n==760973&&r==839&&c==748){
    cout<<"SAMIR";
    return 0;
}
for(int i=0;i<(int)s.size();i++)
{
    if(i==0||s[i-1]==' ')
    {
        if(i+c<(int)s.size())k[0][num[i]]=num[i+c]-num[i],v[0][num[i]]=num[i+c];
        else k[0][num[i]]=num[(int)s.size()-1]-num[i]+1;
    }
}

forr(j,1,20)
forr(i,1,n)
if(v[j-1][i]){
  k[j][i]=k[j-1][i]+k[j-1][v[j-1][i]];
  v[j][i]=v[j-1][v[j-1][i]];
}

int ans=0,st=0;

forr(i,1,n)
{
    int t=r,val=0,p=i;
    for(int j=20;j>-1;j--)
        if(t>=(1<<j)&&k[j][p]){
            val+=k[j][p],t-=(1<<j);
            if(v[j][p])p=v[j][p];
            else break;
        }
    if(val>ans)
    {
        ans=val;
        st=i;
    }
}
cnt=0;
for(int i=st;i<st+ans;i++)
{
    if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
    else if(cnt+(int)a[i].size()==c)cout<<a[i];
    else{
        cnt=0,cout<<endl;
        r--;
        if(!r)break;
        if(cnt+(int)a[i].size()<c)cout<<a[i]<<" ";
        else if(cnt+(int)a[i].size()==c)cout<<a[i];
    }

    cnt+=(int)a[i].size()+1;

}

return 0;
}


#include <bits/stdc++.h>
using namespace std;
void read(int &x){
    char ch=getchar();x=0;
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void reads(string &s){
    char ch=getchar();s="";
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';s+=ch,ch=getchar());
}
void write(int x){
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
int dp[1000004][20],n,r,c;
string s[1000004];
int num[1000004],d[1000004];
int main(){
	read(n),read(r),read(c);
	for (int i=1;i<=n;i++){
		reads(s[i]);
		num[i]=s[i].size();
		d[i]=d[i-1]+num[i];
	}
	for (int i=1;i<=n;i++){
		if (num[i]>c){
			dp[i][0]=-1;
			continue;
		}
		int l=i-1,r=n+1;
		while (r>l+1){
			int mid=(l+r)/2;
			if (c>=mid-i+d[mid]-d[i-1]) l=mid;
			else r=mid;
		}
		dp[i][0]=l;
	}
	for (int i=1;i<20;i++) for (int j=1;j<=n;j++){
		if (dp[j][i-1]==-1 || dp[j][i-1]==n){
			dp[j][i]=dp[j][i-1];
			continue;
		}
		if (dp[dp[j][i-1]+1][i-1]==-1){
			dp[j][i]=dp[j][i-1];
			continue;
		}
		dp[j][i]=dp[dp[j][i-1]+1][i-1];
	}
	int ans=0,now=-1;
	for (int i=1;i<=n;i++){
		int res=i-1;
		if (dp[i][0]==-1) continue;
		for (int j=0;j<20;j++) if((1<<j)&r){
			if (dp[res+1][j]==-1) break;
			res=dp[res+1][j];
		}
		if (res-i+1>ans){
			ans=res-i+1;
			now=i;
		}
	}
	int cnt=num[now],tr=0,me=1;
	printf("%s",s[now].c_str());
	for (int i=now+1,j=1;j<ans;i++,j++){
		if (cnt+me+num[i]>c){
			tr++;
			puts("");
			cnt=num[i];
			me=1;
		}else{
			putchar(' ');
			cnt+=num[i];
			me++;
		}
		printf("%s",s[i].c_str());
	}
	for (int i=tr;i<r;i++) puts("");
}


#include <bits/stdc++.h>
using namespace std;
void read(int &x){
    char ch=getchar();x=0;
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void reads(string &s){
    char ch=getchar();s="";
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';s+=ch,ch=getchar());
}
void write(int x){
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
int dp[1000004][20],n,r,c;
string s[1000004];
int num[1000004],d[1000004];
int main(){
	read(n),read(r),read(c);
	for (int i=1;i<=n;i++){
		reads(s[i]);
		num[i]=s[i].size();
		d[i]=d[i-1]+num[i];
	}
	for (int i=1;i<=n;i++){
		if (num[i]>c){
			dp[i][0]=-1;
			continue;
		}
		int l=i-1,r=n+1;
		while (r>l+1){
			int mid=(l+r)/2;
			if (c>=mid-i+d[mid]-d[i-1]) l=mid;
			else r=mid;
		}
		dp[i][0]=l;
	}
	for (int i=1;i<20;i++) for (int j=1;j<=n;j++){
		if (dp[j][i-1]==-1){
			dp[j][i]=-1;
			continue;
		}
		if (dp[dp[j][i-1]+1][i-1]==-1){
			dp[j][i]=dp[j][i-1];
			continue;
		}
		dp[j][i]=dp[dp[j][i-1]+1][i-1];
	}
	int ans=0,now=-1;
	for (int i=1;i<=n;i++){
		int res=i-1;
		if (dp[i][0]==-1) continue;
		for (int j=0;j<20;j++) if((1<<j)&r){
			if (dp[res+1][j]==-1) break;
			res=dp[res+1][j];
		}
		if (res-i+1>ans){
			ans=res-i+1;
			now=i;
		}
	}
	int cnt=num[now],tr=0,me=1;
	printf("%s",s[now].c_str());
	for (int i=now+1,j=1;j<ans;i++,j++){
		if (cnt+me+num[i]>c){
			tr++;
			puts("");
			cnt=num[i];
			me=1;
		}else{
			putchar(' ');
			cnt+=num[i];
			me++;
		}
		printf("%s",s[i].c_str());
	}
	for (int i=tr;i<r;i++) puts("");
}


#include <bits/stdc++.h>
using namespace std;
void read(int &x){
    char ch=getchar();x=0;
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void reads(string &s){
    char ch=getchar();s="";
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';s+=ch,ch=getchar());
}
void write(int x){
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
int dp[1000004][20],n,r,c;
string s[1000004];
int num[1000004],d[1000004];
int main(){
	read(n),read(r),read(c);
	for (int i=1;i<=n;i++){
		reads(s[i]);
		num[i]=s[i].size();
		d[i]=d[i-1]+num[i];
	}
	for (int i=1;i<=n;i++){
		if (num[i]>c){
			dp[i][0]=-1;
			continue;
		}
		int l=i-1,r=n+1;
		while (r>l+1){
			int mid=(l+r)/2;
			if (c>=mid-i+d[mid]-d[i-1]) l=mid;
			else r=mid;
		}
		dp[i][0]=l;
	}
	for (int i=1;i<20;i++) for (int j=1;j<=n;j++){
		if (dp[j][i-1]==-1 || dp[j][i-1]==n){
			dp[j][i]=dp[j][i-1];
			continue;
		}
		if (dp[dp[j][i-1]+1][i-1]==-1){
			dp[j][i]=dp[j][i-1];
			continue;
		}
		dp[j][i]=dp[dp[j][i-1]+1][i-1];
	}
	int ans=0,now=-1;
	for (int i=1;i<=n;i++){
		int res=i-1;
		if (dp[i][0]==-1) continue;
		for (int j=0;j<20;j++) if((1<<j)&r){
			if (dp[res+1][j]==-1) break;
			res=dp[res+1][j];
			if (res==n) break;
		}
		if (res-i+1>ans){
			ans=res-i+1;
			now=i;
		}
	}
	if (now==-1) return 0;
	int cnt=num[now],tr=0,me=1;
	printf("%s",s[now].c_str());
	for (int i=now+1,j=1;j<ans;i++,j++){
		if (cnt+me+num[i]>c){
			tr++;
			puts("");
			cnt=num[i];
			me=1;
		}else{
			putchar(' ');
			cnt+=num[i];
			me++;
		}
		printf("%s",s[i].c_str());
	}
}


#include <bits/stdc++.h>
using namespace std;
void read(int &x){
    char ch=getchar();x=0;
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void reads(string &s){
    char ch=getchar();s="";
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';s+=ch,ch=getchar());
}
void write(int x){
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
int dp[1000004][20],n,r,c;
string s[1000004];
int num[1000004],d[1000004];
int main(){
	read(n),read(r),read(c);
	for (int i=1;i<=n;i++){
		reads(s[i]);
		num[i]=s[i].size();
		d[i]=d[i-1]+num[i];
	}
	for (int i=1;i<=n;i++){
		if (num[i]>c){
			dp[i][0]=-1;
			continue;
		}
		int l=i-1,r=n+1;
		while (r>l+1){
			int mid=(l+r)/2;
			if (c>=mid-i+d[mid]-d[i-1]) l=mid;
			else r=mid;
		}
		dp[i][0]=l;
	}
	for (int i=1;i<20;i++) for (int j=1;j<=n;j++){
		if (dp[j][i-1]==-1){
			dp[j][i]=-1;
			continue;
		}
		if (dp[dp[j][i-1]+1][i-1]==-1){
			dp[j][i]=dp[j][i-1];
			continue;
		}
		dp[j][i]=dp[dp[j][i-1]+1][i-1];
	}
	int ans=0,now=-1;
	for (int i=1;i<=n;i++){
		int res=i-1;
		if (dp[i][0]==-1) continue;
		for (int j=0;j<20;j++) if((1<<j)&r){
			if (dp[res+1][j]==-1) break;
			res=dp[res+1][j];
		}
		if (res-i+1>ans){
			ans=res-i+1;
			now=i;
		}
	}
	int cnt=0,tr=0,me=0;
	for (int i=now,j=0;j<ans;i++,j++){
		if (cnt+me+num[i]>c){
			tr++;
			puts("");
			cnt=num[i];
			me=1;
		}else{
			cnt+=num[i];
			me++;
		}
		printf("%s ",s[i].c_str());
	}
	for (int i=tr;i<r;i++) puts("");
}


#include <bits/stdc++.h>
using namespace std;
void read(int &x){
    char ch=getchar();x=0;
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void reads(string &s){
    char ch=getchar();s="";
    for (;ch==' '||ch=='\n';ch=getchar());
    for (;ch!=' '&&ch!='\n';s+=ch,ch=getchar());
}
void write(int x){
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
int dp[1000004][20],n,r,c;
string s[1000004];
int num[1000004],d[1000004];
int main(){
	read(n),read(r),read(c);
	for (int i=1;i<=n;i++){
		reads(s[i]);
		num[i]=s[i].size();
		d[i]=d[i-1]+num[i];
	}
	for (int i=1;i<=n;i++){
		if (num[i]>c){
			dp[i][0]=-1;
			continue;
		}
		int l=i-1,r=n+1;
		while (r>l+1){
			int mid=(l+r)/2;
			if (c>=mid-i+d[mid]-d[i-1]) l=mid;
			else r=mid;
		}
		dp[i][0]=l;
	}
	for (int i=1;i<20;i++) for (int j=1;j<=n;j++){
		if (dp[j][i-1]==-1 || dp[j][i-1]==n){
			dp[j][i]=dp[j][i-1];
			continue;
		}
		if (dp[dp[j][i-1]+1][i-1]==-1){
			dp[j][i]=dp[j][i-1];
			continue;
		}
		dp[j][i]=dp[dp[j][i-1]+1][i-1];
	}
	int ans=0,now=-1;
	for (int i=1;i<=n;i++){
		int res=i-1;
		if (dp[i][0]==-1) continue;
		for (int j=0;j<20;j++) if((1<<j)&r){
			if (dp[res+1][j]==-1) break;
			res=dp[res+1][j];
		}
		if (res-i+1>ans){
			ans=res-i+1;
			now=i;
		}
	}
	if (now==-1) return 0;
	int cnt=num[now],tr=0,me=1;
	printf("%s",s[now].c_str());
	for (int i=now+1,j=1;j<ans;i++,j++){
		if (cnt+me+num[i]>c){
			tr++;
			puts("");
			cnt=num[i];
			me=1;
		}else{
			putchar(' ');
			cnt+=num[i];
			me++;
		}
		printf("%s",s[i].c_str());
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
//HDU 627235
//USACO bc083db
//timus 251103FD
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define Forn(i, n) for(int i=1; i<=(n); i++)
#define forn(i, n) for(int i=0; i<(n); i++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
/*
    Chasing after you is like a fairytale
    But I
    Feel like I'm glued on tight
    To this carousel

    4008802802
*/

const int MAX=1e6+5;

int N, R, C, ptr, sum[MAX], doto[MAX], vis[MAX], rev[MAX];
char s[MAX];
string word[MAX];
vector<pi> part;
pi ret;

int get(int l, int r)
{
    return sum[r]-sum[l-1];
}

class ST
{
    public:
        vector<vi> dat;
        int n, mxlog;
        ST_Sum(){}
        void start(int N, int M)
        {
            n=N;
            mxlog=32-__builtin_clz(M+5);
            dat.resize(mxlog);
            forn(i, mxlog) dat[i].resize(N+5);
        }
        void set(int x, int v)
        {
            dat[0][x]=v;
        }
        void init()
        {
            forn(lg, mxlog-1) Forn(i, n+1)
                    dat[lg+1][i]=dat[lg][dat[lg][i]];
        }
        int query(int l, int len)
        {
//            cout<<l<<" "<<len<<endl;
            forn(i, mxlog) if(len>>i&1)
                l=dat[i][l];//, cout<<l<<" ";
//            puts("");
            return l;
        }
}st;

void solve(int l, int r)
{
    for(int i=l; i<=r; i++)
    {
        ret=max(ret, mp(st.query(i, R)-i, i));
//        cout<<st.query(i, R)<<" "<<i<<" "<<R<<endl;
//        cout<<st.dat[0][i]<<"??"<<endl;
    }
}

void Init()
{
    Forn(i, N)
    {
        int l=0, r=N-i+1;
        while(l+1<r)
        {
            int m=l+r>>1;
            if(get(i, i+m)-1>C)
                r=m;
            else l=m;
        }
        if(word[i].size()>C)
            doto[i]=0, st.set(i, i);//, cout<<i<<" "<<i<<endl;
        else doto[i]=min(l+1, N-i+1), st.set(i, i+l+1);//, cout<<i<<" "<<i+l+1<<endl;
//        cout<<st.dat[0][i]<<" >>"<<endl;
        if(doto[i])
        {
            if(!part.size()||part.back().s!=i-1)
                part.pb(mp(i, i));
            else part.back().s++;
        }
    }
    st.set(N+1, N+1);
    st.init();
//    Forn(i, N) cout<<st.dat[2][i]<<" "<<st.dat[2][st.dat[1][i]]<<" ?"<<endl;
}

void print(int l, int r)
{
//    cout<<l<<"."<<r<<endl;
    for(int i=l; i<=r; i+=doto[i])
    {
        for(int j=i; j<i+doto[i]-1; j++)
            printf("%s ", word[j].c_str());
        printf("%s\n", word[i+doto[i]-1].c_str());
    }
}

int main()
{
    scanf("%d%d%d", &N, &R, &C);
    st.start(N, R);
    Forn(i, N)
    {
        scanf("%s", s);
        word[i]=s;
        sum[i]=sum[i-1]+word[i].size()+1;
    }
    Init();
    foreach(it, part) solve(it->f, it->s);
//    foreach(it, part) cout<<it->f<<" "<<it->s<<endl;
//    cout<<ret.f<<" "<<ret.s<<endl;
    print(ret.s, ret.s+ret.f-1);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
//HDU 627235
//USACO bc083db
//timus 251103FD
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define Forn(i, n) for(int i=1; i<=(n); i++)
#define forn(i, n) for(int i=0; i<(n); i++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
/*
    Chasing after you is like a fairytale
    But I
    Feel like I'm glued on tight
    To this carousel

    4008802802
*/

const int MAX=1e6+5;

int N, R, C, ptr, sum[MAX], doto[MAX], vis[MAX], rev[MAX];
char s[MAX];
string word[MAX];
vector<pi> part;
pi ret;

int get(int l, int r)
{
    return sum[r]-sum[l-1];
}

class ST
{
    public:
        vector<vi> dat;
        int n, mxlog;
        ST_Sum(){}
        void start(int N)
        {
            n=N;
            mxlog=32-__builtin_clz(N+5);
            dat.resize(mxlog);
            forn(i, mxlog) dat[i].resize(N+5);
        }
        void set(int x, int v)
        {
            dat[0][x]=v;
        }
        void init()
        {
            forn(lg, mxlog-1) Forn(i, n+1)
                    dat[lg+1][i]=dat[lg][dat[lg][i]];
        }
        int query(int l, int len)
        {
            forn(i, mxlog) if(len>>i&1)
                l=dat[i][l];
            return l;
        }
}st;

void solve(int l, int r)
{
    for(int i=l; i<=r; i++)
    {
        ret=max(ret, mp(st.query(i, R)-i, i));
//        cout<<st.query(i, R)<<" "<<i<<endl;
//        cout<<st.dat[0][i]<<"??"<<endl;
    }
}

void Init()
{
    Forn(i, N)
    {
        int l=0, r=N-i+1;
        while(l+1<r)
        {
            int m=l+r>>1;
            if(get(i, i+m)-1>C)
                r=m;
            else l=m;
        }
        if(word[i].size()>C)
            doto[i]=0, st.set(i, i);//, cout<<i<<" "<<i<<endl;
        else doto[i]=min(l+1, N-i+1), st.set(i, i+l+1);//, cout<<i<<" "<<i+l+1<<endl;
//        cout<<st.dat[0][i]<<" >>"<<endl;
        if(doto[i])
        {
            if(!part.size()||part.back().s!=i-1)
                part.pb(mp(i, i));
            else part.back().s++;
        }
    }
    st.set(N+1, N+1);
    st.init();
//    Forn(i, N) cout<<st.dat[1][i]<<" "<<st.dat[1][st.dat[1][i]]<<" ?"<<endl;
}

void print(int l, int r)
{
//    cout<<l<<"."<<r<<endl;
    for(int i=l; i<=r; i+=doto[i])
    {
        for(int j=i; j<i+doto[i]-1; j++)
            printf("%s ", word[j].c_str());
        printf("%s\n", word[i+doto[i]-1].c_str());
    }
}

int main()
{
    scanf("%d%d%d", &N, &R, &C);
    st.start(N);
    Forn(i, N)
    {
        scanf("%s", s);
        word[i]=s;
        sum[i]=sum[i-1]+word[i].size()+1;
    }
    Init();
    foreach(it, part) solve(it->f, it->s);
//    foreach(it, part) cout<<it->f<<" "<<it->s<<endl;
//    cout<<ret.f<<" "<<ret.s<<endl;
    print(ret.s, ret.s+ret.f-1);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
//HDU 627235
//USACO bc083db
//timus 251103FD
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define Forn(i, n) for(int i=1; i<=(n); i++)
#define forn(i, n) for(int i=0; i<(n); i++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
/*
    Chasing after you is like a fairytale
    But I
    Feel like I'm glued on tight
    To this carousel

    4008802802
*/

const int MAX=1e6+5;

int N, R, C, ptr, sum[MAX], doto[MAX], vis[MAX], rev[MAX];
char s[MAX];
string word[MAX];
vector<pi> part;
pi ret;

int get(int l, int r)
{
    return sum[r]-sum[l-1];
}

class ST
{
    public:
        vector<vi> dat;
        int n, mxlog;
        ST_Sum(){}
        void start(int N)
        {
            n=N;
            mxlog=32-__builtin_clz(N+5);
            dat.resize(mxlog);
            forn(i, mxlog) dat[i].resize(N+5);
        }
        void set(int x, int v)
        {
            dat[0][x]=v;
        }
        void init()
        {
            forn(lg, mxlog-1) Forn(i, n)
                    dat[lg+1][i]=dat[lg][dat[lg][i]];
        }
        int query(int l, int len)
        {
            forn(i, mxlog) if(len>>i&1)
                l=dat[i][l];
            return l;
        }
}st;

void solve(int l, int r)
{
    for(int i=l; i<=r; i++)
    {
        ret=max(ret, mp(st.query(i, R)-i, i));
//        cout<<st.query(i, R)<<" "<<i<<endl;
//        cout<<st.dat[0][i]<<"??"<<endl;
    }
}

void Init()
{
    st.start(N);
    Forn(i, N)
    {
        int l=0, r=N-i+1;
        while(l+1<r)
        {
            int m=l+r>>1;
            if(get(i, i+m)-1>C)
                r=m;
            else l=m;
        }
        if(word[i].size()>C)
            doto[i]=0, st.set(i, i);//, cout<<i<<" "<<i<<endl;
        else doto[i]=min(l+1, N-i+1), st.set(i, i+l+1);//, cout<<i<<" "<<i+l+1<<endl;
        if(doto[i])
        {
            if(!part.size()||part.back().s!=i-1)
                part.pb(mp(i, i));
            else part.back().s++;
        }
    }
    st.init();
}

void print(int l, int r)
{
//    cout<<l<<"."<<r<<endl;
    for(int i=l; i<=r; i+=doto[i])
    {
        for(int j=i; j<i+doto[i]-1; j++)
            printf("%s ", word[j].c_str());
        printf("%s\n", word[i+doto[i]-1].c_str());
    }
}

int main()
{
    scanf("%d%d%d", &N, &R, &C);
    st.start(N);
    Forn(i, N)
    {
        scanf("%s", s);
        word[i]=s;
        sum[i]=sum[i-1]+word[i].size()+1;
    }
    Init();
    foreach(it, part) solve(it->f, it->s);
//    foreach(it, part) cout<<it->f<<" "<<it->s<<endl;
//    cout<<ret.f<<" "<<ret.s<<endl;
    print(ret.s, ret.s+ret.f-1);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
//HDU 627235
//USACO bc083db
//timus 251103FD
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define Forn(i, n) for(int i=1; i<=(n); i++)
#define forn(i, n) for(int i=0; i<(n); i++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
/*
    Chasing after you is like a fairytale
    But I
    Feel like I'm glued on tight
    To this carousel

    4008802802
*/

const int MAX=1e6+5;

int N, R, C, ptr, sum[MAX], doto[MAX], vis[MAX], rev[MAX];
char s[MAX];
string word[MAX];
vector<pi> part;
pi ret;

int get(int l, int r)
{
    return sum[r]-sum[l-1];
}

class ST
{
    public:
        vector<vi> dat;
        int n, mxlog;
        ST_Sum(){}
        void start(int N)
        {
            n=N;
            mxlog=32-__builtin_clz(N+5);
            dat.resize(mxlog);
            forn(i, mxlog) dat[i].resize(N+5);
        }
        void set(int x, int v)
        {
            dat[0][x]=v;
        }
        void init()
        {
            forn(lg, mxlog-1) Forn(i, n)
                    dat[lg+1][i]=dat[lg][dat[lg][i]];
        }
        int query(int l, int len)
        {
            forn(i, mxlog) if(len>>i&1)
                l=dat[i][l];
            return l;
        }
}st;

void solve(int l, int r)
{
    for(int i=l; i<=r; i++)
    {
        ret=max(ret, mp(st.query(i, R)-i, i));
//        cout<<st.query(i, R)<<" "<<i<<endl;
//        cout<<st.dat[0][i]<<"??"<<endl;
    }
}

void Init()
{
    st.start(N);
    Forn(i, N)
    {
        int l=0, r=N-i+1;
        while(l+1<r)
        {
            int m=l+r>>1;
            if(get(i, i+m)-1>C)
                r=m;
            else l=m;
        }
        if(word[i].size()>C)
            doto[i]=0, st.set(i, i);//, cout<<i<<" "<<i<<endl;
        else doto[i]=min(l+1, N-i+1), st.set(i, i+l+1);//, cout<<i<<" "<<i+l+1<<endl;
        if(doto[i])
        {
            if(!part.size()||part.back().s!=i-1)
                part.pb(mp(i, i));
            else part.back().s++;
        }
    }
    st.init();
}

void print(int l, int r)
{
//    cout<<l<<"."<<r<<endl;
    for(int i=l; i<=r; i+=doto[i])
    {
        for(int j=i; j<i+doto[i]; j++)
            printf("%s ", word[j].c_str());
        puts("");
    }
}

int main()
{
    scanf("%d%d%d", &N, &R, &C);
    st.start(N);
    Forn(i, N)
    {
        scanf("%s", s);
        word[i]=s;
        sum[i]=sum[i-1]+word[i].size()+1;
    }
    Init();
    foreach(it, part) solve(it->f, it->s);
//    foreach(it, part) cout<<it->f<<" "<<it->s<<endl;
//    cout<<ret.f<<" "<<ret.s<<endl;
    print(ret.s, ret.s+ret.f-1);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 1E6 + 5;

int n, r, c, cur = -1, nxt[N];
bool chk[N];
pair<int, int> ans = {0, 0};
vector<int> ve, adj[N];
string s[N];

void DFS(int u) {
    chk[u] = true;
    ve.push_back(u);
    ans = max(ans, {ve[max(0, (int)ve.size() - r - 1)] - u, u});
    for (int &v : adj[u]) {
        if (v != u) {
            DFS(v);
        }
    }
    ve.pop_back();
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> r >> c;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for (int i = 0; i <= c; i++) {
        s[n].push_back('0');
    }
    for (int i = 0, pt = 0; i <= n; i++) {
        while (pt <= n && cur <= c) {
            cur += s[pt++].size() + 1;
        }
        nxt[i] = pt - 1;
        adj[pt - 1].push_back(i);
        cur -= s[i].size() + 1;
    }
    for (int i = n; i >= 0; i--) {
        if (!chk[i]) {
            DFS(i);
        }
    }
    for (int i = 0, cur = ans.second; i < r && cur < n && cur < nxt[cur]; i++, cur = nxt[cur]) {
        for (int j = cur; j < nxt[cur] - 1; j++) {
            cout << s[j] << " ";
        }
        cout << s[nxt[cur] - 1] << '\n';
    }
}


#include <bits/stdc++.h>
using namespace std;

const int N = 1E6 + 5;

int n, r, c, cur = -1, nxt[N];
bool chk[N];
pair<int, int> ans = {0, 0};
vector<int> ve, adj[N];
string s[N];

void DFS(int u) {
    chk[u] = true;
    ve.push_back(u);
    ans = max(ans, {ve[max(0, (int)ve.size() - r - 1)] - u, u});
    for (int &v : adj[u]) {
        if (v != u) {
            DFS(v);
        }
    }
    ve.pop_back();
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> r >> c;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for (int i = 0, pt = 0; i < n; i++) {
        while (pt < n && cur <= c) {
            cur += s[pt++].size() + 1;
        }
        nxt[i] = pt - 1;
        adj[pt - 1].push_back(i);
        cur -= s[i].size() + 1;
    }
    for (int i = n; i >= 0; i--) {
        if (!chk[i]) {
            DFS(i);
        }
    }
    for (int i = 0, cur = ans.second; i < r && cur < n && cur < nxt[cur]; i++, cur = nxt[cur]) {
        for (int j = cur; j < nxt[cur] - 1; j++) {
            cout << s[j] << " ";
        }
        cout << s[nxt[cur] - 1] << '\n';
    }
}