Let us say that I have some m, say $5z+25$ (where $z$ is some random integer), and $n$ is say $3z+9$ (same $z$). I want to find an equation that correlates $m$ and $n$ in some $\text{mod} \,O$. Normally in algebra, I would have $m = \frac 53 n+10$. But, since we don't have fractions in modular arithmetic, what would this equation be?
In other words, is there an equation mod O that expresses m in terms of n, or n in terms of m for all values of z?
You are trying to solve $$5z+25\equiv3z+9\pmod O\ .$$ This can be written as $$2z\equiv-16\pmod O\ .$$ If $O$ is odd you can cancel $2$ to give $$z\equiv-8\pmod O\ ,$$ if $O$ is even, say $O=2P$, then $$z\equiv-8\pmod P\ .$$ If you are just looking for one solution, then $z=-8$ will do in any case.
If you want to know how to do this sort of thing with different numbers, Google "solving linear congruences" - there are heaps of resources available online.