#include<bits/stdc++.h>
using namespace std;
const int N=6050;
int f[N][N],a[N],b[N],c[N],na,nb,n;
char s[N*2];
string func(int *g){
  string ans="";
  for (int i=1; i<=2*n; ++i)
    if (g[c[i]])
      ans+=s[i];
  return ans;
}
int main(){
  cin>>n;
  scanf("%s",s+1);
  for (int i=1; i<=2*n; ++i)
    if (s[i]=='a')
      a[++na]=i,c[i]=na;
    else
      b[++nb]=i,c[i]=nb;
  f[n][n]=1;
  for (int i=n-1; i>=1; --i){
    f[i][i]=1;
    int mx=0;
    if (a[i]<b[i]){
      for (int j=a[i]; j<=b[i]; ++j)
	mx=max(mx,c[j]);
      for (int j=mx+1; j<=n; ++j)
	f[i][j]=f[mx+1][j];
    }
    else{
      int tot=0;
      for (int j=b[i]; j<=a[i]; ++j){
	if (c[j]<i) continue;
	if (c[j]!=i) ++tot;
	mx=max(mx,c[j]),f[i][c[j]]=1;
      }
      for (int j=a[i]+1; j<=2*n; ++j)
	if (s[j]=='b'){
	  if (tot==0)
	    f[i][c[j]]=f[mx+1][c[j]];
	  else
	    f[i][c[j]]=1,++tot;
	}
	else{
	  if (tot==0)
	    f[i][c[j]]=f[mx+1][c[j]];
	  else
	    f[i][c[j]]=1,mx=max(mx,c[j]),--tot;
	}
    }
    if (func(f[i])<func(f[i+1]))
      memcpy(f[i],f[i+1],sizeof f[i]);
  }
  cout<<func(f[1]);
  return 0;
}