#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int n;
const int N=3010;
int posa[N],posb[N],id[N<<1],nt[N<<1];
string s,f[N];
int main()
{
	cin>>n>>s;s=" "+s;
	for(int i=1,a=0,b=0;i<=n*2;++i)
		if(s[i]=='a')posa[id[i]=++a]=i;
		else posb[id[i]=++b]=i;
	posa[n+1]=posb[n+1]=2*n+1;id[2*n+1]=n+1;
	for(int i=1,j=0;i<=n+1;++i)
		while(j<min(posa[i],posb[i]))nt[++j]=i;
    for(int i=n;i>=1;--i)
    {
    	if(posa[i]>posb[i])
    	{
    		int j=posb[i];
    		for(;posb[id[j]]<posa[id[j]]&&(id[j]<=i||posb[id[j]]<posa[id[j]-1]);++j)
    			if(id[j]>=i)f[i]+=s[j];
    		f[i]+=f[id[j]];
		}
		else f[i]="ab"+f[nt[posb[i]+1]];
    	f[i]=max(f[i],f[i+1]);
	}
	cout<<f[1];
	return 0;
}