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

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: while True:
    try:
        A = map(int,input().split())
        ls_A = list(A)
        B = map(int,input().split())
        ls_B = list(B)
        h = 0
        b = 0
        for i in range(len(ls_A)):
            if ls_A[i] == ls_B[i]:
                h += 1
        if ls_A[0] == ls_B[1]:
            b += 1
        if ls_A[0] == ls_B[2]:
            b += 1
        if ls_A[0] == ls_B[3]:
            b += 1
        if ls_A[1] == ls_B[0]:
            b += 1
        if ls_A[1] == ls_B[2]:
            b += 1
        if ls_A[1] == ls_B[3]:
            b += 1
        if ls_A[2] == ls_B[0]:
            b += 1
        if ls_A[2] == ls_B[1]:
            b += 1
        if ls_A[2] == ls_B[3]:
            b += 1
        if ls_A[3] == ls_B[0]:
            b += 1
        if ls_A[3] == ls_B[1]:
            b += 1
        if ls_A[3] == ls_B[2]:
            b += 1   
        print(h,b)
    except EOFError:
        break

Python: import sys
v = iter(sys.stdin.readlines())
for i, j in v, v:
    a, b = list(i.sprit()), list(j.split())
    k = len([n for n in a for m in b if n == m])
    l = len(set(a) & set(b))
    print(l, k-l)

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=' ')


a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]

main(a, b)

Python: while True:
    try:
        A=list(map(int,input().split()))
        B=list(map(int,input().split()))
    except:
        break

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

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

Python: while True:
    try:
        A=list(map(str,input().split()))
        B=list(map(str,input().split()))
        h=0
        b=0
        for i in range(4):
            if A[i] in B:
                b+=1
            if A[i]==B[i]:
                h+=1
        print(h,b-h)
    except EOFError:
        break

Python: def check(collect, answer):
    hit = sum(1 for a, c in zip(answer, collect) if a is c)
    blow = len(set(collect) & set(answer)) - hit
    return (hit, blow)

while True:
    try:
        print(*check(input().split(), input().split()))
    except EOFError:
        break

Python: def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
for l in range(0,len(N),2):
    a = [int(i) for i in N[l].split()]
    b = [int(i) for i in N[l+1].split()]

    hit = 0
    blow = 0
    for i in range(len(a)):
        for j in range(len(b)):
            if a[i] == b[j]:
                if i == j:
                    hit = hit+1
                else:
                    blow = blow+1
    print(hit,blow)

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
    print(blow_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: while True:
    try:
        a=list(input())
        b=list(input())
        a=[i for i in a if i!=' ']
        b=[j for j in b if j!=' ']
        hit=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)
    except EOFError:
        break

Python: import sys
inputs = []
for line in sys.stdin:
    inputs.append(line)
n = len(inputs)
for _ in range(n // 2):
    for line in sys.stdin:
        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: while True:
    try:
        A = list(map(int, input().split()))
        B = list(map(int, input().split()))
        a = b = 0
        for i in range(4):
            if A[i] == B[i]:
                a+=1
            elif B[i] in A:
                b+=1
        print(a, b)
    except:
        break