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