#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int PAIR[6050];
string dp[6050];

int main() {
    //cout.precision(10);
    int N;
    string S;
    cin >> N >> S;
    S = "#" + S;
    queue<int> a, b;
    for(int i = 1; i <= 2*N; i++) {
        if(S[i] == 'a') a.push(i);
        else b.push(i);
    }
    for(int i = 1; i <= N; i++) {
        int A = a.front();
        int B = b.front();
        a.pop();
        b.pop();
        PAIR[A] = B;
        PAIR[B] = A;
    }
    for(int i = 1; i <= 2*N; i++) {
        //cerr << PAIR[i] << endl;
    }
    for(int index = 2*N; index >= 1; index--) {
        dp[index] = dp[index + 1];
        if(PAIR[index] < index) continue;
        if(S[index] == 'a') {
            string sub = "ab" + dp[PAIR[index] + 1];
            dp[index] = max(dp[index], sub);
            continue;
        }
        if(S[index] == 'b') {
            string sub = "b";
            int plus = 1;
            int sub_index = index + 1;
            for(; plus > 0; sub_index++) {
                if(S[sub_index] == 'b') {
                    sub += "b";
                    plus++;
                    continue;
                }
                if(sub_index < PAIR[index]) continue;
                sub += "a";
                plus--;
            }
            sub += dp[sub_index];
            dp[index] = max(dp[index], sub);
        }
    }
    cout << dp[1] << endl;
    return 0;
}
