#include <bits/stdc++.h>
using namespace std;
inline void Routine() {
  srand(time(NULL));
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
template <class T, class U>
istream &operator>>(istream &in, pair<T, U> &p) {
  in >> p.fi >> p.se;
  return in;
}
template <class T, class U>
ostream &operator<<(ostream &out, const pair<T, U> &p) {
  out << p.first << ' ' << p.second;
  return out;
}
template <class T>
istream &operator>>(istream &in, vector<T> &v) {
  for (auto &i : v) {
    in >> i;
  }
  return in;
}
template <class T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (auto &i : v) {
    out << i << '\n';
  }
  return out;
}
const long long mod = 1e9 + 7;
int main() {
  Routine();
  long long q, l1, l2, r1, r2, i;
  cin >> q;
  for (i = 0; i < q; i++) {
    cin >> l1 >> r1 >> l2 >> r2;
    if (l1 != r2) {
      cout << l1 << ' ' << r2 << '\n';
    } else {
      cout << r1 << ' ' << l2 << '\n';
    }
  }
  return 0;
}
