I just realized today that the atoms in the output are sorted in the order of fire > salt > water. In my previous solution, I thought there would be 24 possible permutations for the output.