Decision Tree and rank?
The decision tree implements the following algorithm for finding $f$:


What is $f(1)$?
What is $f(2)$?
What is $f(3)$?
What is $f(4)$?


There are six possible answers to the first question, but only three of them lead to a valid function. You split according to these answers in the correct order (you want the result to be in lexicographic order), and then continue to the second question. And so on. If you did everything correct, you'll find $\binom{6}{2} = 15$ different leaves, the last of which is $6543$.