Mealy machines