#include <bits/stdc++.h>
using namespace std;
int main() {
  int l1, l2, r1, r2, i, t;
  cin >> t;
  while (t--) {
    cin >> l1 >> r1 >> l2 >> r2;
    if (l1 != l2)
      cout << l1 << " " << l2 << endl;
    else
      cout << l1 << " " << r2 << endl;
  }
}
