Under construction

Still being built. Things may change

Chromosome

Interview

Time limit2sMemory limit64 MB

Summary
Decide for each uppercase string whether it matches an optional A-to-F letter followed by runs of A, F, and C and an optional closing letter.
Level

Easy3 of 10

Topics
String matching, String
Solved
No attempts yet

Problem

Sanggeun works at a life science lab and checks whether a chromosome follows one specific pattern. A chromosome is a string made only of uppercase letters (A, B, C, ..., Z). He has to test every chromosome against all of the rules below.

  • The string begins with one letter from {A, B, C, D, E, F}, or with no letter at all.
  • Then comes one or more A.
  • Then comes one or more F.
  • Then comes one or more C.
  • Then comes one letter from {A, B, C, D, E, F} or no letter at all, and nothing may follow it.

Given a string, write a program that decides whether it follows these rules.

Input

The first line contains the number of test cases TT (T≤20T \le 20). Each of the next TT lines contains one string made only of uppercase letters. Each string is at most 200 characters long.

Output

For each test case, print "Infected!" if the string follows the rules, and "Good" if it does not.

Examples1

  1. Example 1

    Input
    15
    AFC
    AAFC
    AAAFFCC
    AAFCC
    BAFC
    QWEDFGHJMNB
    DFAFCB
    ABCDEFC
    DADC
    SDFGHJKLQWERTYU
    AAAAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCDDDDDDDDDDDEEEEEEEEEEEEEEEFFFFFFFFC
    AAAFFFFFBBBBCCCAAAFFFF
    ABCDEFAAAFFFCCCABCDEF
    AFCP
    AAFFCPP
    
    Expected output
    Infected!
    Infected!
    Infected!
    Infected!
    Infected!
    Good
    Good
    Good
    Good
    Good
    Good
    Good
    Good
    Good
    Good