1.

You are given an array A (distinct integers) of size N, and you are also given a sum. You need to find if two numbers in A exists that have sum equal to the given sum.

Input Format:
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains three lines of input. The first line contains N denoting the size of the array A. The second line contains N elements of the array. The third line contains element sum.

Output Format:
For each testcase, in a new line, print  "1"(without quotes) if any pair found, othwerwise print "0"(without quotes) if not found.

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the provided function sumExists.

Constraints:
1 <= T <= 100
1 <= N <= 1000
1 <= Ai <= 106

Examples:
Input:

1
10
1 2 3 4 5 6 7 8 9 10
14
Output:
1

2.

You are given two arrays of size n1 and n2. Your task is to find all the elements that are common to both the arrays and sum them print them in the order as they appear in the second array. If there are no common elements the output would be 0.

Note: The arrays may contain duplicate elements. However, you need to sum only unique elements that are common to both arrays.

Input Format:
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains two three lines of input. The first line contains n1 and n2 separated by a space. The second line contains elements of arr1. The third line contains elements of arr2.

Output Format:
For each testcase, in a new line, print the common sum.

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the provided function commonSum that takes two arrays as input.

Constraints:
1 <= T <= 100
1 <= n1,n2 <= 1000
1 <= arr1i,arr2i <= 109

Example:
Input:

1
5 6
1 2 3 4 5
2 3 4 5 6 7
Output:
14

3.

Given an unsorted array of size N and value K. The elements of the array A contains positive integers. You have to print all the elements which are greater than K in the array(including K as well if present in the array A), and print all the elements which are smaller than K in seperate lines. If the elements greater than K does not present in the array then print "-1". Similarly, in case of smaller elements print -1 if elements smaller than k doesn’t exist.

Input Format:
First line of input contains number of testcases T. For each testcase, there are two lines, first of which contains N and K seperated by space, next line contains N space seperated integers.

Output Format:
For each testcase, print the required elements(if any), else print "-1" (without quotes).

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the provided greaterKSorted and smallerKSorted functions that takes two input one is array and second is K.

Constraints:
1 <= T <= 100
1 <= N <= 103
1 <= K <= 106
1 <= A[i] <= 106

Example:
Input:

1
5 1
2 1 5 7 6

Output:
1 2 5 6 7
-1