Go: package main

import "fmt"

func main() {
	var a1, a2, a3, a4, b1, b2, b3, b4 int
	for {
		i, _ := fmt.Scan(&a1, &a2, &a3, &a4)
		if i == 0 {
			break
		}
		fmt.Scan(&b1, &b2, &b3, &b4)
		a := [4]int{a1, a2, a3, a4}
		b := [4]int{b1, b2, b3, b4}
		var hit, blow int

		for j := 0; j < 4; j++ {
			for k := 0; k < 4; k++ {
				if a[j] == b[k] {
					if j == k {
						hit++
					} else {
						blow++
					}
				}
			}
		}
		fmt.Println(hit, blow)
	}
}

Python: import sys
for i in sys.stdin:
    arrA,arrB = [],[]
    s = i.split()
    for i in s:
        arrA.append(int(i))
    s = input().split()
    for i in s:
        arrB.append(int(i))
    h,b = 0,0
    for i in range(len(arrA)):
        if arrA[i] == arrB[i]:
            h += 1
        else:
            if arrB.count(arrA[i]) > 0:
                b += 1
    print(h,b)

Python: import sys
ans = []
for line in sys.stdin:
    aa = list(map(int,input().split()))
    bb = list(map(int,input().split()))
    hit = 0
    blow = 0
    for one in range(len(aa)):
        if aa[i] == bb[i]:
            hit += 1
            
    for one_a in range(len(aa)):
        ai = aa[one_a]
        for one_b in range(len(bb)):
            bi = bb[one_b]
            if ai== bi and one_a != one_b:
                blow += 1
    one_list = [hit,blow]
    ans.append(one_list)

for i in range(len(ans)):
    print(str(ans[i][0]) + ' ' + str(ans[i][1]) + ' ')

Python: def process(A, B):
    hit, blow = 0, 0
    for a, b in zip(A, B):
        if a == b:
            hit += 1
        elif a in B:
            blow += 1
    return (hit, blow)

while True:
    try:
        A = input().split()
        B = input().split()
    except: break
    hit, blow = process(A, B)
    print(hit, blow)

Python: while True:
    try:
        a = [x for x in input().split()]
        b = [x for x in input().split()]
        hit_count = 0
        blow_count = 0
        for i in range(4):
            if a[i] == b[i]:
                hit_count += 1
            elif(b[i] in a):
                blow_count += 1
        print(hit_count, blow_count)
    except EOFError:
        break

Python: while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        hit  = 0
        blow = 0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif a[i] in b:
                blow += 1
        print(hit, blow)
    except:
        break

Python: import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
 h=0
 for s,t in zip(a,b):h+=s==t
 print(h,4-len(set(a)-set(b))-h)

Python: while 1:
	hit = blow = 0
	try: a = list(map(int,input().split()))
	except: break
	b = list(map(int,input().split()))
	for i in range(4):
		if a[i] == b[i]:
			hit += 1
		elif a[i] in b:
			blow += 1
	print(hit, blow)

Python: while 1:
    try:
        a =[int(i) for i in input().split()]
        b =[int(i) for i in input().split()]
        hit=0
        bro=0
        for i in range(4):
            if a[i]==b[i]:
                hit=hit+1
            for j in range(4):
                if a[i]==b[j]:
                    bro=bro+1
        print(hit,bro-hit)
    except:break

Python: # -*- coding: utf-8 -*-


def main(a, b):
    hit = 0
    blow = 0

    for a_e, b_e in zip(a, b):
        if a_e == b_e:
            hit += 1
        elif a_e in b:
            blow += 1

    print(hit, blow, sep=' ')


if __name__ == '__main__':
    while True:
        a = [int(e) for e in input().split()]
        b = [int(e) for e in input().split()]

        if a and b:
            main(a, b)
        else:
            exit()

Python: while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    hit = blow = 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        for j in range(4):
            if i != j and a[i] == b[j]:
                blow += 1
    print(hit, blow)

Python: while True:
    try:
        x = list(map(int,input().split()))
    except:
        break
    y = list(map(int,input().split()))
    h, b = 0, 0
    for i in range(4):
        if x[i] == y[i]:
            h += 1
        elif y[i] in x:
            b += 1
    print(h, b)

Python: import sys

for user in sys.stdin:
    hit = 0
    blow = 0
    a = list(map(int, user.split()))
    user = input()
    b = list(map(int, user.split()))
    for i in range(4):
        for j in range(4):
            if b[i] == a[j]:
                if i == j:
                    hit += 1
                else:
                    blow += 1

    print(hit, blow)

Python: import sys
for line in sys.stdin:
    arrA,arrB = [],[]
    s = line.split()
    for i in s:
        arrA.append(int(i))
    s = input().split()
    for i in s:
        arrB.append(int(i))
    h,b = 0,0
    for i in range(len(arrA)):
        if arrA[i] == arrB[i]:
            h += 1
        elif arrB.count(arrA[i]) > 0:
                b += 1
    print(h,b)

Python: hit = blow = 0
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(4):
	if a[i] == b[i]:
		hit += 1
	elif a[i] in b:
		blow += 1
print(hit, blow)

Python: while True:
    try:
        data1 = list(map(int, input().split()))
        #print(data1)
        data2 = list(map(int,input().split()))
        #print(data2)
    except:
        break
    
    h = 0
    b = 0
    for i in range(4):
        try:
            if i == data1.index(data2[i]):
                h = h + 1
            else:
                b = b + 1
        except:
            pass
    print('{} {}'. format(h, b))

Python: while True:
    try:
        a = list(int(x) for x in input().split())
        b = list(int(x) for x in input().split())
    except EOFError:
        break
    hit = 0
    brow = 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(4):
                if(i != j and a[i] == b[j]):
                    brow += 1
                    
    print(str(hit) + " " + str(brow))

Python: while True:
	try:
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	except: break
	
	hit = blow = 0
	for i in range(4):
		if a[i] == b[i]:
			hit += 1
			b[i] = -1
	for i in range(4):
		if b[i] >= 0:
			if b[i] in a:
			    blow += 1
	print(hit, blow)

Python: import sys

even = True
for s in sys.stdin:
    if even:
        even = False
        a = list(map(int, s.split()))
    else:
        even = True
        b = list(map(int, s.split()))
        hit = sum(a[i] == b[i] for i in range(4))
        blow = sum(b[i] in a for i in range(4)) - hit
        print(hit, blow)

Python: if __name__ == '__main__':

	while True:
		try:
			A = input().split()
			B = input().split()

			hit = 0
			blow = 0
			for i in range(4):
				if A[i] == B[i]:
					hit += 1
				else:
					if B[i] in A:
						blow += 1

			print(hit,blow)

		except EOFError:
			break

Python: while True :
    try :
        a = [int(_) for _ in input().split()]
        b = [int(_) for _ in input().split()]
        hit, blow = 0, 0
        for _ in range(4) :
            if a[_] == b[_] : hit += 1
            elif b[_] in a : blow += 1
        print(hit, blow)
    except : break

Python: import sys
inputs = []
for line in sys.stdin:
    inputs.append(line)
n = len(inputs)
for _ in range(n // 2):
    for line in sys.stdin:
        a=list(map(int, sys.stdin[_ * 2].split()))
        b=list(map(int, sys.stdin[_ * 2 + 1].split()))
        hit=0
        blow=0
        for i in range(4):
            if b[i] == a[i]:
                hit += 1
            elif b[i] in a:
                blow += 1
        print(hit, blow)