#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  long long a, b, c, d;
  scanf("%d", &q);
  while (q--) {
    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    if (a != c)
      printf("%lld %lld\n", a, c);
    else
      printf("%lld %lld\n", a, d);
  }
  return 0;
}
