Here is a question about this article: Meanwhile, he had written to Abu Ya'far, the prefect of the dynamic city of Isfahan, offering his services. The new emir of Hamadan, hearing of this correspondence and discovering where Ibn Sina was hiding, incarcerated him in a fortress. War meanwhile continued between the rulers of Isfahan and Hamadãn; in 1024 the former captured Hamadan and its towns, expelling the Tajik mercenaries. When the storm had passed, Ibn Sina returned with the emir to Hamadan, and carried on his literary labors. Later, however, accompanied by his brother, a favorite pupil, and two slaves, Ibn Sina escaped from the city in the dress of a Sufi ascetic. After a perilous journey, they reached Isfahan, receiving an honorable welcome from the prince.
What is the answer to this question: What two cities were at war during this time?
Isfahan and Hamadãn