A = B = 0; W = 1 for m in input().split(): a, b = map(int, m.split('-')) if a==21>b+1 or a-9<21 1 or not W: print('!'); exit() A += 1; W = 1 elif b==21>a+1 or b-9<21 1 or not W: print('!'); exit() B += 1; W = 1 elif not W or max(a, b)>=30 or max(a,b)>=21<=19+abs(a-b): print('!'); exit() else: W = 0 if max(A, B) > 1: print('AB'[B>A] if W else '!') else: print('?')