#include <bits/stdc++.h>
using namespace std;
const int maxn = 3333;
bool is_ab[maxn];
int a[maxn], b[maxn];
bool active[maxn * 2];
int to[maxn];
int main(){
	int n; cin >> n;
	string s; cin >> s;
	vector<int> p[2];
	for(int i = 0; i < 2 * n; i++){
		p[s[i] - 'a'].push_back(i);
	}
	for(int i = 0; i < n; i++){
		a[i] = p[0][i];
		b[i] = p[1][i];
		is_ab[i] = a[i] < b[i];
	}
	vector<int> ab, ba;
	for(int i = n - 1; i >= -1; i--){
		if(i == -1 || !is_ab[i]){
			for(int j = 0; j <= i; j++) if(!is_ab[j]) ba.push_back(j);
			for(int j = i + 1; j < n; j++) if(is_ab[j]) ab.push_back(j);
			break;
		}
	}
	int len_ba = ba.size();
	vector<string> dp(len_ba + 1, "");
	for(int i = len_ba - 1; i >= 0; i--){
		dp[i] = dp[i + 1];
		to[i] = i;
		for(int j = i + 1; j < len_ba; j++){
			if(b[ba[i]] <= b[ba[j]] && b[ba[j]] <= a[ba[i]]) to[i] = max(to[i], to[j]);
		}
		string ival;
		vector<pair<int, char> > now;
		for(int j = i; j <= to[i]; j++){
			now.push_back({a[ba[j]], 'a'});
			now.push_back({b[ba[j]], 'b'});
		}
		sort(now.begin(), now.end());
		for(auto e : now) ival.push_back(e.second);
		ival += dp[to[i] + 1];
		dp[i] = max(dp[i], ival);
	}
	int len_ab = ab.size();
	vector<string> f(len_ab + 1, "");
	for(int i = len_ab - 1; i >= 0; i--){
		int nxt = len_ab;
		for(int j = i + 1; j < len_ab; j++) if(a[ab[j]] > b[ab[i]]){
			nxt = j;
			break;
		}
		f[i] = max(f[i + 1], "ab" + f[nxt]);
	}
	cout << dp[0] + f[0] << endl;
	return 0;
}
