#include <bits/stdc++.h>
using namespace std;
inline void re(int &x) {
  x = 0;
  bool flag = false;
  char c = getchar();
  while (c < '0' || c > '9') {
    flag = c == '-';
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ '0');
    c = getchar();
  }
  if (flag) x = -x;
  return;
}
int main() {
  int l, r, L, R;
  int q;
  cin >> q;
  while (q--) {
    cin >> l >> r >> L >> R;
    if (l < L)
      printf("%d %d\n", l, R);
    else
      printf("%d %d\n", r, L);
  }
  return 0;
}
