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