Hmm, I tried your script, but it’s still not sorting the X at the end for some reason. I flipped the itemgetter(1,2,3) to itemgetter(3,2,1) since I want to sort by Z first and X last.
It sorted by Z then by Y but failed to sort by X, as you can see in the screenshot below. What do you think is the reason?