Arya and Arrays
Anonymous User
304
Apr 01, 2020
Apr 01, 2020

Arya has always been obsessed about arrays. She recently had a visitor who challenged her in an array challenge. The visitor gave her two arrays that contain n positive integers and asked her to check if the arrays are equal. The arrays are equal if both the arrays contain the same integers. The order doesn’t matter.

If they are unequal, she needs to find the smallest positive integer that can be added to any one of the integers of any of the arrays to make them equal.

Help Arya in solving the challenge.

Constraints

1 <= T <= 100

1 <= n <= 10000

0 <= ar[i] <= 1000

Input Format
The first line of input consists of an integer t which denotes the number of test cases

The first line of each test case contains an integer n which denotes the size of both arrays

The second line of each test case contains n space separated integers denoting the first array

The third line of each test case contains n space separated integers denoting the second array

Output Format
For each test case

If the arrays are equal, print Yes

If the arrays are unequal, print two space separated integers p and q. Here p is the smallest positive integer that needs to be added to an integer of array q. If p needs to be added to the first array, then q is 1 and if it needs to be added to the second array q is 2

If there is no such integer, then print No

Sample Input
3
5
1 4 0 2 5
2 0 5 1 4
4
1 1 7 2
1 13 2 1
3
3 1 7
2 5 4
Sample Output
Yes
6 1
No
Explanation
For the first test case, both the arrays have the same integers. Hence the answer is Yes.

For the second test case, if we add 6 to integer 7 of the first array, arrays become equal.

So the answer is 6 1.

For the third test case, since the arrays differ by three integers; there isn’t any way to make both arrays equal by adding just one positive integer to any integer. So, the answer is No.

Comments (1)