Training Site
Sideways banner

Nail Polish

Input: Standard Input (stdin)
Output: Standard Output (stdout)
Memory limit: 64 megabytes
Time limit: 1.0 seconds

Sam has very particular ideas about nail polish on toes.

  • If the colour name of the polish used on the big toe has a repeated letter (not necessarily consecutive), then each colour name on the other 4 toes should have an odd number of letters. This is the best combination.
  • If the colour name of the polish used on the big toe does not have a repeated letter, then the colour names used on the 4 smaller toes should be of strictly decreasing length in toe order. This is an ok combination.
  • Any other colour name combinations are bad.

Input

There will be five lines, each containing the colour name of a nail polish, in order from big toe to little toe. Each color name consists of 1 to 20 lowercase English characters, with no spaces.

Output

You should output a single line containing either best, ok, or bad, based on the above criteria.

Sample Explanation

In the first sample case, "purple" contains the repeated letter 'p', and all other colours names have odd lengths (5, 3, 5, 5), so this is a best combination.

In the second sample case, "orange" does not contain a repeated letter, and the other colour names have strictly decreasing lengths (6 > 5 > 4 > 3), so this is an ok combination.

In the third sample case, "red" does not contain a repeated letter, but the other colour names do not have strictly decreasing lengths (3 \not> 3), so this is a bad combination.

Subtasks

  • Subtask 1 (35%): All five colors used are the same
  • Subtask 2 (65%): No further restrictions apply
  • Sample Input 1

    purple
    black
    red
    green
    white
    

    Sample Output 1

    best
    
  • Sample Input 2

    orange
    purple
    black
    blue
    red
    

    Sample Output 2

    ok
    
  • Sample Input 3

    red
    red
    red
    red
    red
    

    Sample Output 3

    bad