#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long q;
  cin >> q;
  while (q--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << a << " ";
    if (a == c) {
      cout << d << '\n';
    } else {
      cout << c << '\n';
    }
  }
  return 0;
}
