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

if __name__ == '__main__':
    data = []
    for line in sys.stdin:
        data.append([int(x) for x in line.strip().split(' ')])
        if len(data) == 2:
            choice_a = data[0]
            choice_b = data[1]
            data = []

            #print(choice_a)
            #print(choice_b)

            # hit&blow?????????
            hit = 0
            blow = 0
#            for i, d in enumerate(choice_a):
#                if d in choice_b:
#                    if choice_a[i] == choice_b[i]:
#                        hit += 1
#                    else:
#                        blow += 1


            for i, d in enumerate(choice_a):
                if d in choice_b:
                    if d == choice_b[i]:
                        hit += 1
                    else:
                        blow += 1

            # ???????????¨???
            print('{0} {1}'.format(hit, blow))

Python: import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    *A, = map(int, readline().split())
    *B, = map(int, readline().split())
    v1 = v2 = 0
    for i in range(4):
        if A[i] == B[i]:
            v1 += 1
        for j in range(4):
            if i != j and A[i] == B[j]:
                v2 += 1
    write("%d %d\n" % (v1, v2))
try:
    while 1:
        solve()
except:
    ...

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 in range(len(aa)):
        if aa[one] == bb[one]:
            hit += 1
            
    for one_a in range(len(aa)):
        ai = aa[one_a]
        for one_b in range(len(bb)):
            bi = bb[one_b]
            if ai== bi 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  = 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:
        break

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 in range(len(aa)):
        if aa[i] == bb[i]:
            hit += 1
            
    for one_a in range(len(aa)):
        ai = aa[one_a]
        for one_b in range(len(bb)):
            bi = bb[one_b]
            if ai== bi 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: import sys
Lines = sys.stdin.readlines()

for i in range(0, len(Lines), 2):
    Anumbers = list(map(int, Lines[i].split()))
    Bnumbers = list(map(int, Lines[i+1].split()))
    Hit = 0    
    for j in range(len(Anumbers)):
        Hit += 1 if (Anumbers[j] == Bnumbers[j]) else 0
    Blow = len(set(Anumbers) & set(Bnumbers)) - Hit
    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: while(1):
    hit = 0
    blow = 0
    a = input().split(' ')
    b = input().split(' ')
    for a_, b_ in zip(a, b):
        if a_ == b_:
            hit += 1
        elif a_ in b:
            blow += 1
    print(hit, blow)

Python: while 1:
    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 b[i] in a:
                blow += 1
        print(hit,blow) 
    except:
        break

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

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

Python: while 1:
    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 b[i] in a:
                blow += 1
        print(hit,blow) 
    except:
        break

Python: import sys

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

if __name__ == '__main__':
    data = []
    for line in sys.stdin:
        data.append([int(x) for x in line.split(' ')])
        if len(data) == 2:
            choice_a = data[0]
            choice_b = data[1]
            data = []

            #print(choice_a)
            #print(choice_b)

            # hit&blow?????????
            hit = 0
            blow = 0
            for i, d in enumerate(choice_a):
                if d in choice_b:
                    if d == choice_b[i]:
                        hit += 1
                    else:
                        blow += 1

            # ???????????¨???
            print('{0} {1}'.format(hit, blow))

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

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)
                    if b==A[index]:
                        Hit+=1

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

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

Python: import sys

def solve():
    A = []
    B = []
    for i, line in enumerate(sys.stdin):
        t = tuple(map(int, line.split()))
        if i % 2 == 0:
            A.append(t)
        else:
            B.append(t)
    
    for a, b in zip(A, B):
        hit, blow = 0, 0
        
        for i, bb in enumerate(b):
            for j, aa in enumerate(a):
                if bb == aa and i == j:
                    hit += 1
                    break
                elif bb == aa and i != j:
                    blow += 1
                    break
        print(hit, blow)
        

if __name__ == "__main__":
    solve()