A higher resolution is required to access the IDE

- 49

## Statement

## Goal

**You're a talented burglar attempting to crack a safe combination by listening to the clicks it makes at each of your attempts. Suddenly, the alarm goes off, and you have only time for one last try. Analysing the results of the previous attempts, you must give the correct combination if only one is possible. Otherwise, lacking time to try them all, you must flee.**

Each previous attempt (which is always a failed one) is represented by a series of numbers between 0 and 9 (inclusive) and their associated sound :

During a test, each sound has the same meaning and every meaning is different, but you never know which sound is associated with wich meaning.

The possible meanings of a sound are the following :

- The number is correct.

- The number is adjacent to the correct number (note that 0 and 9 are adjacent).

- The number is incorrect and not adjacent to the correct number.

Given these information, if only one combination is possible, you must output it. If more than one combination is possible, you must output

**### Example: ###**

Considering the following attemps :

1 2 3 4

1 2 4 5

1 2 4 8

CLICK CLICK CLACK CLUCK

CLICK CLICK CLUCK CLICK

CLICK CLICK CLUCK CLACK

Let's make assumptions :

**Assumption 1 -**

This means that 1, 2, and the last 5 are correct. Since the 4 of the first line is associated with a

This assumption leads to only one possibility : 1 2 5 5. But maybe the next assumptions will also have a different possibility... Let's check.

**Assumption 2 -**

This means that 3 is the correct third number, and looking at the second and third line, that

**Assumption 3 -**

This means that 4 is the correct 3rd and 4th number. Looking at the first line, 3 being next to 4, we guess that

Since only one assumption makes sense and leads to only one possibility, the correct code is 1 2 5 5.

Input

**Line 1:**An integer

`N`representing the number of attempts.

**Line 2:**An integer

`C`representing the length of the safe combination.

**Next**A line

`N`lines:`NUMBERS`containing the numbers of each attempt.

**Next**A line

`N`lines:`CLICKS`containing the corresponding clicks.

Output

The space separated safe combination if there is only one solution, or FLEE if more than one combination is possible.

Constraints

1 ≤

1 ≤

`N`≤ 101 ≤

`C`≤ 10Example

Input

3 4 1 2 3 4 1 2 4 5 1 2 4 8 CLICK CLICK CLACK CLUCK CLICK CLICK CLUCK CLICK CLICK CLICK CLUCK CLACK

Output

1 2 5 5

A higher resolution is required to access the IDE

Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!

JOIN US ON DISCORD Online Participants