I'm trying to prove that if $a \equiv b \pmod{4}$, then $123^a \equiv 33^b \pmod{10}$.
What I have so far is this.
First, applying the definition of the modulus function, it follows that $a \equiv n \pmod{4} \iff a = 4k + b$. Therefore,
$$ \begin{align} 123^a &\equiv 123^{4k+b} \pmod{10}\\ &\equiv 3^{4k+b} \tag{confused} \\ &\equiv \left(3^{4}\right)^k \cdot 3^{b} \\ &\equiv (1)^k \cdot 3^b \\ &\equiv 3^b \end{align} $$
Then as $33^b \equiv 3^b \pmod{10}$, by the transitivity of the modulo operator, $123^a \equiv 33^b \pmod{10}$ (assuming that $a \equiv b \pmod{4})$.
However, I'm not sure why it's possible to substitute values inside the modulo expression. For example, I tried to prove that
$$ \left(3^4\right)^k \equiv 1 \pmod{10} $$
Applying the definition
$$ \left(3^{4}\right)^k \equiv 3^4 \cdot 3^4 \cdot ... \cdot 3^4 $$
But from here I got stuck. I think I want to use the fact that if $a \equiv b \pmod p$ and $c \equiv d \pmod{p}$, then $ac \equiv bd \pmod{p}$, so if $a = c = 3^4$, then $b = d = 1$ satisfy the antecedent, so then the consequent is also true (that $3^k \cdot 3^k \equiv 1 \cdot 1 \equiv 1 \pmod{10}$).
But I'm not sure how to solve this in general (i.e. that in any case it's always possible to substitute equivalent values into equations modulo $m$, if that even is true, which I'm not sure).
Sorry, I find modulo arithmetic really confusing so any help is much appreciated.