#include <bits/stdc++.h>
using namespace std;
long long l1, l2, r1, r2, q;
long long p1, p2;
int main() {
  scanf("%lld", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%lld%lld%lld%lld", &l1, &r1, &l2, &r2);
    p1 = l1;
    p2 = l2;
    if (p1 == p2) p2 = r2;
    printf("%lld %lld\n", p1, p2);
  }
  return 0;
}
