How do you get Pokemon ribbons?

U win a contenst in Hearthrome city in Pokemon diamond, pearl and platinum