#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int q;
  cin >> q;
  while (q > 0) {
    int l, r, l2, r2;
    cin >> l >> r >> l2 >> r2;
    if (r2 == l)
      cout << r << ' ' << l2 << '\n';
    else
      cout << l << ' ' << r2 << '\n';
    q--;
  }
}
