Whom did the Nizam ally with in the late 18th century?