Photoassisted Generation of Complex N, O, S Polyheterocycles