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

C++: #include<stdio.h>
int main(){
	int a[4],b[4];
	while(~scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3])){
		
		scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3]);
		int 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++;
		printf("%d %d\n",hit,blow);
	}
}

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

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

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int main(){
    while(1){
        vector<int> a(4);
        vector<int> b(4);
        rep(i,4) cin >> a[i];
        rep(i,4) cin >> b[i];
        int hit = 0,blow = 0;
        rep(i,4){
            if(a[i] == b[i]) hit++;
            else {
                rep(j,4) if(a[j] == b[i]) blow++;
            }
        }
        cout << hit << " " << blow << endl;
    }
    return 0;
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   int a[4],b[4];
   int hit,blow;
   while(cin>>a[0])
   {
     hit=blow=0;
     for(int i=1;i<4;i++) cin>>a[i];
     for(int i=0;i<4;i++) cin>>b[i];
     for(int i=0;i<4;i++) if(a[i]==b[i]) hit++;
     for(int i=0;i<4;i++)
     {
       for(int j=i+1;j<4;j++)
       {
         if(a[i]==b[j]) blow++;        
       }        
     }
     cout<<hit<<" "<<blow<<endl;
   }
   //while(1);      
   return 0;    
 }

C++: #include <cstdio>

using namespace std;

int hit = 0, blow = 0,a[4], b[4];

int main()
{
    for( int i = 0; i < 4; i++ )
    {
        scanf( "%d ", &a[i] );
    }
    for( int i = 0; i < 4; i++ )
    {
        scanf( "%d ", &b[i] );
    }

    for( int i = 0; i < 4; i++ )
    {
        if( a[i] == b[i] )
        {
            hit++;
        }
        for( int j = 0; j < 4; j++ )
        {
            if( i != j && a[i] == b[j] )
            {
                blow++;
            }
        }
    }
    
    printf( "%d %d\n", hit, blow );
    return 0;
}

C++: //#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    vi a(4);
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]) {
        vi b(4);
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hit=0, blow=0;
        rep(i,4) {
            if(a[i]==b[i]) hit++;
            else {
                rep(j,4) if(a[i]==b[j]) blow++;
            }
        }
        printf("%d %d\n",hit,blow);
    }
    return 0;
}

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

int main()
{
	int i,j;
	int a[4];
	int b[4];
	while(cin >> a[0]){

		int hit =  0;
		int blow = 0;
		for(i=1;i<4;++i)cin>>a[i];
		for(i=0;i<4;++i)cin>>b[i];

		for(i=0;i<4;++i){
			for(j=0;j<4;++j){
				if(b[i] == a[j]){
					(j == i) ? ++hit : ++blow;
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
}

C++: // 0025 Hit and Blow
#include<iostream>
using namespace std;

int main()
{
	int a[4];
	int b[4]; 
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ 
	  int hit  =0;
	  int blow =0;

	for(int i=0; i<4; i++)
		cin >> b[i];

	for(int i=0; i<4; i++)
		for(int j=0; j<4; j++)
			if(a[i]==b[j])
				if(i==j)	
					hit++;
				else
					blow++;
	cout<< hit << "" << blow << endl; 
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
  int a[4], b, hit, blow, i, j;
  while (cin >> a[0]) {
    for (i = 1; i < 4; i++) {
      cin >> a[i];
    }
    for (i = 0; i < 4; i++) {
      cin >> b;
      for (j = 0; j < 4; j++) {
	if (a[j] == b) {
	  if (i == j) {
	    hit++;
	  }
	  else {
	    blow++;
	  }
	}
      }
    }
    cout << hit << ' ' << blow << endl;
  }
  return 0;
}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
using namespace std;

void solve(int a[], int b[], int ret[]){
	// ret[0] = ヒット数, ret[1] = ブロー数
	for (int i = 0; i < 4; i++){
		if (a[i] == b[i])	ret[0]++;
		else{
			for (int j = 0; j < 4; j++){
				if (b[i] == a[j])
					ret[1]++;
			}
		}
	}
}

int main(){
	int a[4], b[4];
	int ret[2] = {};

	while (cin >> a[0] >> a[1] >> a[2] >> a[3], !cin.eof()){
		for (int i = 0; i < 4; i++)	cin >> b[i];
		ret[0] = 0; ret[1] = 0;
		solve(a, b, ret);
		cout << ret[0] << " " << ret[1] << endl;
	}
	return 0;
}