Find remainder when dividing $9^{{10}^{{11}^{12}}}-5^{9^{10^{11}}}$ by $13$. 
Find remainder when dividing
  $$9^{{10}^{{11}^{12}}}-5^{9^{10^{11}}}  \hspace{1cm} \text{by} \hspace{1.2cm} 13.$$

I tried transforming these who numbers separately to form $13k+n$ but failed.

Write this number as $9^N-5^M$.
Since $3^3=1\pmod{13}$, $9^3=1\pmod{13}$. Since $10=1\pmod{3}$ and $N$ is a power of $10$, $N=1\pmod{3}$. Hence $9^N=9\pmod{13}$.
Since $5^2=-1\pmod{13}$, $5^4=1\pmod{13}$. Since $9=1\pmod{4}$ and $M$ is a power of $9$, $M=1\pmod{4}$. Hence $5^M=5\pmod{13}$. 
Finally, $9^N-5^M=9-5=4\pmod{13}$.
