Pyrazoloquinazolinones and pyrazolopyridopyrimidinones by a sequential N-acylation–SNAr reaction