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