## Max and Min Value in List of Tuples

Write a program to print the maximum and minimum of all the values at index zero and index one in the list of tuples.

Input

The first line of input will contain a positive integer (N).

The next N lines will contain space-separated two integers, denoting elements of each tuple.

Output

The first line of output should contain a tuple with the maximum and minimum value at index zero.

The second line of output should contain a tuple with the maximum and minimum value at index one.

Explanation

For example, if the given N is 3, read the inputs in the next three lines. If the inputs in the next three lines are the following.

1 5

3 2

5 8

As 5 is the maximum and 1 is the minimum in the values at index zero and 8 is the maximum and 2 is the minimum in the values at index one. So the output should be

(5, 1)

(8, 2)

Sample Input 1

4

1 2

2 5

10 1

-3 6

Sample Output 1

(10, -3)

(6, 1)

Code:

```
n = int(input())
num_list = []
zero_index_list = []
first_index_list = []
for i in range(n):
values_list = input().split()
first_value = int(values_list[0])
zero_index_list.append(first_value)
second_value = int(values_list[1])
first_index_list.append(second_value)
zero_index_min_max_tuple = (max(zero_index_list), min(zero_index_list))
first_index_min_max_tuple = (max(first_index_list),min(first_index_list))
print(zero_index_min_max_tuple)
print(first_index_min_max_tuple)
```

Input

5

6 9

2 5

4 1

7 3

Output

(7, -1)

(9, 1)