#D4580. Two distinct points

    ID: 3808 Type: Default 1000ms 256MiB

Two distinct points

Two distinct points

You are given two segments [l_1; r_1] and [l_2; r_2] on the x-axis. It is guaranteed that l_1 < r_1 and l_2 < r_2. Segments may intersect, overlap or even coincide with each other.

The example of two segments on the x-axis.

Your problem is to find two integers a and b such that l_1 ≤ a ≤ r_1, l_2 ≤ b ≤ r_2 and a ≠ b. In other words, you have to choose two distinct integer points in such a way that the first point belongs to the segment [l_1; r_1] and the second one belongs to the segment [l_2; r_2].

It is guaranteed that the answer exists. If there are multiple answers, you can print any of them.

You have to answer q independent queries.

Input

The first line of the input contains one integer q (1 ≤ q ≤ 500) — the number of queries.

Each of the next q lines contains four integers l_{1_i}, r_{1_i}, l_{2_i} and r_{2_i} (1 ≤ l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} ≤ 10^9, l_{1_i} < r_{1_i}, l_{2_i} < r_{2_i}) — the ends of the segments in the i-th query.

Output

Print 2q integers. For the i-th query print two integers a_i and b_i — such numbers that l_{1_i} ≤ a_i ≤ r_{1_i}, l_{2_i} ≤ b_i ≤ r_{2_i} and a_i ≠ b_i. Queries are numbered in order of the input.

It is guaranteed that the answer exists. If there are multiple answers, you can print any.

Example

Input

5 1 2 1 2 2 6 3 4 2 4 1 3 1 2 1 3 1 4 5 8

Output

2 1 3 4 3 2 1 2 3 7

inputFormat

Input

The first line of the input contains one integer q (1 ≤ q ≤ 500) — the number of queries.

Each of the next q lines contains four integers l_{1_i}, r_{1_i}, l_{2_i} and r_{2_i} (1 ≤ l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} ≤ 10^9, l_{1_i} < r_{1_i}, l_{2_i} < r_{2_i}) — the ends of the segments in the i-th query.

outputFormat

Output

Print 2q integers. For the i-th query print two integers a_i and b_i — such numbers that l_{1_i} ≤ a_i ≤ r_{1_i}, l_{2_i} ≤ b_i ≤ r_{2_i} and a_i ≠ b_i. Queries are numbered in order of the input.

It is guaranteed that the answer exists. If there are multiple answers, you can print any.

Example

Input

5 1 2 1 2 2 6 3 4 2 4 1 3 1 2 1 3 1 4 5 8

Output

2 1 3 4 3 2 1 2 3 7

样例

5
1 2 1 2
2 6 3 4
2 4 1 3
1 2 1 3
1 4 5 8
1 2

2 3 2 1 1 3 1 5

</p>