Under construction

Still being built. Things may change

Least Common Multiple and Greatest Common Divisor

Interview

Time limit1sMemory limit128 MB

Summary
For multiple integer pairs, compute and print each pair's least common multiple and greatest common divisor.
Level

Easy1 of 10

Topics
Math, Number theory
Solved
No attempts yet

Problem

For two integers a and b, their least common multiple is the smallest positive integer that is a multiple of both numbers, and their greatest common divisor is the largest positive integer that divides both numbers.

For several test cases, write a program that finds the least common multiple and greatest common divisor of each given pair.

Input

The first line contains the number of test cases T. T is between 1 and 1,000, inclusive.

Each of the next T lines contains two integers a and b separated by a space. Each integer is between 1 and 1,000, inclusive.

Output

For each test case, print the least common multiple followed by the greatest common divisor on one line.

Examples1

  1. Example 1

    Input
    3
    5 10
    7 23
    42 56
    Expected output
    10 5
    161 1
    168 14