N = int(input()) cnt = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] eto = ["ne", "ushi", "tora", "u", "tatsu", "mi", "uma", "hitsuji", "saru", "tori", "inu", "i"] for i in range(N): cnt[eto.index(input())] += 1 before = -1 for i in range(N): maxcnt = 0 oku = -1 for j in range(12): if cnt[j] > maxcnt and before != j: maxcnt = cnt[j] oku = j if oku == -1 and max(cnt) != 0: print("NO") exit() before = oku cnt[oku] -= 1 print("YES")