Risk theory of the second and third kind