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