#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265358979323846;
void debn(vector<int> a) {
  for (auto v : a) cout << v << ' ';
  cout << endl;
}
void debnn(vector<vector<int>> a) {
  for (auto v : a) {
    for (auto w : v) cout << w << ' ';
    cout << endl;
  }
}
long long powmod(long long x, long long y, long long mod) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    y >>= 1;
    x = x * x % mod;
  }
  return res;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int l1, r1, l2, r2;
    cin >> l1 >> r1 >> l2 >> r2;
    if (l1 > r1) swap(l1, r1);
    if (l2 > r2) swap(l2, r2);
    if (l1 < l2)
      cout << l1 << ' ' << r2 << endl;
    else
      cout << r1 << ' ' << l2 << endl;
  }
  return 0;
}
