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