What is the version of the following sentence with correct punctuation?

As it turned out it was the state of Qin in the west that emerged victorious
As it turned out it was the state of Qin in the west that emerged victorious.