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