Synthesis of 1H-indazoles and 1H-pyrazoles via FeBr3/O2 mediated intramolecular C-H amination.