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:
        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 i==j:
            hit+=1
        elif j in a:
            blow+=1
    print(hit,blow)

Python: while True:
    try:
        hit = 0
        blow = 0
        hit_idx = []
        s = list(map(int, input().split()))
        t = list(map(int, input().split()))
        for i in range(4):
            if s[i] == t[i]:
                hit_idx.append(i) 
        hit = len(hit_idx)                                
        for i in hit_idx[::-1]:     # reverse order
            s = s[:i] + s[(i+1):]
            t = t[:i] + t[(i+1):]
        for c in s:
            if c in t:
                blow += 1
                                
        print("%d %d" % (hit,blow)) 
    except:
        break

Python: while True :
    try :
        A = list(input().split())
        B = list(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
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 True:
    hit=0
    bro=0
    try:
        a = [int(i) for i in input().split()]
        b= [int(j) for j in input().split()]
        for g in range(4):
            for p in range(4):
                if a[g]==b[p]:
                    bro+=1
        for l in range(4):
            if a[l]==b[l]:
                hit+=1
                bro-=1
        print(hit,bro)
    except:break

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: while True:
    try:
        Alst = list(map(int, input().split()))
        Blst = list(map(int, input().split()))
        H = 0
        B = 0

        for a, anum in enumerate(Alst):
            for b, bnum in enumerate(Blst):
                if anum == bnum:
                    if a == b:
                        H = H + 1
                    else:
                        B = B + 1

        print(str(H) + ' ' + str(B))


    except EOFError:
        break

Python: while True :
    try :
        a1, a2, a3, a4 = map(int, input().split())
        b1, b2, b3, b4 = map(int, input().split())
    except EOFError :
        break
    
    hit = 0
    brow = 0
    if a1 == b1 :
        hit += 1
    if a2 == b2 :
        hit += 1
    if a3 == b3 :
        hit += 1
    if a4 == b4 :
        hit += 1
    if a1 == b2 or a1 == b3 or a1 == b4 :
        brow += 1
    if a2 == b1 or a2 == b3 or a2 == b4 :
        brow += 1
    if a3 == b1 or a3 == b2 or a3 == b4 :
        brow += 1
    if a4 == b1 or a4 == b2 or a4 == b3 :
        brow += 1
        
    print(hit, brow)

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

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

import sys
import os
import math

lines = sys.stdin.readlines()
game_num = len(lines) // 2

for i in range(game_num):
    s0 = lines[2 * i].strip()
    s1 = lines[2 * i + 1].strip()

    A = list(map(int, s0.split()))
    B = list(map(int, s1.split()))

    hit = 0
    blow = 0
    for j in range(4):
        if A[j] == B[j]:
            hit += 1
        elif A[j] in B:
            blow += 1
    print(hit, blow)

Python: import sys
for line in sys.stdin:
    hit = 0
    blow = 0
    if line == "\n":
        break
    A = line.split()
    B = [n for n in input().split()]
    for i in B:
        if i in A:
            if A.index(i) == B.index(i):
                hit += 1
            else:
                blow += 1
    print(hit, blow)

Python: import sys
e=iter(sys.stdin)
for a,b in zip(e,e):
 a,b=a.split(),b.split()
 for s,t in zip(a,b):h+=s==t
 print(h,4-len(set(a)-set(b))-h)

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: while True:
  try:
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    hit = blow = 0
    for i in range(len(A)):
      if A[i] == B[i]:
        hit += 1
    print(hit, end=" ")
    for b in B:
      if A.count(b) > 0:
        blow += 1
    print(blow - hit)
  except:
    break

Python: import sys
for line in sys.stdin:
    hit = 0
    blow = 0
    a_nums = line.split()
    for i_b, b in input().split():
        try:
            i = a_nums.index(b)
            if i == i_b:
                hit += 1
            else:
                blow += 1
        except ValueError:
            continue
    print(hit, blow)

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  vector<int> a(4), b(4);
  while (cin >> a[0]) {
    for (int i = 1; i < 4; i++) cin >> a[i];
    for (int i = 0; i < 4; i++) cin >> b[i];
    int hit = 0, blow = 0;
    for (int i = 0; i < 4; i++) {
      if (find(b.begin(), b.end(), a[i]) != b.end()) {
        if (a[i] == b[i]) hit++;
        else blow++;
      }
    }
    cout << hit << " " << blow << endl;
  }
}

C++: #include <stdio.h>
int main(){
	int a[4],b[4];
	int hit,blow;
	while(scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3])!=EOF){
		hit=blow=0;
		scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3]);
		for(int i=0;i<4;i++){
			if(a[i]==b[i]) hit++;
			for(int j=0;j<4;j++){
				if(i!=j){
					if(a[i]==b[j]) blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
	return 0;
}