#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long double PI = acos(-1);
const long double EPS = 0.0000000001;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
  long long times;
  cin >> times;
  while (times--) {
    long long l1, l2, r1, r2;
    cin >> l1 >> r1 >> l2 >> r2;
    long long res1 = l1, res2 = r2;
    if (res1 == res2) res2 = l2;
    cout << res1 << ' ' << res2 << endl;
  }
}
