def METHOD_NAME(query: str) -> Tuple[str, str]:
    m = re.match(r"answer\s+(Q...)\s+(.)", query)
    if not m:
        raise InvalidAnswerException()
    quiz_id = m.group(1)
    answer = m.group(2).upper()
    if answer not in "ABCD":
        raise InvalidAnswerException()
    return (quiz_id, answer)