#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4][4];
  while (1) {
    for (int j = 0; j < 4; j++)
      for (int k = 0; k < 4; k++) cin >> a[j][k];
    for (int i = 0; i < 4; 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;
    }
  }
}
