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: c = 0
while True:
    try:
        if c % 2 == 0:
            A = [int(x) for x in input().split()]
        else:
            B = [int(x) for x in input().split()]
            hit = blow = 0
            for i in range(len(B)):
                if A[i] == B[i]:
                    hit += 1
                else:
                    if B[i] in A:
                        blow += 1
            print(hit,blow)
                
        c += 1    
    except EOFError:
        break

Python: while True:
	try:
		A=[int(i) for i in input().split()]
		B=[int(i) for i in input().split()]
		#Hit
		hit=0
		for i in range(len(A)):
			if A[i]==B[i]:
				hit+=1
		#Blow
		blow=0
		for i in range(len(A)):
			for j in range(len(A)):
				if i!=j:
					if A[i]==B[j]:
						blow+=1

		print(hit,blow)



	except EOFError:
		break

Python: while True:
    try:
        a=list(map(int, input().split()))
        #print("a",a)
        b=list(map(int, input().split()))
        #print("b",b)
        hit=0
        blow=0
        for i in range(len(b)):
            if b[i] in a:
                if b[i]==a[i]:
                    hit+=1
                else:
                    blow+=1
        print(hit,blow,)
    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=' ')

while True:
    try:
        a = [int(e) for e in input().split()]
        b = [int(e) for e in input().split()]
    except:
        break

    main(a, b)

Python: while 1:
   try:
       h = 0
       b = 0
       que=input().split(" ")
       ans=input().split(" ")
       for i in range(4):
             for j in range(4):
                    if que[i] == ans[j] and i != j:
                         b = b + 1
                    if que[i] == ans[j] and i == j:
                         h = h + 1
       print(str(h) + " " + str(b))
   except:break

Python: import sys

for line in sys.stdin:
    a = list(map(int, line.split()))
    b = list(map(int, line.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 
import numpy as np 

def main():
    input_line = []
#     test_line = ['9 1 8 2', '4 1 5 9', '4 6 8 2', '4 6 3 2']
    
#     for line in test_line:
#         input_line.append(line.split())
    
    
    
    for line in sys.stdin:
        input_line.append(line.split())
    #print(input_line)

    
    for i in range(0,len(input_line),2):
        #hit number
        arrary1 = np.array(input_line[i], dtype=float)
        arrary2 = np.array(input_line[i+1], dtype=float)
        hit_vec = arrary1 - arrary2
        hit_list = list(hit_vec)
        hitnumber = hit_list.count(0.)
        #print(hit_list.count(0.))
        
        #blow number
        
        
        
        
        #get the hit location and remove
        hit_loc = [i for i,x in enumerate(hit_list) if x == 0]
        blow_vec1 = np.delete(arrary1, hit_loc)
        blow_vec2 = np.delete(arrary2, hit_loc)
        blownumber = len(set(blow_vec1).intersection(blow_vec2))
        #print(len(set(blow_vec1).intersection(blow_vec2)))
        
        print(hitnumber,blownumber)


        
if __name__ == '__main__':
    main()

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 j in a:
            blow+=1
        if i==j:
            hit+=1

Python: import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
 h=sum([1 for i in range(4)if a[i]==b[i]])
 w=4-len(set(a)-set(b))-h
 print(h,w)

Python: while True:
  try:
    a = map(int, raw_input().split())
    b = map(int, raw_input().split())
  except:
    break
  ab = zip(a, b)
  hit = 0
  blow = 0
  for xa, xb in ab:
    if xa == xb:
      hit  += 1
    elif xa in b:
      blow += 1
  print('%d %d' % (hit, blow))

Python: while 1:
    try:
        A = input().split()
        B = input().split()
        hit = len([i for i in range(len(A)) if B[i] == A[i]])
        blow = len([i for i in range(len(A)) if B[i] in A]) - hit
        print(str(hit) + " " + str(blow))
    except:
        break

Python: ans = 0
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()))
        h = [c-d for c,d in zip(a,b)].count(0)
        v = sum([a.count(d) for d in b]) - h
        print(h,v)
    except:
        break

Python: import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
 h=sum([1 for i in range(4)if a[i]==b[i]])
 print(h,4-len(set(a)-set(b))-h)

Python: import sys
count = 0
for line in sys.stdin:
    if count % 2 == 0:
        a = list(map(int, line.split()))
    else:
        b = list(map(int, line.split()))
        hit, brow = 0, 0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif a[i] in b:
                brow += 1
        print(hit, brow)
    count += 1

Python: import sys

v = None
for i in sys.stdin:
    if v:
        h = 0
        for j, n in enumerate(i.split()):
            if n == v[j]:
                h += 10
            elif n in v:
                h += 1
        v = None
        print(h // 10, h % 10)
    else:
        v = i.split()

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:
    try:
        H=0; B=0;
        a=list(map(int,input().split()))
        b=list(map(int,input().split()))
    except:
        break
    if a[0]==b[0]:
        H+=1
    if a[1]==b[1]:
        H+=1
    if a[2]==b[2]:
        H+=1
    if a[3]==b[3]:
        H+=1
    if a[0]==b[1] or a[0]==b[2] or a[0]==b[3]:
        B+=1
    if a[1]==b[0] or a[1]==b[2] or a[1]==b[3]:
        B+=1
    if a[2]==b[0] or a[2]==b[1] or a[2]==b[3]:
        B+=1
    if a[3]==b[0] or a[3]==b[1] or a[3]==b[2]:
        B+=1
    print(H, B)

Python: #0025
while True:
    c = 0
    d = 0
    l = []
    m = []
    try:
        a1,a2,a3,a4 = map(int,input().split())
        b1,b2,b3,b4 = map(int,input().split())
    except:
        break
    l.extend([a1,a2,a3,a4])
    m.extend([b1,b2,b3,b4])

    for i in range(4):
        for k in range(4):
            if l[i] == m[k]:
                if i == k:
                    c += 1
                else:
                    d += 1
    print(c,d)