    while True:
        try:
            hit = 0
            br = 0
            a = map(int,raw_input().split(' '))
            b = map(int,raw_input().split(' '))

            for i in range(4):
                for j in range(4):
                    if a[i] == b[j]:
                        print a[i],b[j]
                        hit += 1
                    elif a[i] == b[j]:
                        br += 1

            print hit,br

        except EOFError:
            break