Python, Rock, Paper, Scissor
Perform the validation first, to eliminate redundant conditionals.

def play(p1, p2):
    if p1 not in rules or p2 not in rules:
        print("Invalid input")
    elif p2 in rules[p1]:
        print("{} {} {}".format(p1, rules[p1][p2], p2))
    elif p1 in rules[p2]:
        print("{} {} {}".format(p2, rules[p2][p1], p1))