#!/usr/bin/python for _ in range(input()): n,m=map(int,raw_input().split()) a=0 b=1 while b*-~b<=m: b+=1 if m%b<1: if n