Photo
Ivanushka is passionate about computer graphics, but he's facing a challenge. He needs to arrange 4 photographs on a page, ensuring the page is completely filled. These photographs, stored digitally, cannot be rotated. While Ivanushka can resize the photographs, he must preserve their original aspect ratios, meaning the width-to-height ratio must remain constant. Rotation is not permitted.
Your task is to determine the final dimensions of each photograph. You are provided with the dimensions of the page and the initial dimensions of the photographs.
Input
The input is structured as follows:
Line 1: Two natural numbers l and h, separated by a space, representing the width and height of the page.
Lines 2 to 5: Each line contains a pair of natural numbers x y, separated by a space, representing the width and height of each photograph. The i-th photograph is described on the i+1-th line, where 1 ≤ i ≤ 4.
Constraints
0 ≤ l, h ≤ 2000
0 ≤ x, y ≤ 2000
Output
The output should be formatted as follows:
Lines 1 to 4: Each line should contain two natural numbers a and b (0 ≤ a, b), separated by a space, representing the final width and height of each photograph. The i-th photograph is described on line i, where 1 ≤ i ≤ 4.
If multiple solutions exist, you may output any one of them. Each test case guarantees at least one solution.