Mealy and Moore machines