matrix traversal path