Adds ex9: Mealy automaton