we n city label 1 n two different city label x y directly connect bidirectional road x y share common divisor strictly great threshold more formally city label x y road exist integer z follow truex z 0y z 0 andz thresholdGiven integer n threshold array query determine queriesi ai bi city ai bi connect directly indirectly ie path themreturn array answer answerlength querieslength answeri true ith query path ai bi answeri false path Example 1input n 6 threshold 2 query 142536output falsefalsetrueexplanation the divisor number1 12 1 23 1 34 1 2 45 1 56 1 2 3 6using underline divisor threshold city 3 6 share common divisor theonly one directly connect the result query14 1 connect 425 2 connect 536 3 connect 6 path 36example 2input n 6 threshold 0 query 4534322613output truetruetruetruetrueexplanation the divisor number previous example however threshold 0all divisor since number share 1 divisor city connectedexample 3input n 5 threshold 1 query 4545322334output falsefalsefalsefalsefalseexplanation only city 2 4 share common divisor 2 strictly great threshold 1 one directly connectedplease notice multiple query pair node x y query x y equivalent query y x Constraints2 n 1040 threshold n1 querieslength 105queriesilength 21 ai bi citiesai bi