eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Optical Reader

Optical Reader

Professor John decided to apply only multiple-choice tests to his students. In each test, each question will have five alternatives (\textbf{A}, \textbf{B}, \textbf{C}, \textbf{D} and \textbf{E}), and the teacher will distribute one answer sheet for each student. At the end of the test, the answer sheets will be scanned and processed digitally to obtain the test score for each student. Initially, he asked a nephew, who knows computer programming, to write a program to extract the alternatives marked by the students in the answer sheets. The nephew wrote a good piece of software, but cannot finish it because he needs to study for the ICPC contest. During processing, the answer sheets are scanned in gray levels between \textbf{0} (full black) and \textbf{255} (total white). After detecting the position for the five rectangles corresponding to each of the alternatives of a question, the software calculates the average pixel gray level for each rectangle, returning an integer value corresponding to each alternative. If the rectangle was filled properly the average value is zero (all black). If the rectangle was left blank the average value is \textbf{255} (white total). Thus, ideally, if the average values for each alternative of a question are (\textbf{255}, \textbf{0}, \textbf{255}, \textbf{255}, \textbf{255}), we know that the student has marked alternative B for that question. However, as answer sheets are processed individually, the average gray level for a completely filled rectangle is not necessarily \textbf{0} (may be higher), and the value for a rectangle not filled is not necessarily \textbf{255} (may be less). Professor John determined that rectangle average gray levels would be divided into two classes: those with values equal or lower to \textbf{127} are considered black and those with values higher than \textbf{127} will be considered white. Obviously, not necessarily all questions of all sheets are marked correctly. It can happen that a student makes a mistake and marks more than one alternative for the same question, or does not mark any alternative. In such cases, the answer to the question should be disregarded. Professor John now needs a volunteer to write one program that, given the average gray level values of the five rectangles corresponding to the alternatives of a question, determines which alternative was marked, or whether the answer to the question should be disregarded. \InputFile The input contains several test cases. The first line of a test case contains an integer \textbf{N} indicating the number of questions in the answer sheet (\textbf{1} ≤ \textbf{N} ≤ \textbf{255}). Each of the \textbf{N} following lines describes the response to a question and contains five integers \textbf{A}, \textbf{B}, \textbf{C}, \textbf{D} and \textbf{E}, indicating the values of average gray levels for each alternative (\textbf{0} ≤ \textbf{A}, \textbf{B}, \textbf{C}, \textbf{D}, \textbf{E} ≤ \textbf{255}). The last test case is followed by a line containing only a number zero. \OutputFile For each test case the input your program must print \textbf{N} lines, each line corresponding to a question. If the answer to the question was correctly filled in the answer sheet, the line should contain the alternative selected ('\textbf{A}', '\textbf{B}', '\textbf{C}', '\textbf{D}' or '\textbf{E}'). Otherwise, the line should contain the character '\textbf{*}' (asterisk).
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
3
0 255 255 255 255
255 255 255 255 0
255 255 127 255 255
4
200 200 200 0 200
200 1 200 200 1
1 2 3 4 5
255 5 200 130 205
0
Выходные данные #1
A
E
C
D
*
*
B
Источник Maratona de Programa¸c˜ao da SBC – ACM ICPC – 2010