#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000

template <typename T,typename F>
struct SWAG{
	F func;
	T init_value;
	vector<pair<T,T>> X,Y;
	SWAG(F f,T iv):func(f){
		init_value = iv;
	}
	
	void push_front(T x){
		if(X.empty())X.push_back({x,x});
		else X.push_back({x,func(x,X.back().second)});
	}
	
	void push_back(T x){
		if(Y.empty())Y.push_back({x,x});
		else Y.push_back({x,func(Y.back().second,x)});
	}
	
	void pop_front(){
		if(X.empty()){
			int n = Y.size();
			vector<T> t;
			for(int i=0;i<n/2;i++){
				t.push_back(Y.back().first);
				Y.pop_back();
			}
			while(!Y.empty()){
				push_front(Y.back().first);
				Y.pop_back();
			}
			while(!t.empty()){
				push_back(t.back());
				t.pop_back();
			}
			if(!X.empty())X.pop_back();
		}
		else{
			X.pop_back();
		}
	}
	
	void pop_back(){
		if(Y.empty()){
			int n = X.size();
			stack<T> t;
			for(int i=0;i<n/2;i++){
				t.push_back(X.back().first);
				X.pop_back();
			}
			while(!X.empty()){
				push_back(X.back().first);
				X.pop_back();
			}
			while(!t.empty()){
				push_front(t.back());
				t.pop_back();
			}
			if(!Y.empty())Y.pop_back();
		}
		else{
			Y.pop_back();
		}
	}
	
	T get(){
		T ret = init_value;
		if(!X.empty())ret = func(ret,X.back().second);
		if(!Y.empty())ret = func(ret,Y.back().second);
		return ret;
	}
	
	T front(){
		if(!X.empty())return X.back().first;
		if(!Y.empty())return Y[0].first;
		return init_value;
	}
	
	T back(){
		if(!Y.empty())return Y.back().first;
		if(!X.empty())return X[0].first;
		return init_value;
	}
	
	int size(){
		return X.size()+Y.size();
	}
	
};

struct SA_IS{
	
	vector<int> a;
	
	SA_IS(string &S){
		S.push_back('$');
		vector<int> n(S.size());
		
		map<int,int> mp;
		
		for(int i=0;i<S.size();i++){
			n[i] = encode(S[i]);
			mp[n[i]]=0;
		}
		
		int now = 0;
		for(auto &a:mp){
			a.second = now;
			now++;
		}
		
		for(int i=0;i<n.size();i++){
			n[i] = mp[n[i]];
		}
	
		a = suffix_array(n);
		
	}
	
	vector<int> suffix_array(vector<int> n){

		{
			vector<int> ret(n.size(),-1);
			bool f = true;
			for(int i=0;i<n.size();i++){
				if(ret[n[i]]!=-1){
					f=false;
					break;
				}
				ret[n[i]]=i;
			}
			if(f)return ret;
		}
		
		vector<bool> is_L(n.size(),false);
		vector<vector<int>> indices(n.size(),vector<int>());
		vector<int> l(n.size()),r(n.size());
		
		for(int i=n.size()-2;i>=0;i--){
			if(n[i]==n[i+1])is_L[i]=is_L[i+1];
			else if(n[i]>n[i+1])is_L[i]=true;
		}
		
		for(int i=0;i<n.size();i++){
			indices[n[i]].push_back(-1);
		}
		
		for(int i=0;i<n.size();i++){
			l[i] = 0;
			r[i] = indices[i].size();
		}
		
		for(int i=n.size()-1;i>=1;i--){
			if(!is_L[i]&&is_L[i-1]){
				r[n[i]]--;
				indices[n[i]][r[n[i]]]=i;
			}
		}
		
		
				
		induced_sort(n,is_L,indices,l,r);
				
		vector<int> LMSs;
		vector<int> fixedLMSs(n.size(),-1);
		for(int i=0;i<indices.size();i++){
			for(int j=0;j<indices[i].size();j++){
				int pos = indices[i][j];
				if(pos<=0)continue;
				if(is_L[pos-1]&&!is_L[pos]){
					fixedLMSs[pos]=LMSs.size();
					LMSs.push_back(pos);
				}
			}
		}

		vector<vector<int>> S(LMSs.size(),vector<int>());
		for(int i=0;i<S.size();i++){
			bool f = true;
			for(int j=LMSs[i];j<n.size();j++){
				if(is_L[j])f=false;
				else if(!f)break;
				S[i].push_back(n[j]);
			}
		}
		
		vector<int> new_n(S.size(),0);
		for(int i=1;i<S.size();i++){
			new_n[i] = new_n[i-1];
			if(S[i]!=S[i-1])new_n[i]++;
		}
		
		vector<int> t;
		vector<int> x;
		for(int i=0;i<n.size();i++){
			if(fixedLMSs[i]!=-1){
				t.push_back(new_n[fixedLMSs[i]]);
				x.push_back(i);
			}
		}
				
		new_n = suffix_array(t);
		
		for(int i=0;i<new_n.size();i++){
			LMSs[i] = x[new_n[i]];
		}
		
		for(int i=0;i<indices.size();i++){
			for(int j=0;j<indices[i].size();j++){
				indices[i][j]=-1;
			}
			l[i] = 0;
			r[i] = indices[i].size();
		}
		
		for(int i=LMSs.size()-1;i>=0;i--){
			int pos = LMSs[i];
			r[n[pos]]--;
			indices[n[pos]][r[n[pos]]]=pos;
		}
		
		induced_sort(n,is_L,indices,l,r);

		vector<int> ret;
		for(int i=0;i<indices.size();i++){
			for(int j=0;j<indices[i].size();j++)ret.push_back(indices[i][j]);
		}

		return ret;
		
	}
	
	void induced_sort(vector<int> &n,vector<bool> &is_L,vector<vector<int>> &indices,vector<int> &l,vector<int> &r){
		
		for(int i=0;i<indices.size();i++){
			for(int j=0;j<indices[i].size();j++){
				int pos = indices[i][j];
				if(pos<=0)continue;
				pos--;
				if(is_L[pos]){
					indices[n[pos]][l[n[pos]]]=pos;
					l[n[pos]]++;
				}
			}
		}
		
		for(int i=0;i<r.size();i++)r[i] = indices[i].size();
		
		for(int i=indices.size()-1;i>=0;i--){
			if(indices[i].size()==0)continue;
			for(int j=indices[i].size()-1;j>=0;j--){
				int pos = indices[i][j];
				if(pos<=0)continue;
				pos--;
				if(!is_L[pos]){
					r[n[pos]]--;
					indices[n[pos]][r[n[pos]]]=pos;
				}
			}
		}
		
	}
	
	int encode(char c){
		if(c=='$')return 0;
		return c-'1'+1;
	}
	
};

int main(){
	
	int K;
	string S;
	cin>>K>>S;
	K++;
	int N = S.size();
	
	int t = (N+K-1)/K;
	
	SA_IS s(S);
	
	int ok = N+1,ng = 0;
	
	while(ok-ng>1){
		int mid = (ok+ng)/2;
		vector<bool> F(N+1,false);
		for(int i=0;i<=mid;i++){
			F[s.a[i]]=true;
		}
		
		vector<int> dp(N+1,Inf);
		auto f = [](int a,int b){
			return min(a,b);
		};
		
		SWAG<int,decltype(f)> SS(f,Inf);
		dp[0] = 0;
		SS.push_back(0);
		
		for(int i=1;i<=N;i++){
			if(SS.size()>=t)SS.pop_front();
			dp[i] = SS.get()+1;
			if(i-t>=0&&F[i-t])dp[i] = min(dp[i],dp[i-t]+1);
			SS.push_back(dp[i]);
		}
		
		if(dp.back()<=K)ok = mid;
		else ng = mid;
	}
	
	int ind = s.a[ok];
	for(int i=0;i<t;i++)cout<<S[ind+i];
	cout<<endl;
	
	return 0;
}


Measured memory_bytes: 13860