Traverse list using recursion.