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

C++: #include <bits/stdc++.h>
using namespace std;

const int INF = 1e+9 * 2;
double eps = 1e-10;

int main() {
	int a[4], b[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
		bool cnt[16] = {0};
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; ++i)
			cnt[a[i]] = true;
		for(int i = 0; i < 4; ++i){
			if(cnt[b[i]]){
				if(a[i] == b[i])
					hit++;
				else
					blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 1LL << 25;
double EPS = 1e-9;

// BEGIN //////////////////////////////////////////////////////////////

int main() {
	int as[4];
	int bs[4];
	while (scanf("%d%d%d%d", as, as+1, as+2, as+3) != EOF) {
		scanf("%d%d%d%d", bs, bs+1, bs+2, bs+3);
		int h = 0, b = 0;
		REP(i, 4) {
			if (as[i] == bs[i]) {
					h++;
			}	else {
				REP(j, 4) {
					if (i == j) continue;
					if (bs[i] == as[j]) {
						b++;
					}
				}
			}
		}
		cout << h << SPACE << b << endl;

	}
}

// END   //////////////////////////////////////////////////////////////

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int a, b, c, d, e, f, g, h;

	while ( cin >> a >> b >> c >> d >> e >> f >> h >> h )
	{
		vector<int> pa;
		pa.push_back( a );
		pa.push_back( b );
		pa.push_back( c );
		pa.push_back( d );
		
		vector<int> pb;
		pb.push_back( e );
		pb.push_back( f );
		pb.push_back( g );
		pb.push_back( h );

		int hit, blow;
		hit = blow = 0;

		for ( unsigned int i = 0; i < 4; i++ )
		{
			for ( unsigned int j = 0; j < 4; j++ )
			{
				if ( pa[i] == pb[j] )
				{
					if ( i == j )
					{
						hit++;
					}
					else
					{
						blow++;
					}
				}
			}
		}

		cout << hit << ' ' << blow << endl;
	}

	return 0;
}

C++: #include<iostream>

int main(){
	int a[4],b[4],i,n,hit=0,blow=0;


	while(std::cin>>a[0]){

	for(i=0;i<4;i++){
		std::cin>>a[i];
	}
	
	for(i=0;i<4;i++){
		std::cin>>b[i];
	}

	for(i=0;i<4;i++){
		for(n=0;n<4;n++){
			if(a[i]==b[n]){
				if(i==n){
					hit++;
				}
				else blow++;
			}
		}
	}

	std::cout<<hit<<" "<<blow<<std::endl;

	return 0;

	}

}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <algorithm>

using namespace std;

int main() {
	int a[4], b[4];
	
	a[0] = -1;
	cin >> a[0];
	
	while (a[0] != -1) {
		cin >> a[1] >> a[2] >> a[3];
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		
		int hit = 0;
		int bite = 0;
		
		for (int i = 0; i < 4; i++) {
			if (a[i] == b[i]) hit++;
		}
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (i == j) continue;
				
				if (a[i] == b[j]) {
					bite++;
					break;
				}
			}
		}
		
		cout << hit << " " << bite << endl;
		
		a[0] = -1;
		cin >> a[0];
	}
	
	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<vector>
using namespace std;
int main() {
	int a1,a2,a3,a4,b1,b2,b3,b4,k,l,m,hit,blow;
	vector<int> s,t,u;
	while (cin>>a1>>a2>>a3>>a4>>b1>>b2>>b3>>b4) {
		hit = 0;
		blow = 0;
		s.clear();
		t.clear();
		s.push_back(a1);
		s.push_back(a2);
		s.push_back(a3);
		s.push_back(a4);
		t.push_back(b1);
		t.push_back(b2);
		t.push_back(b3);
		t.push_back(b4);
		for (k = 0; k < 4; k++) {
			if (s[k] == t[k]&&s[k]>=0) {
				hit += 1;
				s[k] = -1;
				t[k] = -1;
			}
		}
		for (l = 0; l < 4; l++) {
			for (m = 0; m < 4; m++) {
				if (s[l] == t[m] && s[l] > 0) {
					blow += 1;
					s[l] = -1;
					t[m] = -1;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int h=0,n=0;
	while(1){
	int a[3],b[3],dat=1;
	for(int	i=0;i<4;i++){
			cin>>dat;
			a[i]=dat;
	}
	for(int j=0;j<4;j++){
			cin>>dat;
			b[j]=dat;
	}
	if(dat==EOF){
		break;
	}
	for(int k=0;k<4;k++){
		for(int o=0;o<4;o++){
			if(a[k]==b[k]){
				h++;
			}
			if(a[k]!=b[k] && a[k]==b[o]){
				n++;
			}
		}
	}
	}
	cout<<h<<endl;
	cout<<n<<endl;
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
//#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
//const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
    int a[4], b[4];
    int hit , blow;
    while(scanf("%d%d%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3]) != EOF){   
    hit = 0, blow = 0;
    for(int i = 0; i < 4; i++){
	  for(int j = 0; j < 4; j++){
		  if (a[i] == b[j]){
			  if (i != j) blow++;
			  else hit++;  
			} 
		 }	
	  }
	cout << hit << " " << blow << endl;
  }
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}