#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int a[3010],b[3010];
char str[6010];
string dp[3010];
bool vis[6010];
int main()
{
	int n;scanf("%d",&n);
	scanf("%s",str+1);
	int num1=0,num2=0;
	for(int i=1;i<=n*2;i++)
		if(str[i]=='a')a[++num1]=i;
		else b[++num2]=i;
	for(int i=n;i>=1;i--)
	{
		if(a[i]<b[i])
		{
			int j=i;
			while(j<=n&&(a[j]<b[i]||b[j]<b[i]))
				j++;
			dp[i]="ab"+dp[j];
		}
		else{
			memset(vis,0,sizeof(vis));
			int mx=a[i],j=i;
			while(j<=n&&a[j]>b[j]&&b[j]<=mx){
				vis[a[j]]=true;
				vis[b[j]]=true;
				mx=max(mx,a[j]);
				j++;
			}
			for(int k=i;k<=n*2;k++)
				if(vis[k])dp[i]+=str[k];
			dp[i]+=dp[j];
		}
		dp[i]=max(dp[i],dp[i+1]);
	}
	cout<<dp[1]<<"\n";
	return 0;
}