import math def get_primes(n): divs = [] for i in range(1, int(math.sqrt(n)+1)): if n%i == 0: divs.append((i, n//i)) divs.append((n//i, i)) return divs def main(): [a, b, c, d] = [int(a) for a in input().split()] if c*d < 2*a*b: return "-1 -1" primes = get_primes(a*b) for i, j in primes: for alpha in range(1, c//i+1): for beta in range(1, d//j+1): #print(i*alpha, j*beta) if (i*alpha > a and j*beta > b) and (i*alpha <= c and j*beta <= d): return f"{i*alpha} {j*beta}" return "-1 -1" for _ in range(int(input())): print(main())