#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  while (n--) {
    int l1, r1, l2, r2;
    cin >> l1 >> r1 >> l2 >> r2;
    bool ok = false;
    if (l1 > l2) {
      swap(l1, l2);
      swap(r1, r2);
      ok = true;
    }
    if (ok) {
      cout << r2 << " " << l1 << endl;
      continue;
    }
    cout << l1 << " " << r2 << endl;
  }
}
