#include <iostream>

using namespace std;

int main(){

	int A[5];
	int B[5];
	int k = 1;

	while(1){

		int hit = 0 , blow = 0;

		for(int i = 0; i < 4; i++){
			cin >> A[i];
		}

		for(int i = 0; i < 4; i++){
			cin >> B[i];
		}

		if(A[0] == 0 && A[1] == 0 && A[2] == 0 && A[3] == 0 &&
			B[0] == 0 && B[1] == 0 && B[2] == 0 && B[3] == 0) break;

		for(int i = 0; i < 4; i++){
			if(A[i] == B[i]){
					hit++;
				}
			for(int j = 0; j < 4; j++){

				if(A[i] ==  B[j] && A[i] != B[i]){
					blow++;
				}
			}
		}

		cout << hit << " " << blow << endl;
		k++;
	}

	return 0;
}