#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 2;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int x[3], y[3];
    for (int i = 0; i < 2; ++i) cin >> x[i];
    for (int i = 0; i < 2; ++i) cin >> y[i];
    bool f = 0;
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        if (x[i] != y[j]) {
          cout << x[i] << " " << y[j] << "\n";
          f = 1;
          break;
        }
        if (f) break;
      }
      if (f) break;
    }
    if (!f) cout << (x[0] + x[1]) / 2 << " " << (y[0] + y[1]) / 2 << "\n";
  }
}
