#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
int x[1001];
int y[1001];
string s;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int l1, r1, l2, r2;
    cin >> l1 >> r1 >> l2 >> r2;
    if (l1 != l2)
      cout << l1 << " " << l2 << endl;
    else
      cout << l1 << " " << r2 << endl;
  }
  return 0;
}
