# How is this step being calculated and why is that getting the factors is able to determine private key or universal forgery?

In class I, why (4) implies $$g\equiv 1 \mod q$$
Also even though I get $$p$$ and $$q$$ it still can't get $$ord_n(g)$$ without trying out different possibilities or is there a way to do all forgery?