Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]int, 4)
	b := make([]int ,4)
	for scanner.Scan() {
		inputa := strings.Split(scanner.Text(), " ")
		for i := range a {
			a[i], _ = strconv.Atoi(inputa[i])
		}
		scanner.Scan()
		inputb := strings.Split(scanner.Text(), " ")
		for i := range b {
			b[i], _ = strconv.Atoi(inputb[i])
		}
		hit := 0
		blow := 0
		if a[0] == b[0] {
			hit++
		}
		if a[1] == b[1] {
			hit++
		}
		if a[2] == b[2] {
			hit++
		}
		if a[3] == b[3] {
			hit++
		}
		if a[0] == b[1] {
			blow++
		}
		if a[1] == b[2] {
			blow++
		}
		if a[2] == b[3] {
			blow++
		}
		if a[1] == b[0] {
			blow++
		}
		if a[2] == b[1] {
			blow++
		}
		if a[2] == b[0] {
			blow++
		}
		if a[3] == b[2] {
			blow++
		}
		if a[3] == b[1] {
			blow++
		}
		if a[3] == b[0] {
			blow++
		}
		if a[0] == b[2] {
			blow++
		}
		if a[1] == b[3] {
			blow++
		}
		if a[0] == b[3] {
			blow++
		}
		fmt.Printf("%d %d\n", hit, blow)
	}
}

Python: try:
    while 1:
        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))
except:
    pass

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 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()))
        C=[]
        for i in range(4):
            if B[i]==A[i]:
                C.append("h")
            elif B[i] in A:
                C.append("b")
            else:
                pass
        H=C.count("h")
        B=C.count("b")
        print(H,B)
    except:
        break

Python: # coding=utf-8


def hit_and_blow(answer: list, expect: list) -> tuple:
    hit, blow = 0, 0
    for (i, j) in zip(answer, expect):
        if i == j:
            hit += 1
    answer_set = set(answer)
    expect_set = set(expect)
    blow_set = answer_set & expect_set
    blow = len(blow_set) - hit
    return hit, blow


if __name__ == '__main__':
    while True:
        try:
            answer_number = list(map(int, input().split()))
            expected_number = list(map(int, input().split()))
        except EOFError:
            break
        h, b = hit_and_blow(answer_number, expected_number)
        print(h, b)

Python: import sys

a = []
for line in sys.stdin:
    a.append(line.strip())
ita = iter(a)

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

Python: import fileinput
for line in fileinput.input():
    a = line.split()
    b = input().split()
    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
    print(hit, blow)

Python: import sys
  
lines = sys.stdin.readlines()
n = len(lines)//2

for i in range(n):
    hit = 0
    blow = 0
    cache = {}
    a = list(map(int, lines[i*2].split()))
    b = list(map(int, lines[i*2+1].split()))
    for j in range(len(a)):
        if a[j] == b[j]:
            hit += 1
        else:
            cache[a[j]] = True
    for j in range(len(b)):
        if cache.get(b[j]):
            blow += 1
    print(hit,blow)

Python: import sys

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

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
        for one_b in range(len(bb)):
            bi = bb[one_b]
            if aa[one_a]== bb[one_b] 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: while True:
    try:
        a=list(map(int,input().split()))
        b=list(map(int,input().split()))
        hit,blow=0,0
        ac=0
        for i in a:
            bc=0
            ac +=1
            for j in b:
                bc +=1
                if i==j:
                    if ac==bc:
                        hit +=1
                    else:
                        blow +=1
        print(hit,blow)
    except:break

Python: while True:

    try:
        ansa=hoge1.split()
        ansb=hoge2.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: # coding: utf-8
# Your code here!

while True:
   try:
      A = list(input())
      B = list(input())
      
      for i in range(A.count(' ')):
         A.remove(' ')
      for i in range(B.count(' ')):
         B.remove(' ')
      #print(A, B)
      
      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
      print(h, b)

   except EOFError:
      break

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

Python: import sys
inputs = []
for line in sys.stdin:
    inputs.append(line)

n = len(inputs)
for _ in range(n // 2):
    a = list(map(int, inputs[_ * 2].split()))
    b = list(map(int, inputs[_ * 2 + 1].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
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
 h=0
 for s,t in zip(a,b):h+=s==t
 print(h,4-len(set(a)-set(b))-h)

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

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

Python: # AOJ 0025 Hit and Blow
# Python3 2018.6.16 bal4u

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)