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