def find_abc(cs: list, used: set): a = b = c = INF for i, x in enumerate(cs): if x == 'A': if i not in used: a = min(a, i) elif x == 'B': if i not in used: b = min(b, i) elif x == 'C': if i not in used: c = min(c, i) return a, b, c def f(cs: list, used: set): a, b, c = find_abc(cs, used) if c < a and c < b: cs[c] = 'A' used.add(c) return g(cs, used) return cs def g(cs: list, used: set): a, b, c = find_abc(cs, used) if c < a and c < b: return cs if a < b: cs[a] = 'B' used.add(a) else: cs[b] = 'C' used.add(b) return f(cs, used) def solve(): N = int(input()) S = input() res = f(list(S), set()) return ''.join(res) INF = 1 << 60 T = int(input()) for _ in range(T): ans = solve() print(ans)