Until what century did the republic states endure in India