
Seven-segment green colour vacuum fluorescent display tube IV-6. Manufactured in the former Soviet Union, 1985. Image source: Mister rf, Wikimedia Commons, Creative Commons Attribution-Share Alike 4.0 International.
The days-without-incident counter at your factory has become difficult to interpret.
The counter is a single-digit seven-segment display that you bought cheaply in a second-hand hardware store. Each of its seven segments is either off or on, and a digit is shown by turning on the corresponding segments:
$$$\,$$$
$$$\,$$$
$$$\,$$$
$$$\,$$$
$$$\,$$$
$$$\,$$$
$$$\,$$$
$$$\,$$$
$$$\,$$$
Every morning, the display is reset so that all segments are off. When a digit is entered into the display, every segment belonging to that digit is flipped: from off to on, or from on to off. This worked just fine as long as the counter only ever needed to show a single digit.
However, thanks to your diligent work with safety protocols, the number of days without incident now routinely reaches two-digit numbers. Since the display has room for only one digit, a two-digit number is entered by typing its two digits one after the other, into the same display. This may well flip a particular segment off again.
The number of days without incident is called the streak length $$$s$$$ and satisfies $$$0\leq s\leq 99$$$. It is entered without leading $$$0$$$s, so a single-digit streak length is entered as one digit.
Given the state of the display after the streak length has been entered, determine which values of $$$s$$$ could have produced it.
The input consists of:
Output the possible streak lengths, without leading $$$0$$$s. If there is more than one possible streak length, report all of them in sorted order. If no streak length could have resulted in the input display, output "impossible".
.##.#..##..#.##.#..##..#.##.
8
................#...#.......
56 65 89 98
.........................##.
impossible
| Name |
|---|


