Uniqueness of representation of $y$ to the bases $g$ and $h$
This representation is not unique. If $k$ is the discrete logarithm of $h$ with relation to base $g$, then $$y = g^{x_1}h^{x_2} = g^{x_1}(g^{k})^{x_2} = g^{x_1 + k \cdot x_2}$$

Then for any $m$, $$x_1' = x_1 + m \cdot k,$$ $$x_2' = x_2-m$$ is another pair such that $y=g^{x_1}h^{x_2}=g^{x_1'}h^{x_2'}$.

We can reduce the discrete logarithm problem to finding a second pair $x_1', x_2'$. Given a second pair, we can efficiently compute:

$$ m \equiv x_2 - x_2' \mod n$$
$$ k \equiv (x_1' - x_1) \cdot m^{-1} \mod n$$
$$ k \equiv (x_1' - x_1)(x_2 - x_2')^{-1} \mod n$$

So finding a second pair is at least as hard as solving the discrete logarithm problem.