A question about 3rd place in cup.

Do you get it if you are beaten by the eventual winner, or lose the semi by the least?