Max and Min Products
##### Submissions: 1363   Accuracy: 19.48%   Difficulty: Easy   Marks: 2

Given a set, we need to find maximum and minimum possible product among all subsets of the set.
Examples:

```Input : arr[] = {4, -2, 5};
Output: Maximum product = 20
Minimum product = -40
Maximum product is obtained by multiplying
4 5
Minimum product is obtained by multiplying
4, -2, 5

Input : arr[] = {-4, -2, 3, 7, 5, 0, 1};
Output: Maximum product = 840
Minimum product = -420
Maximum product is obtained by multiplying
-4, -2, 3, 7, 5
Minimum product is obtained by multiplying
-4, 3, 7, ```

Input:
The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case contains a single integer N denoting the size of array. The second line contains N space-separated denoting the elements of the array.

Output:
Print the maximum product followed by a space followed by minimum subset product.

Constraints:
1 ≤ T ≤ 40
1 ≤ N ≤ 20
-100 ≤ A[i] <= 100

Example:
Input
2
3
1 2 3
4
-1 -2 -3 -4

Output

6 1
24 -24

#### ** For More Input/Output Examples Use 'Expected Output' option **

Author: kartik

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.