#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a != c)
      cout << a << " " << c << endl;
    else
      cout << a << " " << d << endl;
  }
  return 0;
}
