You will be given two positive integers N and K. You have to find the Kth smallest factor of N. A factor of N is a positive integer which divides N.
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 space separated positive integers which denote N and K.
For each test case in a new line print the Kth smallest factor of N if it exists otherwise print -1.
1 ≤ T ≤ 100
1 ≤ N ≤ 1015
1 ≤ K ≤ 1011
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.