T = int(input()) for i in T: S = input() if len(S)==1: print("B") else: S[0]='B' S[1]='B' print(S)