#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    int l1, r1, l2, r2;
    scanf("%d", &l1);
    scanf("%d", &r1);
    scanf("%d", &l2);
    scanf("%d", &r2);
    if (l1 != r2)
      cout << l1 << " " << r2 << endl;
    else if (l1 != l2)
      cout << l1 << " " << l2 << endl;
    else if (r1 != r2)
      cout << r1 << " " << r2 << endl;
    else
      cout << r1 << " " << l2 << endl;
  }
}
