eolymp
bolt
Try our new interface for solving problems
Problems

GCD LCM

GCD LCM

The \textbf{ GCD} of two positive integers is the largest integer that divides both the integers without any remainder. The \textbf{LCM} of two positive integers is the smallest positive integer that is divisible by both the integers. A positive integer can be the \textbf{GCD} of many pairs of numbers. Similarly, it can be the \textbf{LCM} of many pairs of numbers. In this problem, you will be given two positive integers. You have to output a pair of numbers whose \textbf{GCD} is the first number and \textbf{LCM} is the second number. \InputFile The first line contains the number of tests \textbf{T }(\textbf{T ≤ 100}). Each of the next \textbf{T} lines contains two positive integer \textbf{G} and \textbf{L. }Both \textbf{G }and \textbf{L }are less than \textbf{2^31}. \OutputFile For each test case print in a separate line two positive integers \textbf{a} and \textbf{b} (\textbf{a ≤ b}), which \textbf{GCD} is \textbf{G} and \textbf{LCM} is \textbf{L. }If the answer is not unique, output the pair for which \textbf{a} is minimal. If there is no such pair, print \textbf{-1}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
2
1 2
3 4
Output example #1
1 2
-1