v = int(input())
vote = list(str(input()))
count_A = vote.count('A')
count_B = len(vote) - count_A
if count_A > count_B:
print('A')
elif count_A == count_B:
print('Tie')
else:
print('B')
v = int(input())
vote = list(str(input()))
count_A = vote.count('A')
count_B = len(vote) - count_A
if count_A > count_B:
print('A')
elif count_A == count_B:
print('Tie')
else:
print('B')