The instruction −(0,p,q) goes to p if register 0 is empty; otherwise it deletes the final letter and goes to q.
For M, an empty input goes directly from qS to q1, where a 1 is appended. On a nonempty input, state q0 deletes every letter; once the register is empty it goes to q2 and appends 0. Hence
For N, the initial instruction tests whether the final letter is 0. If it is, state q3 deletes the entire word and then goes to q1, producing 1. Otherwise state q0 deletes the entire word and goes to q2, producing 0. Thus