while True:
    try:
        L1=map(int,raw_input().split(" "))
        L2=map(int,raw_input().split(" "))
        blow=0
        hit=0
        for i in range(4):
            if L1[i]==L2[i]:
                hit+=1
        for j in L1:
            print j
            if j in L2:
                blow+=1
        blow=blow-hit
        print str(hit)+" "+str(blow)
    except:
        break