X = input().split()[0] L1 = input().split() L2 = input().split() s = 'Mr'*(X in L1) + 'MAX' + 'Value'*(X in L2) print('-1' if s == 'MAX' else s)