#K42787. Largest Rectangular Section

    ID: 27165 Type: Default 1000ms 256MiB

Largest Rectangular Section

Largest Rectangular Section

You are given a rectangular garden of dimensions \(n \times m\). Your task is to determine the dimensions of the largest square section that can be used to completely tile the garden without leaving any gaps or overlaps. In other words, you need to find the largest possible square whose side length divides both \(n\) and \(m\) evenly.

This problem can be solved by finding the greatest common divisor (\(gcd(n, m)\)). Once you compute \(gcd(n, m)\), the dimensions of the largest square will be \(gcd(n, m) \times gcd(n, m)\). Your program should output these two identical numbers separated by a space.

Example:

Input:  12 15
Output: 3 3

inputFormat

The input consists of a single line containing two space-separated integers \(n\) and \(m\) representing the number of rows and columns of the garden respectively.

outputFormat

Output two space-separated integers representing the dimensions of the largest square that can evenly divide the garden. Both values will be equal to \(gcd(n, m)\).

## sample
12 15
3 3