dragees = ["A", "B", "E", "C", "G", "F", "M", "O", "H", "P", "S", "V"]

ctr = 0
while True:
    ctr += 1
    idx1 = (ctr * 5) % 12
    idx0 = idx1-1 if idx1>0 else 11
    dragees[idx0-1], dragees[idx1-1] = dragees[idx1-1], dragees[idx0-1]
    if "A" in dragees[0:4] and "E" in dragees[0:4] and "G" in dragees[0:4] and "H" in dragees[0:4]:
        break

print(ctr)
print(dragees)