\frac{j}{2} + 1$ for $j = 2,\ldots,m$ and $j$ even, $\mathfrak{p}(j) = m - \frac{j-3}{2}$ for $j = 3,\ldots,m$ and $j$ odd. Clearly, its inverse is: $\mathfrak{q}(1) = 1$, $\mathfrak{q}(i) = 2(i-1)$ for $i = 2,\ldots,\lfloor \frac{m}{2} \rfloor + 1$, $\mathfrak{q}(i) = 3 + 2(m-i)$ for $i = \lfloor \frac{m}{2} \rfloor + 2,\ldots,m$. Let $f$ be the following assignment: $$f(u_i) = \begin{cases}
   r,             & m \equiv 2~ (\textrm{mod}~3) ~\land~ i = \mathfrak{p}(m), \\
   \biggl\lfloor \dfrac{\mathfrak{q}(i)}{3} \biggr\rfloor + 1,             & \textrm{otherwise}.
\end{cases}$$ $$f(v_i) = \begin{cases}
   r + 1 - \biggl\lceil \dfrac{\mathfrak{q}(i)}{3} \biggr\rceil,   & i = 1 ~\lor~ i \geq \biggl\lfloor \dfrac{m}{2} \biggr\rfloor + 2, \\
   2,                                                              & m \equiv 2~ (\textrm{mod}~6) ~\land~ i = \mathfrak{p}(m), \\
   r + 1 - \biggl\lceil \dfrac{\mathfrak{q}(i)+2}{3} \biggr\rceil, & \textrm{otherwise}.
\end{cases}$$ It is easy to check that $f(w) \in [r]$ for all $w \in U \cup V$. Also, observe that first and second case in the definition of $f(v_i)$ do not overlap: if $m \equiv 2~ (\textrm{mod}~6)$, $m$ is even and, therefore, $2 \leq \mathfrak{p}(m) = m/2 + 1 < \lfloor \frac{m}{2} \rfloor + 2$.

We claim that $f(v_i)$ satisfies the following recursive relationship: $$f(v_i) = 2r - \mathfrak{q}(i) + f(u_i) - f(v_{i-1}),~~~ \forall~ i \in 