while 1: x=raw_input().split(" ");m=map(int,x[1:]);s=[0]*999+[[]] for _ in" "*int(x[0][:-1]): t=0 for i in m: if s[-i]!=0and(t==0or len(s[-i])