Polycarp wants to buy exactly n shovels. The shop sells packages with shovels. The store has k types of packages: the package of the i-th type consists of exactly i shovels (1 ≤ i ≤ k). The store has an infinite number of packages of each type.

Polycarp wants to choose one type of packages and then buy several (one or more) packages of this type. What is the smallest number of packages Polycarp will have to buy to get exactly n shovels?

For example, if n=8 and k=7, then Polycarp will buy 2 packages of 4 shovels.

Help Polycarp find the minimum number of packages that he needs to buy, given that he: 

  * will buy exactly n shovels in total; 
  * the sizes of all packages he will buy are all the same and the number of shovels in each package is an integer from 1 to k, inclusive. 

Input

The first line contains an integer t (1 ≤ t ≤ 100) — the number of test cases in the input. Then, t test cases follow, one per line.

Each test case consists of two positive integers n (1 ≤ n ≤ 10^9) and k (1 ≤ k ≤ 10^9) — the number of shovels and the number of types of packages.

Output

Print t answers to the test cases. Each answer is a positive integer — the minimum number of packages.

Example

Input


5
8 7
8 1
6 10
999999733 999999732
999999733 999999733


Output


2
8
1
999999733
1

Note

The answer to the first test case was explained in the statement.

In the second test case, there is only one way to buy 8 shovels — 8 packages of one shovel.

In the third test case, you need to buy a 1 package of 6 shovels.
"""
import random

#functions
def introduction():
    print("Welcome to The Hardman Game")
    print("****RULES****")
    print("1. The Computer will Randomly Pick a Word from the Given Dictionary")
    print("2. You have to Guess the word letter by letter . For each letter, a maximum of 6 guesses will be allowed")
    print("3. If you cannot guess the correct letter within 6 attempts , the Game stops and you lose")

def guess_the_word(correct_word):
    user_guessed_word = ""
    length_of_correct_word = len(correct_word)
    ptr = 0
    while ptr<length_of_correct_word:
        turns = 0
        flag = False
        print("New Letter....You have 6 guesses left")
        while turns<6:
            char_guessed = input()
            if char_guessed == correct_word[ptr]:
                print("*****Correct Guess*****")
                user_guessed_word += char_guessed
                flag = True
                break
            else:
                print("Wrong guess...You have "+str((5-turns))+" left")
                turns+=1
        if flag == False:
            break
        ptr+=1
    if (user_guessed_word == correct_word):
        print("*******You Guessed the word Correctly*******")
        print("The Correct word is " + user_guessed_word)
    else:
        print("*******You couldn't guess the word correctly********")
        print("The Correct word is " + user_guessed_word)

#code
words = ['promote','intelligent','facebook','alphabate','objective','individual','successful','character','otherwise','mountain','beautiful','processor','instagram']
word = random.choice(words)
introduction()
guess_the_word(word)
"""

"""
import json
import time

def ask_one_question(question,correct_option):
    print(question)
    option = int(input())
    while option not in range(1,5):
        print("Option not valid....choose a valid option")
        option = int(input())
    if option == int(correct_option):
        return 5
    return 0
    
def load_questions():
    questions = None
    filename = "quiz.txt"
    with open(filename,"r") as read_file:
        questions = json.load(read_file)
    return questions
    
def take_quiz():
    questions = load_questions()
    score = 0
    for question in questions:
        choice = ask_one_question(question,questions[question])
        score = score + choice
        if choice == 5:
            print("Correct Answer")
        else:
            print("Wrong Answer")
        time.sleep(2)
    print("The Quiz is finished and you have scored " + score + " points")
    print("Thank You for taking the quiz")
        
def introduction():
    print("******Welcome to the Quiz which determines your IQ with the highest precision")
    print("**Questions are from different fields and topics which will determine your IQ comprehensively")
    print("**Would you like to take the quiz")
    print("****Choose.... 1->Take the Quiz....2->Not to take the Quiz****")
    choice = input()
    if choice=="1":
        print("Please Enter Your Name")
        name = input()
        name = name.capitalize()
        print("******Instructions for the Quiz are as Follows******")
        time.sleep(1)
        print("**1. There will be a total of 30 Questions.Each question Carries 5 Points.There is no negative marking.**")
        time.sleep(5)
        print("**2.The topics included in the quiz are Politics,Sports,Astronomy,Telivison and Cinema,Bussiness,History,Science and Technology**")
        time.sleep(5)
        print("**3.There will be 4 options for every Questions out of which only one is correct....Enter 1 for the first option and similarly for others")
        time.sleep(5)
        print("Quiz will Start Shortly...Get Ready")
        time.sleep(5)
        take_quiz()
    else:
        print("*****Try Next Time*****")

if __name__== "__main__":
    introduction()
"""

def factors(n):
    i = 1
    b = []
    p = int(n**(0.5))
    while i <= p: 
        if (n % i == 0):
            if (n // i == i) : 
                b.append(i)
            else: 
                b.append(i)
                b.append(n//i)
        i = i + 1
    return b
t = int(input())
for _ in range(t):
    n,k = list(map(int,input().split()))
    b = factors(n)
    b.sort()
    b.reverse()
    for i in b:
        if i<=k:
            print(n//i)
            break
