from collections import Counter for _ in range(int(input())): n = int(input()) s = input() freq = Counter(s) a = list() for x in freq.keys(): a.append([freq[x], x]) a.sort(reverse=True) ans = ['0']*n pos = 0 for ct, c in a: while ct > 0: ans[pos] = c pos += 3 if pos >= n: pos %= 3 pos += 1 ct -= 1 good = 1 for i in range(n-2): if ans[i] == ans[i+2]: if i+3 < n: ans[i+2], ans[i+3] = ans[i+3], ans[i+2] for i in range(n-1): if ans[i] == ans[i+1]: good = 0 elif i+2 < n and ans[i] == ans[i+2]: good = 0 if good == 0: print('NO') else: print('YES\n', ''.join(ans), sep='')