Juan pensaba que Pedro le había dicho que la revista había publicado ya el artículo
Juan thought that Pedro him had said that the magazine had published already the article
Juan thought that Pedro had told him that the magazine had already published the article