#include <bits/stdc++.h>
#define isA(x) ((x) < 0)
#define isB(x) ((x) >= 0)

typedef std::bitset <3001> bitset;
const int N = 6054;

int n;
int a[N], b[N], s[N];
char buf[N];
bitset f[N], mask;

inline int abs(int x) {return x ^ x >> 31;}
inline char get(int x) {return 98 + (x >> 31);}

char * parse(const bitset &B, char *ret) {
	for (int i = 0; i < 2 * n; ++i) if (B.test(abs(s[i]))) *ret++ = get(s[i]);
	return *ret = 0, ret;
}

inline void up(bitset &A, const bitset &B) {
	static char bufA[N], bufB[N];
	if (parse(A, bufA), parse(B, bufB), strcmp(bufA, bufB) < 0) A = B;
}

int main() {
	int i, j = 0, k = 0, r;
	scanf("%d%s", &n, buf);
	for (i = 0; i < 2 * n; ++i) s[i] = (buf[i] & 1 ? (a[j] = i, ~j++) : (b[k] = i, k++));
	f[n - 1].set(n - 1), mask.set(n - 1);
	for (i = n - 2; i >= 0; --i) {
		if (a[i] < b[i])
			r = *std::min_element(s + a[i], s + b[i]),
			assert(isA(r)), f[i] = f[-r], f[i].set(i);
		else {
			for (r = 0, j = b[i]; j < 2 * n; ++j) {
				if (isB(s[j])) f[i].set(s[j]), ++r;
				else if (~s[j] >= i) --r;
				if (!r) break;
			}
			f[i] |= f[abs(s[++j])];
		}
		up(f[i], f[i + 1]), mask.set(i);
	}
	return parse(*f, buf), puts(buf), 0;
}