Show there does not exist a function $f:\mathbb{Z}\rightarrow \{1, 2, 3\}$ satisfying $f(x)\ne f(y)$ for all integers $x,y$ and $|x-y|\in\{2, 3, 5\}$.
This is taken from "Putnam and Beyond" and I cannot seem to understand why this cannot be true. I let $x$ be fixed and assigned $f(x)=1$, then assumed $f(y)=2, |x-y|=2.$ Then I proceeded to substitute $y-1$ and $y-3$ but did not get anywhere in finding a contradiction.
I am looking for comments about my approach and an explanation of the solution.

WLOG you can assign $f(0) = 1$
$f(2) \ne 1, f(2) \ne f(5)\\ f(3) \ne 1, f(3) \ne f(5)\\ f(2) = f(3)$
Again it makes thing easier to follow if you assign $f(2) = 2, f(3) = 2, f(5) = 3$.
Now, what does that imply for other numbers?
$f(7) \ne f(2), f(7) \ne f(5) \implies f(7) = f(0) = 1\\ f(8) \ne f(3), f(8) \ne f(5) \implies f(8) = f(0) = 1$
$f(4) \ne f(2), f(4)\ne f(7), f(4) = f(5) = 3\\ f(6) \ne f(3), f(6)\ne f(8), f(6) = f(5) = 3$
But then $f(4) = f(6)$ which is a contradiction.