if magellan died on shore he was to be buried in the nearest church devoted to our lady and on the day of his burial three poor men were to be clothed , each of them with a cloak of grey stuff , a cap , a shirt and a pair of shoes that they might pray for the repose of his eternal soul .