Ops a:0 f:2 g:1

Automaton A0
States q1 q2 q3
Final States q1
Transitions
a -> q1
g(q1) -> q2
g(q2) -> q2
f(q2,q2) -> q3

