#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    scanf(" %d %d %d %d", &x1, &y1, &x2, &y2);
    if (x1 != x2)
      printf("%d %d\n", x1, x2);
    else if (y1 != y2)
      printf("%d %d\n", y1, y2);
    else
      printf("%d %d\n", x1, y2);
  }
  return 0;
}
