#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q;
  cin >> q;
  while (q--) {
    long long int l1, l2, r1, r2;
    cin >> l1 >> r1 >> l2 >> r2;
    if (l1 == l2 && r1 == r2)
      cout << l1 << " " << r1 << endl;
    else if (l1 != l2 || (r1 == r2 && l1 != l2))
      cout << l1 << " " << l2 << endl;
    else if (r1 != r2 || (l1 == l2 && r1 != r2))
      cout << r1 << " " << r2 << endl;
  }
  return 0;
}
