#include <bits/stdc++.h>
int main() {
  long long int t, i, a, b, c, d;
  scanf("%lld", &t);
  for (i = 0; i < t; i++) {
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    if (a == c)
      printf("%lld %lld\n", a, a + 1);
    else
      printf("%lld %lld\n", a, c);
  }
  return 0;
}
