#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k = 0;
  cin >> n;
  int a[n][4];
  int i, j;
  for (i = 0; i < n; i++)
    for (j = 0; j < 4; j++) cin >> a[i][j];
  for (i = 0; i < n; i++) {
    for (m = 0, k = 0, j = 0; j < 4; j += 2) {
      m = (a[i][j] + a[i][j + 1]) / 2;
      if (k == m)
        cout << m + 1 << " ";
      else
        cout << m << " ";
      k = m;
    }
    cout << endl;
  }
  return (0);
}
