#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
template<class Type> Type read() {
	Type a;
	bool b;
	unsigned char c;
	while(c=getchar()-48, (c>9)&(c!=253));
	for(a=(b=c==253)?0:c; (c=getchar()-48)<=9; a=a*10+c);
	return b?-a:a;
}
int (*rd)()=read<int>;
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;

const int N=6005;
int a[N], b[N];
char s[N], cur[N], f[N][N];
int main() {
	int n, m=0;
	assert(scanf("%d%s", &n, s)==2);
	for(int l=0, r; l<2*n; l=r, ++m) {
		int na=0, nb=0;
		for(r=l; r==l||na!=nb; ++r) (s[r]=='a'?a[na++]:b[nb++])=r;
		if(s[l]=='a') {
			char *p=f[m];
			for(int i=0, j=l-1, len=0; i<na; ++i) if(a[i]>j) *p++='a', *p++='b', j=b[i];
		} else {
			for(int i=na; i--; ) {
				memset(cur, 0, r-l);
				for(int j=i; j<na; ++j) cur[a[j]-l]='a', cur[b[j]-l]='b';
				*std::remove(cur, cur+r-l, 0)=0;
				if(strcmp(cur, f[m])>0) strcpy(f[m], cur);
			}
		}
	}
	for(int i=m; i--; ) {
		strcat(f[i], f[i+1]);
		if(strcmp(f[i+1], f[i])>0) strcpy(f[i], f[i+1]);
	}
	puts(f[0]);
	return 0;
}
