import sys L = [[l,1] for l in sys.stdin.read().splitlines()] for i in range(len(L)): l, k = L[i] _, halves = l.split(':') c1, c2 = halves.split('|') s1 = set(map(int,c1.strip().split(' '))) s2 = set(map(int,c2.strip().split(' '))) n = len(s1&s2) for j in range(n): if i+j+1