traversal with iteration