#include <iostream>
#define N 4
using namespace std;
int main()
{
	int a[N][N];
	while(1)
	{
		for (int j=0;j<N;j++)
			for (int k=0;k<N;k++)
				cin>>a[j][k];
		for (int i=0;i<N;i++)
		{
			if (a[0][i]==a[1][i])
				cout<<a[1][i]<<" "<<"1"<<endl;
			if (a[2][i]!=a[3][i])
				cout<<a[3][i]<<" "<<"0"<<endl;
		}
	}
}