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:
        h=0
        b=0
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split())
        if a1==b1:
            h+=1
        if a2==b2:
            h+=1
        if a3==b3:
            h+=1
        if a4==b4:
            h+=1
        if a1==b2 or a1==b3 or a1==b4:
            b+=1
        if a2==b1 or a2==b3 or a2==b4:
            b+=1
        if a3==b1 or a3==b2 or a3==b4:
            b+=1
        if a4==b1 or a4==b2 or a4==b3:
            b+=1
        print(h,b)
    except:
        break

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

Python: while True:
    try:
        a=input().split()
        b=input().split()
        hit=0
        blow=0

        for i in range(4):
            for j in range(4):
                if(a[i]==b[i]):
                    hit+=1
                    break
                if(a[i]==b[j]):
                    blow+=1
                    break

        print(hit, blow)
        
    except EOFError:
        break

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

Python: hit = blow = 0
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: while True:
    try:
        a=list(map(int,input().split()))
    except:break
    b=list(map(int,input().split()))
    h=0
    for i,j in zip(a,b):h+=i==j
    print(h,len(set(a)&set(b))-h)

Python: while True:
   try:
      A = input().split()
      B = input().split()
      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
            else:
               pass
      print(h, b)
   except EOFError:
      break

Python: while True:
    try:
        ansa=input().split()
        ansb=input().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: 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
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: import sys
array = []
for i in sys.stdin.readlines():
    array.append(i.rstrip().split())
for i in range(0,len(array),2):
    hit = 0
    blow = 0
    for i2 in range(4):
        if array[i][i2] == array[i+1][i2]:
            hit += 1
        for i3 in range(4):
            if array[i][i2] == array[i+1][i3]:
                if i2 == i3:
                    continue
                blow += 1
    print(str(hit)+" "+str(blow))

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

Python: while True:
    try:
        hit = 0
        blow = 0
        hit_idx = []
        s = list(map(int, input().split()))
        t = list(map(int, input().split()))
        for i in range(4):
            if s[i] == t[i]:
                hit_idx.append(i) 
        hit = len(hit_idx)                                
        for i in hit_idx[::-1]:     # reverse order
            s = s[:i] + s[(i+1):]
            t = t[:i] + t[(i+1):]
        for c in s:
            if c in t:
                blow += 1
                                
        print("%d %d" % (hit,blow)) 
    except:
        break

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

Python: import sys
ans = []
for line in sys.stdin:
    aa = list(map(int,line.split()))
    bb = list(map(int,line.split()))
    hit = 0
    blow = 0
    for one_a in range(len(aa)):
        if aa[one_a] == bb[one_a]:
            hit += 1
        if aa[one_a] in bb:
            blow += 1
    blow = blow - hit
    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:
    hit=0
    bro=0
    try:
        a = [int(i) for i in input().split()]
        b= [int(j) for j in input().split()]
        for g in range(4):
            for p in range(4):
                if a[g]==b[p]:
                    bro+=1
        for l in range(4):
            if a[l]==b[l]:
                hit+=1
                bro-=1
        print(hit,bro)
    except:break

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

Python: while True:
    try:
        Alst = list(map(int, input().split()))
        Blst = list(map(int, input().split()))
        H = 0
        B = 0

        for a, anum in enumerate(Alst):
            for b, bnum in enumerate(Blst):
                if anum == bnum:
                    if a == b:
                        H = H + 1
                    else:
                        B = B + 1

        print(str(H) + ' ' + str(B))


    except EOFError:
        break

Python: while True :
    try :
        a1, a2, a3, a4 = map(int, input().split())
        b1, b2, b3, b4 = map(int, input().split())
    except EOFError :
        break
    
    hit = 0
    brow = 0
    if a1 == b1 :
        hit += 1
    if a2 == b2 :
        hit += 1
    if a3 == b3 :
        hit += 1
    if a4 == b4 :
        hit += 1
    if a1 == b2 or a1 == b3 or a1 == b4 :
        brow += 1
    if a2 == b1 or a2 == b3 or a2 == b4 :
        brow += 1
    if a3 == b1 or a3 == b2 or a3 == b4 :
        brow += 1
    if a4 == b1 or a4 == b2 or a4 == b3 :
        brow += 1
        
    print(hit, brow)