change classes lookup direction: first - parent, last - child