An inverse problem for operators of a triangular structure