Pain during sex

Why does sex hurt certain time of the month???