P13705 [NWERC 2023] Fixing Fractions

Description

Maths is hard.$^{\text{[citation needed]}}$ But it could be easier! And the internet™ has found some excellent ways to make it easier. ![](https://cdn.luogu.com.cn/upload/image_hosting/zaysoilw.png) :::align{center} Source: The Internet™. ::: Take a look at the following true equations: $$ \begin{aligned} \displaystyle\log(1)+\log(2)+\log(3)&=\displaystyle\log(1+2+3)\\ \displaystyle\frac{1\cancel{63}}{\cancel{3}2\cancel{6}}&=\displaystyle\frac{1}{2}~. \end{aligned} $$ Following the patterns, we come to the conclusion that the following equation should also be true: $$ \displaystyle\frac{12\cancel{3}}{2\cancel{3}4}=\frac{1}{2}~. $$ However, this is actually wrong in boring old standard maths. Therefore, we define a new kind of funky maths where it is allowed to cancel out digits on the left side of the equality sign. This surely will make everyone's life easier. Except yours, since you have to evaluate if two given fractions are equal in our new funky maths.

Input Format

The input consists of: - One line with four integers $a$, $b$, $c$, and $d$ ($1\leq a,b,c,d

Output Format

If there exist integers $a'$ and $b'$ obtained from $a$ and $b$ by cancelling out the same digits and with $\frac{a'}{b'} = \frac{c}{d}$ in standard mathematics, output "$\texttt{possible}$", followed by $a'$ and $b'$. Otherwise, output "$\texttt{impossible}$". If there are multiple valid solutions, you may output any one of them. Note that neither $a'$ nor $b'$ is allowed to contain leading zeroes after cancelling digits.