a, b = input().split() if a != b and b == 'T': print(b, a) elif a != b and b == 'F': print(b, a) else: print(a, b)