#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a != c) {
      cout << a << " " << c << endl;
    } else {
      cout << a << " " << d << endl;
    }
  }
  return 0;
}
