MEALY MACHINE