We can always find a unique polynomial of degree at most $n - 1$ that goes through $n$ points, provided the $x$ coordinates are all different. For the numerator, we could use a polynomial $f(n)$ of degree at most $2$ such that $f(0) = 8$, $f(1) = 5$, and $f(2) = 8$. That is, a polynomial through the points $(0, 8), (1, 5), (2, 8)$.
Let $f(n) = an^2 + bn + c$, where $a, b, c$ are unknown constants. Then, we must have \begin{align*} 8 &= f(0) = 0a + 0b + c \\ 5 &= f(1) = 1a + 1b + c \\ 8 &= f(2) = 4a + 2b + c. \end{align*} We can solve these simultaneously for $a, b, c$. The first equation tells me $c = 8$, so the second two equations just boil down to \begin{align*} -3 &= a + b \\ 0 &= 4a + 2b. \end{align*} We can see from the first equation that $b = -3 - a$, so plugging into the second equation, $$0 = 4a + 2(-3 - a) \implies 4a - 6 - 2a = 0 \implies 2a = 6 \implies a = 3.$$ We can then see that $b = -3 - a = -3 - 3 = -6$. So, $$f(n) = 3n^2 - 6n + 8.$$
We can then use a similar method to find a $g(n)$ so that $g(0) = 35$, $g(1) = 21$, and $g(2) = 33$. I'll let you try this for yourself. This gives us the function $f(n)/g(n)$, as requested.