This is a little rough, but perhaps you can clean it up and make everything neat.

The first condition says

So we know that

m = a(er) + b

n = c(er) + d

where a, b, c, d are integers and 0 <= b < er and 0 <= d < er. Since m = n (mod er) we know that b = d.

Now, let's form m^e.

Note that every term but the last is proportional to e^2r. Thus m^e has the form:

where p is an integer. We don't need the usual 0 <= b^e < e^2 r condition as you will see.

Now do the same for n^e. Then use the fact that b = d from the initial condition.

-Dan