Let $\xi$ be an ultimately periodic sequence, i.e. there exists finite sequences $p, q \in X^*$ such that $\xi = pq^{\omega}$. Does there exists a $n > 0$ such that the prefix of length $n$ and all infixes of length $n$ determine $\xi$ uniquely, meaning it is the only word with this prefix and infixes.

*Some context*: I am currently searching for conditions under which a prefix and a set of infixes (or factors) determine a word uniquely. I guess this problem should be solvable for ultimately periodic words. If $\xi$ is just periodic, i.e. $\xi= q^{\omega}$ then this is easy, because choose $q$ minimal, meaning such that it is not a power of some other finite word (such words are called *primitive*), then the factors of length $n := |q|$ determine $\xi$ unique. For suppose $\eta$ is another word with the same prefix and factors of length $n$, then $\eta = q\tau$, now look at the word $\eta[2...n+1] = q[2...n] x$. Because $\eta$ has the same factors as $\xi$, and all factors of $\xi$ are conjugates (i.e. cyclic permutations) of $q$, there must be $i$ such that $q[2...n] x = q[i+1...n] q[1...i]$. As $q$ was choosen primitive it must have exactly $n$ different conjugate words (this is a well known fact about primitive words) so that $i = 1$ follows (otherwise there would be fewer then $n$ conjugates) which implies $x = q[1..1] = q_1$. Proceeding inductively in this way we see that $\eta = q^{\omega}$. But I am unable to extends this to ultimately periodic sequences, because the prefix $p$ could be anything. So any suggestions or help?

Some remarks on notation: If $w$ is a finite sequence, by $w[i...j]$ I denote the subsequence from the $i$-th up to the $j$ position $w[i...j] = w_i w_{i+1} \cdots w_{j}$.