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

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

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 l in range(4):
            if a[l]==b[l]:
                hit+=1
        for g in range(4):
            for p in range(4):
                if a[g]==a[p]:
                    bro+=1
        bro=bro-hit
        bro-=1
        print(hit,bro)
    except:break

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
    print(hit,blow)

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

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

Python: a = input().split()
b = input().split()
s = 0
v = 0
for i in range(len(a)):
    if a[i] == b[i]:
        s += 1
    elif a[i] in b:
        v += 1

print(*(s, v))

Python: def main():
    while True:
        try:
            A = list(map(int,input().split()))
            B = list(map(int,input().split()))
            hit_count = 0
            blow_count = 0
            for i in range(4):
                for j in range(4):
                    if A[i] == B[i]:
                        hit_count += 1
                        break
                    if A[i] == B[j]:
                        blow_count += 1
                        break
            print(str(hit_count)+ " " + str(blow_count))
        except EOFError:
            break




if __name__ == '__main__':
    main()

Python: 
import sys
def hit_blow(num):
   hits = 0
   blows = 0
   emp1 = [0,0,0,0]
   emp2 = [0,0,0,0]
   num.append(emp1)
   num.append(emp2)
   for i in range(0,4):
       i = i*2
       for j in range(0,4):
           j = j*2
           if num[0][i] == num[1][j] and num[2][int(i/2)] == 0 and num[3][int(j/2)] == 0:
               if i ==j :
                   hits += 1
               else:
                   blows += 1
               num[2][int(i/2)] = 1
               num[3][int(j/2)] = 1
   print(hits,blows)

flag = 0
num = []
for line in sys.stdin.readlines():
   if flag == 0:
       num.append(line)
       flag = 1
   elif flag == 1:
       num.append(line)
       flag = 2
   if flag == 2:
       flag = 0
       hit_blow(num)
       del num[:]

Python: import sys

while True:
  a = sys.stdin.readline()
  if not a: break

  a = a.rstrip().split(" ")
  b = raw_input().rstrip().split(" ")

  hit=0
  for i in range(len(a)):
    if a[i] == b[i]:
      hit+=1
      a[i] = -1

  blow=0
  for e in b:
    if e in a:
      blow+=1

  print("{} {}").format(hit, blow)

Python: while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        hit = sum(1 for x, y in zip(a, b) if x == y)
        hits = [x for x, y in zip(a, b) if x == y]
        blow = sum(1 for x in a if x in b and x not in hits)
        print(hit, blow)
    except:
        break

Python: def hit_blow(a,b):
    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 a[i] == b[j]:
                blow += 1
    blow -= hit
    print(hit,blow)
    return 0

while True:
    try:
        a = list(map(int,input().split()))
        b = list(map(int,input().split()))
        hit_blow(a,b)
    except EOFError:
        break

Python: 
import sys
def hit_blow(num):
   hits = 0
   blows = 0
   emp1 = [0,0,0,0]
   emp2 = [0,0,0,0]
   num.append(emp1)
   num.append(emp2)
   for i in range(0,4):
       i = i*2
       for j in range(0,4):
           j = j*2
           if num[0][i] == num[1][j] and num[2][int(i/2)] == 0 and num[3][int(j/2)] == 0:
               if i ==j :
                   hits += 1
               else:
                   blows += 1
               num[2][int(i/2)] = 1
               num[3][int(j/2)] = 1
   print(hits,blows)

flag = 0
num = []
for line in sys.stdin.readlines():
   if flag == 0:
       num.append(line)
       flag = 1
   elif flag == 1:
       num.append(line)
       flag = 2
   if flag == 2:
       flag = 0
       hit_blow(num)
       del num[:]

Python: while True:
  try:
    alst = input().split()
    blst = input().split()

    hit = brow = 0

    for i in range(4):
      for j in range(4):
        if alst[i] == blst[j]:
          if i == j:
            hit += 1
          else:
            brow += 1

    print(hit, brow)

  except EOFError:
    break

Python: while(1):
	try:
		a = [int(i) for i in input().split()]
		b = [int(i) for i in input().split()]
		hit = 0
		for i,j in zip(a,b):
			if i == j:
				hit += 1
		sa = set(a)
		sb = set(b)
		u = sa & sb
		blow = len(u) - hit
		print(hit, blow)
	except EOFError:
		break

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 ]) - hit
        print(str(hit) + ' ' +str(blow))
    except:
        break

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

Python: while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    print(sum(x == y for x, y in zip(a, b)),  sum(a[i] != b[i] and a[i] in b for i in range(4)))

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

Python: import sys
res=[]

for (l,text) in enumerate(sys.stdin):
    if not l%2:
        a=list(map(int,text.split()))
    else:
        h=0
        b=0
        for (i,j) in enumerate(map(int,text.split())):
            if a[i]==j:
                h=h+1
            elif j in a:
                b=b+1
        res.extend([[h,b]])
[print(i[0],i[1]) for i in res]