Substrate selective synthesis of indole, tetrahydroquinoline and quinoline derivatives via intramolecular addition of hydrazones and imines