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