|All-time Popular Problems|
|Construct Tree from Inorder & Preorder|
|Sum of two large numbers|
|Level order traversal in spiral form|
|Spirally traversing a matrix|
|Angle between hour and minute hand|
|Binary Tree to DLL|
|Smallest Positive missing number|
|Height of Binary Tree|
|Largest Number formed from an Array|
Given an unsorted array. The task is to find all the star and super star elements in the array. Star are those elements which are strictly greater than all the elements on its right side. Super star are those elements which are strictly greater than all the elements on its left and right side.
Note: Assume first element (A) is greater than all the elements on its left side, And last element (A[n-1]) is greater than all the elements on its right side.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains an Integer N denoting size of array and the second line contains N space separated elements.
For each test case, print the space separated star elements and then in new line print super star elements. If no super star element present in array then print "-1".
4 2 5 7 2 1
8 6 5
7 2 1
8 6 5