急中生智

急中生智 (jí zhōng shēng zhì)
quick witted in an emergency; able to react resourcefully