In a running race, three people started: $X, Y$, and $Z$. $X$ performed the best, $Y$ came in second, while $Z$ lagged a bit behind. During the race, $Z$'s position changed six times, $X$'s position changed five times, and in the end, $Y$ reached the finish line before $X$.

What was the final result of the race?