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
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
        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:
		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)
"""
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
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: import sys
def main():
    for line in sys.stdin:
        a = list(map(int, line.split()))
        b = list(map(int, input().split()))

        hi, bl = 0, 0
        for x in range(4):
            for y in range(4):
                if a[x] == b[y]:
                    if x == y:
                        hi += 1
                    else:
                        bl += 1

        print(hi, bl)


if __name__ == "__main__":
    main()

Python: 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)

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

Python: while 1:
    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: #!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright  : @Huki_Hara
# Created    : 2015-03-05

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):
        if a[i] == b[i]: 
            hit += 1
    for i in range(4):
        for j in range(4):
            if i != j and a[i] == b[j]: blow += 1

    print(str(hit) + " " + str(blow))

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

Python: import sys
while(True):
    try:
        hit=0
        blow=0
        a=[int(i) for i in input().split()]
        b=[int(i) for i in input().split()]
        for i in range(len(a)):
            for j in range(len(b)):
                if a[i]==b[j]:
                    if i==j:
                        hit+=1
                    else:
                        blow+=1
                    break
        print(hit,blow)
    except EOFError:
        sys.exit()

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

while True:
    try:
        A, B = input().split(), input().split()
        hit = sum([ 1 for i in range(len(A)) if A[i]==B[i] ])
        blow = sum([ 1 for i in range(len(A)) if B[i] in A ])
        print(str(hit) + ' ' +str(blow))
    except:
        break

Python: try:
    while True:
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split()) 
        h=0
        b=0
        if a1==b1:
            h+=1
        if a2==b2:
            h+=1
        if a3==b3:
            h+=1
        if a4==b4:
            h+=1
        A = [a1,a2,a3,a4]
        B = [b1,b2,b3,b4]
    
        for i in A:
            for j in B:
                if i == j:
                    b +=1
        b = b - h
        
        print(h,b)
except EOFError:
    pass

Python: from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

while True:
    a = stdin.readline().strip()
    if not a:
        break
    b = stdin.readline().strip()
    if a == b:
        print('4 0')
        continue
    hit = sum(int(a[i] == b[i]) for i in xrange(0, 7, 2))
    blow = sum(int(b[i] in a) for i in xrange(0, 7, 2)) - hit
    print(hit, blow)

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 EOFError:
        break

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

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

            Hit=0
            Blow=0

            for b in B:
                if b in A:
                    index=B.index(b)
                    print(index)
                    if b==A[index]:
                        Hit+=1

                    else:
                        Blow+=1
            print(Hit,Blow)

        except:
            break
            
    
        
if __name__ == '__main__':
    main()

Python: while True:
    try:
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split())

        A=[a1,a2,a3,a4]
        B=[b1,b2,b3,b4]

        b=0
        h=0
        for i in A:
            if i in B:
                b+=1
            else:
                continue
        for i in range(4):
            if A[i]==B[i]:
                h+=1
            else:
                continue
        print(h,b-h)
    except EOFError:
        break

Python: import sys

even = True
for s in sys.stdin:
    if even:
        even = not even
        a = list(map(int, s.split()))
    else:
        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)