lì​qū​jì​qióng

at one's wits' end