#include <bits/stdc++.h>
using namespace std;
void f() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << a << " ";
  if (a == c)
    cout << d << "\n";
  else
    cout << c << "\n";
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    f();
  }
}
