The simplest problem about cubes
Time limit2sMemory limit1024 MB
Given the colors and numbers on three visible faces of a cube, list every collector whose criteria allow that cube.
- Level
Easy2 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Statement
Yesterday Taja visited the museum. The tour was long and interesting, but the room she liked most contained collections of the cubes of ten famous collectors. One of the cubes caught her attention, but she forgot which collector possessed it. Nevertheless she memorized how three visible faces looked, as well as the criteria of each collector. Deduce the names of the collectors who could possess such a cube from this information.
Each cube has faces. Each face has a single number written on it from to , unique for each face. Numbers can be represented either by dots, as a decimal, or as a Roman numeral. Each face also has one of the following colors: Black, White, Green, Yellow, Skyblue, Red, Orange and Purple.
Here is the list of the collectors and their criteria, which hold for the entire collection:
Input
The input has three lines, describing the visible faces of the cube.
The first symbol of the th line () is the color of the th face (Black, White, Green, Yellow, Skyblue, Red, Orange and Purple respectively). After a space follows the number written on the face, in one of these formats:
- From to
.symbols (ASCII ), where the number of dots equals the number on the face; - A decimal number from to ;
- A Roman numeral written with
I(ASCII ) andV(ASCII ) symbols.
It is guaranteed that the presented cube belongs to at least one collector.
Output
Print a single line with the names of the collectors who can own the given cube. The names can be in any order and are separated by spaces.
All names must come from this list: John, David, Peter, Robert, Mark, Paul, Patrick, Jack, Max, Alex.