#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% query = readlines() # %% def end_with_word_plus_symbols(S, word): i = S.rfind(word) if i < 0 or i < len(S) - 3 - len(word): return False T = S[i + len(word):] return all(not x.isalnum() for x in T) # %% def is_ok(S): words = S.split() if not words: return False chara = words[0] S = ''.join(words[1:]).lower() if chara == 'digi': return end_with_word_plus_symbols(S, 'nyo') if chara == 'petit': return end_with_word_plus_symbols(S, 'nyu') if chara == 'gema': return end_with_word_plus_symbols(S, 'gema') if chara == 'piyo': return end_with_word_plus_symbols(S, 'pyo') if chara == 'rabi': return not S.isalnum() return False # %% for line in query: S = line.decode().rstrip() if is_ok(S): print('CORRECT (maybe)') else: print('WRONG!')