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