Dividing polynomial $f(x^3)$ by $x^2+x+1$ Given two polynomials with real coefficients $g(x)$ and $h(x)$.
Additionally,  $x^2+x+1$ is a factor of $f(x^3)= h(x^3)+xg(x^3)$.
Prove that $x-1|h(x)$ and $x-1|g(x)$
I have tried to solve it by doing this;
$(x-1)(x^2+x+1)|(x-1)(h(x^3)+xg(x^3))$
then;
$(x^3-1)|(x)(h(x^3)-g(x^3)) + (x^2)g(x^3) - h(x^3)$
consider degree of $3k, 3k+1, 3k+2$ separately, I got;
$(x^3-1)|(x^2)g(x^3)$ and $h(x^3)$
Lastly, $(x^3-1)|g(x^3), h(x^3)$ and so on finish proving.
I wonder, is it correct to separate three cases of degrees in this problem?

Suppose
$$
\left.x^2+x+1\,\,\middle|\,\,h\!\left(x^3\right)+x\,g\!\left(x^3\right)\right.\tag1
$$
Let ${\bar h}(x)=h(x+1)$ and ${\bar g}(x)=g(x+1)$, then $(1)$ becomes
$$
\left.x^2+x+1\,\,\middle|\,\,{\bar h}\!\left(x^3-1\right)+x\,{\bar g}\!\left(x^3-1\right)\right.\tag2
$$
Write $\bar h$ and $\bar g$ as
$$
\bar h(x)=\sum_{k=0}^n\bar h_kx^k\tag3
$$
and
$$
\bar g(x)=\sum_{k=0}^n\bar g_kx^k\tag4
$$
Since $\left.x^2+x+1\,\middle|\,x^3-1\right.$, we immediately have that $x^2+x+1$ divides each term in the sum for ${\bar h}\!\left(x^3-1\right)$ except for $\bar h_0$. Similarly, $x^2+x+1$ divides each term in the sum for ${\bar g}\!\left(x^3-1\right)$ except for $\bar g_0$. Therefore, $(2)$ implies
$$
\left.x^2+x+1\,\,\middle|\,\,{\bar h}_0+x\,{\bar g}_0\right.\tag5
$$
which means that ${\bar h}_0={\bar g}_0=0$; that is, the constant coefficients of $\bar h$ and $\bar g$ are $0$. Thus,
$$
\left.x-1\,\middle|\,\bar h(x-1)=h(x)\right.\tag6
$$
and
$$
\left.x-1\,\middle|\,\bar g(x-1)=g(x)\right.\tag7
$$
