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