Synthesis of five-membered O,N-heterocycles using metal and nonmetal