x = input().split()[0] a, b = (input().split() for _ in "ab") r = "Mr" * (x in a) + "Max" + "Valu" * (x in b) print(r if r != "Max" else -1)