Find the number of functions $f(x)$ from $\{1, 2, 3, 4, 5, 6\}$ to $\{1, 2, 3, 4, 5, 6\}$ that satisfy $f(f(x)) = f(f(f(x)))$ for all $x$ in $\{1, 2, 3, 4, 5, 6\}$. Find the remainder when this number is divided by $1000$.
The condition says every element reaches a fixed point within two steps.
Classify by the set of fixed points, the elements mapping directly to them, and the elements two steps away (as in the original problem); summing gives $6607$ functions, remainder $607$.