The simplest problem about cubes

시간 제한2초메모리 제한1024 MB

요약
큐브의 보이는 세 면이 색과 숫자 표기 형식으로 주어질 때, 각 수집가의 규칙에 따라 이 큐브를 소유할 수 있는 사람을 가려낸다.
난이도

쉬움10점 중 3점

유형
구현, 시뮬레이션, 문자열, 완전 탐색
정답자
아직 제출이 없습니다

문제

Yesterday Taja visited the museum. The tour was long and interesting, but the room she liked most contained collections of the cubes of the ten famous collectors. One of the cubes has attracted her attention a lot, but she forgot, who has possessed it. Nevertheless she memorized how three visible faces looked like, as well as criteria of each of the collector. You are to deduce the name of the collectors, who could possess such a cube, from this information.

Each cube has 66 faces. Each face has a single number written on it from 11 to 66, unique for each face. Numbers can be represented either by dots, or as a decimal or as roman numeral. Also each face has one of the following colors --- Black, White, Green, Yellow, Skyblue, Red, Orange and Purple.

Here is the list of the names of the collectors and their corresponding criteria, which hold for the entire collection:

JohnAll numbers are represented as dots
DavidNumbers are never written as roman numerals
PeterAll faces are white
RobertFaces of the cube are either black or white
MarkOdd numbers have white background, even numbers have black background
PaulAll prime numbers are written as decimal, and vice versa
PatrickAll face have the same color, but neither black nor white
JackAll roman numerals are on the yellow background
MaxAll faces have unique colors
AlexNumbers of the same format have the same background, different formats have different colors

입력

Input contains three lines, describing visible faces of the cube.

First symbol of iith line c_ic\_i (c_i∈B,W,G,Y,S,R,O,Pc\_i \in \\{B, W, G, Y, S, R, O, P\\}) --- the color of iith face (Black, White, Green, Yellow, Skyblue, Red, Orange and Purple correspondingly). The, separated by space, follows the number written on the face, in one of the following formats:

  1. From 11 to 66 <<.>> symbols (ASCII 4646), which means that number is written with dots and the number equals to the number of this dots;
  2. Decimal number from 11 to 66;
  3. Roman numeral, written with <<I>> (ASCII 7373) and <<V>> (ASCII 8686) symbols.

It is guaranteed, that presented cube belongs to at least one collector.

출력

Output should contain a single line with name of collectors, which can own this given cube. Names should be written in any order and separated by space.

All names of the collectors should be from the following list: John, David, Peter, Robert, Mark, Paul, Patrick, Jack, Max, Alex.

예제5

  1. 예제 1

    입력
    W ..
    W ...
    W ....
    
    예상 출력
    John David Peter Robert Jack Alex
    
  2. 예제 2

    입력
    B 2
    W 3
    B 6
    
    예상 출력
    David Robert Mark Jack 
    
  3. 예제 3

    입력
    G 1
    G 2
    G V
    
    예상 출력
    Patrick
    
  4. 예제 4

    입력
    G 2
    G 3
    Y ....
    
    예상 출력
    David Paul Jack Alex
    
  5. 예제 5

    입력
    W .
    B 2
    W III
    
    예상 출력
    Robert Mark