#include <bits/stdc++.h>
using namespace std;
long long a[1001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, k, i, j, h, w, flag;
  long long l1, l2, r1, r2;
  cin >> n;
  while (n--) {
    cin >> l1 >> r1 >> l2 >> r2;
    if (l1 != l2) {
      cout << l1 << " " << l2 << endl;
    } else {
      if (r1 != r2)
        cout << r1 << " " << r2 << endl;
      else {
        cout << l1 << " " << r1 << endl;
      }
    }
  }
  return 0;
}
