#include <bits/stdc++.h>
using namespace std;
void prog() {
  int l1, l2, r1, r2;
  cin >> l1 >> r1 >> l2 >> r2;
  if (l1 != l2) {
    cout << l1 << " " << l2;
  } else if (r1 != r2) {
    cout << r1 << " " << r2;
  } else
    cout << l1 << " " << l1 + 1;
  cout << "\n";
}
int main() {
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    prog();
  }
}
