#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    while(cin<<n){

	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int w,x,y,z;
	int hit=0,blow=0;
	cin>>w>>x>>y>>z;
	if(w==a)hit++;
	else if(w==b||w==c||w==d)blow++;
	if(x==b)hit++;
	else if(x==a||x==c||x==d)blow++;
	if(y==c)hit++;
	else if(y==b||y==a||y==d)blow++;
	if(z==d)hit++;
	else if(z==b||z==c||z==a)blow++;
	cout<<hit<<" "<<blow<<endl;
    }


	return 0;
}