Cannabis is by far the safest of these three. This does not mean that you can be careless with pot though. It is important to understand how it affects you. Some people smoke every single day with no negative effects while others can take one puff and suffer a panic attack. If you get paranoid and anxious on weed, it's best to limit your use. If you respond very well to weed, regular use can be fine.
With mdma and alcohol, the risks are tied to how much and how often you use them. For mdma, once every other month is the best way to use it. Some people get away with monthly use but I would be reluctant to use it that much. Alcohol can be used more often, maybe once a week or so. That being said, the complications from heavy alcohol use in terms of both chronic and acute toxicity are much worse. It's much more common to become addicted and dependent to alcohol than mdma. I'm not a huge fan of alcohol, and really only drink it because it is so common. It's ok, but if I had to choose between mdma every two months or alcohol every weekend, I will pick the mdma. For me, it is a far more enjoyable and beneficial experience.
Really, all three of these drugs can be enjoyed and serve to improve your life, if you use them responsibly. This means knowing yourself, knowing your substance, knowing your source, and knowing your science. Irresponsible use of any of these can be detrimental to your well being and the well being of those around you, but there is a much greater margin for error with weed. Overdosing is impossible, the side effects are usually minimal compared to the other two drugs, and it can potentially be practical even with daily use.