#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int visit[3005];
bool cmp(pair<int, int> p1, pair<int, int> p2) { return p1.second < p2.second; }
int main() {
  int long long a, b, c, d, n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    int long long x = (a + b) / 2;
    int long long y = (c + d) / 2;
    if (x == y) {
      x = a;
      y = d;
    }
    cout << x << " " << y << endl;
  }
  return 0;
}
