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: # coding=utf-8


def hit_and_blow(answer: list, expect: list) -> tuple:
    hit, blow = 0, 0
    for (i, j) in zip(answer, expect):
        if i == j:
            hit += 1
    answer_set = set(answer)
    expect_set = set(expect)
    blow_set = answer_set & expect_set
    blow = len(blow_set) - hit
    return hit, blow


if __name__ == '__main__':
    while True:
        try:
            answer_number = list(map(int, input().split()))
            expected_number = list(map(int, input().split()))
        except EOFError:
            break
        h, b = hit_and_blow(answer_number, expected_number)
        print(h, b)

Python: import sys

a = []
for line in sys.stdin:
    a.append(line.strip())
ita = iter(a)

for a, b in zip(ita, ita):
    hit = 0
    blow = 0
    a = a.split(' ')
    b = b.split(' ')
    for a_, b_ in zip(a, b):
        if a_ == b_:
            hit += 1
        elif a_ in b:
            blow += 1
    print(hit, blow)

Python: import fileinput
for line in fileinput.input():
    a = line.split()
    b = input().split()
    hit = 0
    blow = 0
    for i in range(4):
        for j in range(4):
            if a[i] == b[j]:
                if i == j:
                    hit += 1
                else:
                    blow += 1
    print(hit, blow)

Python: import sys
  
lines = sys.stdin.readlines()
n = len(lines)//2

for i in range(n):
    hit = 0
    blow = 0
    cache = {}
    a = list(map(int, lines[i*2].split()))
    b = list(map(int, lines[i*2+1].split()))
    for j in range(len(a)):
        if a[j] == b[j]:
            hit += 1
        else:
            cache[a[j]] = True
    for j in range(len(b)):
        if cache.get(b[j]):
            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: 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_a in range(len(aa)):
        if aa[one_a] == bb[one_a]:
            hit += 1
        for one_b in range(len(bb)):
            bi = bb[one_b]
            if aa[one_a]== bb[one_b] 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: while True:
    try:
        a=list(map(int,input().split()))
        b=list(map(int,input().split()))
        hit,blow=0,0
        ac=0
        for i in a:
            bc=0
            ac +=1
            for j in b:
                bc +=1
                if i==j:
                    if ac==bc:
                        hit +=1
                    else:
                        blow +=1
        print(hit,blow)
    except:break

Python: while True:

    try:
        ansa=hoge1.split()
        ansb=hoge2.split()
    except:
        break

    hit = sum((1 for a, b in zip(ansa, ansb) if a == b))
    blow = sum((1 for a in ansa if a in ansb))

    print(hit, blow - hit)

Python: # coding: utf-8
# Your code here!

while True:
   try:
      A = list(input())
      B = list(input())
      
      for i in range(A.count(' ')):
         A.remove(' ')
      for i in range(B.count(' ')):
         B.remove(' ')
      #print(A, B)
      
      h = 0 #ブロー数
      b = 0 #ヒット数
      for i in range(4):
         for j in range(4):
            if A[i] == B[j]:
               if i == j:
                  h += 1
               else:
                  b += 1
      print(h, b)

   except EOFError:
      break

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

Python: import sys
inputs = []
for line in sys.stdin:
    inputs.append(line)

n = len(inputs)
for _ in range(n // 2):
    a = list(map(int, inputs[_ * 2].split()))
    b = list(map(int, inputs[_ * 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)

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 True:
	try:
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		hit = blow = 0
		for i in range(4):
			for j in range(4):
				if i == j and a[i] == b[j]: hit += 1
				if i != j and a[i] == b[j]: blow += 1
		print(hit, blow)
	except EOFError:
		break

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

Python: # AOJ 0025 Hit and Blow
# Python3 2018.6.16 bal4u

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: while True:
    try:
        a=[int(i) for i in input().split()]
        b=[int(i) for i in input().split()]
    except:break
    hit=sum([1 for i in range(4) if a[i]==b[i]])
    blow=8-len(set(a)|set(b))-hit
    print("{0} {1}".format(hit,blow))

Python: while 1:
    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
            for j in range(4):
                if a[i] == b[j]:
                    blow += 1
        blow -= hit
        print(hit, blow)
        
    except EOFError:
        break

Python: import sys
lines = [list(map(int, line.split())) for line in sys.stdin]
for i in range(0, len(lines), 2):
    a = lines[i]
    b = lines[i + 1]
    hit = sum(1 for i in range(len(a)) if a[i] == b[i])
    blow = sum(1 for bi in b if bi in a) - hit
    print(hit, blow)

Python: try:
    while True:
        L=0
        M=0
        
        A=list(map(int,input().split()))
        B=list(map(int,input().split()))
        
        for i in range(4):
            if A[i]==B[i]:
                L+=1
            
            C=A.count(B[i])
            if C>=1:
                M+=1
                
        print(L,M-L)
        
except EOFError:
    pass

Python: while True:
    try:
        A = list(map(int, input().split()))
        B = list(map(int, input().split()))
    except EOFError:
        break
    hit = sum(1 for i in range(4) if A[i] == B[i])
    blow = sum(1 for i in range(4) if A[i] in B) - hit
    print(hit, blow)