What script was the Devanagari script replace with in the 12th century