Simultaneously permute and compare