P1618 Triple Strike (Upgraded Version)

Description

Divide the $9$ numbers $1, 2,\ldots, 9$ into three groups to form three three-digit numbers, such that these three three-digit numbers are in the ratio A:B:C. Find all triples that satisfy the condition; if there is no solution, output `No!!!`. Thanks to Huang Xiao U Beverage for improving the problem statement.

Input Format

Three numbers, A, B, C.

Output Format

Several lines, each containing 3 numbers. Sort the lines by the first number in ascending order.

Explanation/Hint

It is guaranteed that $0 \le A < B < C \le 999$. $\text{upd 2022.8.3}$: Added two more hack testdata. Translated by ChatGPT 5