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