#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int* arr = new int[4 * n];
  for (int i = 0; i < 4 * n; ++i) {
    scanf("%d", arr + i);
  }
  for (int i = 0; i < 4 * n; i += 4) {
    printf("%d ", arr[i]);
    if (arr[i] == arr[i + 2]) {
      printf("%d ", arr[i + 3]);
    } else {
      printf("%d ", arr[i + 2]);
    }
  }
  delete[] arr;
}
