Problem Statement:
Param is a secret agent working with the Indian intelligence agency RAW, he has a mission to collect data about all the black money holders of India at Swiss Bank. He makes a trip to Switzerland to complete his mission. Swiss Bank has a very tight security and their systems are fully encrypted but he successfully hacks the systems. He further needs a key to decrypt the data and the key is the nth prime number between two given numbers. Everyone knows that he is a lazy leaf, so he asks you to get this key for him.
Input:
The first line of input contains the number of test cases t
This is followed by three space separated integers
a b n
a: the starting number
b: the ending number
n: the index of the prime number to be printed between a and b (both inclusive)
Output:
For every test case print the required nth prime number between given two numbers, if not possible print -1.
Contraints:
1<=t<=1000
1<=a<=b<=10^6 , b-a<=10^4
1<=n<=10000
Sample Input:
3
1 10 3
3 5 2
10 50 40
Sample Output:
5
5
-1
Explanation for test case #1:
3rd prime from 1 to 10 is 5