Skip to content

Instantly share code, notes, and snippets.

@christopher-beckham
Created April 13, 2014 04:11
Show Gist options
  • Save christopher-beckham/10568843 to your computer and use it in GitHub Desktop.
Save christopher-beckham/10568843 to your computer and use it in GitHub Desktop.
from sys import stdin as d
def dr(): return d.readline().rstrip()
def gr(): r1=int(dr())-1; return [ [ int(s) for s in dr().split() ] for z in [1]*4 ][r1]
nc=int(dr())
for i in range(nc):r=list(set(gr()).intersection(set(gr())));l=len(r);print ''.join(['Case #',str(i+1),': ',"Volunteer cheated!"if l==0 else"Bad magician!"if l>1 else`r[0]`])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment