#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,sa[3010],sb[3010],ta=0,tb=0,pos[6010];
char s[6010];
string f[3010];
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;i<=2*n;i++)
	{
		if(s[i]=='a') sa[++ta]=i,pos[i]=ta;
		else sb[++tb]=i,pos[i]=tb;
	}
	string ans;
	for(int i=n;i>=1;i--)
	{
		if(sa[i]<sb[i])
		{
			int k=i;
			for(int j=sa[i]+1;j<sb[i];j++) k=max(k,pos[j]);
			f[i]="ab"+f[k+1];
		}
		else
		{
			int k=i;
			while(k<n&&sb[k+1]<sa[k]) k++;
			for(int j=sb[i];j<=2*n;j++) if(pos[j]>=i&&pos[j]<=k) f[i]+=s[j];
			f[i]+=f[k+1];
		}
		f[i]=max(f[i],f[i+1]);
		ans=max(ans,f[i]);
	}
	printf("%s",ans.c_str());
}