#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  int n, m, x, y;
  for (int i = 0; i < k; i++) {
    cin >> n >> m >> x >> y;
    if (n != x) {
      cout << n << " " << x << endl;
    } else {
      cout << n << " " << y << endl;
    }
  }
  return 0;
}
