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

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

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: import sys
lines = []
for index, line in enumerate(sys.stdin):
  line = line.strip()
  if index%2 == 0:
    lines.append( [line] )
  else:
    lines[-1].append( line )
#print(lines)
lines = iter(lines)
for line in lines:
  i1 = line
  xs = list(map(int, i1[0].split() ))
  ys = list(map(int, i1[1].split() ))
  full_match = 0
  spec_match = 0
  for x, y in zip(list(xs), list(ys)):
    #print(x, y, y in xs)
    if x == y:
      full_match += 1
    elif y in xs:
      spec_match += 1
  print(full_match, spec_match)

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

Python: import sys

def hitBlow(a, b):
    hit = 0
    blow = 0
    for i in range(len(a)):
        if a[i] == b[i]:
            hit += 1
        for j in range(i+1, len(b)):
            if a[i] == b[j]:
                blow += 1

    return [hit, blow]

for s in sys.stdin:
    a = list(map(int, s.split()))
    b = list(map(int, input().split()))

    hit, blow = hitBlow(a, b)

    print(hit, blow)

Python: try:
    while True:
        #標準入力
        a_line = list(map(int,input().split()))
        b_line = list(map(int,input().split()))
        num1 = 0
        num2 = 0
        #場所も番号も同じならnum1数字が同じならnum2にいれる
        for num in range(0,4):
            if a_line[num] == b_line[num]:
                num1 += 1
                continue
            else:pass
            if a_line[num] in b_line:num2 += 1
            else:pass
        print(str(num1) + " " + str(num2))
#EOFErrorをひろう
except EOFError:
    pass

Python: import sys

state = True
for s in sys.stdin:
    if state:
        state = not state
        a = list(map(int,s.split()))
    else:
        state = not state
        b = list(map(int,s.split()))
        hit = 0
        for i in range(len(a)):
            if a [i] == b [i]:
                hit += 1
        blow = -hit
        for i in range(10):
            blow += min(a.count(i),b.count(i))
        print(hit,blow)

Python: try:
    while True:
        l1 = list(map(int, input().split()))
        l2 = list(map(int, input().split()))
        hit = blow = 0
        for i in l1:
            for s in l2:
                if i == s:
                    if l1.index(i) == l2.index(s):
                        hit += 1
                    else:
                        blow += 1
        print(hit, blow)
except:
    pass

Python: import sys
a = list(map(int, input().split()))
for b in sys.stdin:
    b = list(map(int, b.split()))
    hit = 0
    blow = 0
    for i in range(4):
        try:
            if i == a.index(b[i]):
                hit += 1
            else:
                blow += 1
        except:
            pass
    print("{} {}".format(hit, blow))

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

Python: def HB(A,B):
    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
    return [hit,blow]
while True:
    try:
        A=input().split()
        B=input().split()
        print(HB(A,B)[0] , HB(A,B)[1] )
    except:
        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: while True:
    try:
        hit = 0
        brow = 0
        Anum = list(map(int,input().split()))
        Bnum = list(map(int,input().split()))
        for i in range(4):
            if Anum[i] == Bnum[i]:
                hit += 1
            elif Bnum[i] in Anum:
                brow +=1
        print(hit,brow)
                
                       
    except EOFError:
        break

Python: import sys

def hitBlow(a, b):
    hit = 0
    blow = 0
    for i in range(len(a)):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(len(b)):
                if a[i] == b[j]:
                    blow += 1

    return [hit, blow]

for s in sys.stdin:
    a = list(map(int, s.split()))
    b = list(map(int, input().split()))

    hit, blow = hitBlow(a, b)

    print(hit, blow)

Python: while True:
    try:
        alist = input().split()
        blist = input().split()
        hit = brow = 0
        
        for i in range(4):
            for j in range(4):
                if alist[i] == blist[j]:
                    if i == j:
                        hit += 1
                    else:
                        brow += 1
        print(hit,brow)
    except EOFError:
        break

Python: # Aizu Problem 0025: Hit and Blow
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def hit_and_blow(A, B):
    hit, blow = 0, 0
    for k in range(4):
        if A[k] == B[k]:
            hit += 1
        elif A[k] in B:
            blow += 1
    return hit, blow


while True:
    try:
        A = [int(_) for _ in input().split()]
    except EOFError:
        break
    B = [int(_) for _ in input().split()]
    hit, blow = hit_and_blow(A, B)
    print(hit, blow)

Python: def x(m,n):
    H = 0
    B = 0
    for i in range(4):
        if m[i] == n[i]:
            H += 1
        else:
            if m[i] in n:
                B += 1
    return(H, B)

while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        print(*x(a, b))
    except:
        break

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

Python: ansa=input().split()
ansb=input().split()

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)