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