Hi Nelly,
Please take a look at the following answer to a similar question.
https://progress.lawlessfrench.com/questions/view/why-is-israel-in-effect-neutral-gender
The full title of Monaco is 'La principauté de Monaco' which is shortened to Monaco.
Madagascar, like many islands, doesn't have an article in front of their names.
Bonne Continuation!