A recursive lookup on a tree