#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long res1 = (a + b) / 2;
    long long res2 = (c + d) / 2;
    if (res1 == res2) res2++;
    cout << res1 << " " << res2 << endl;
  }
  return 0;
}
