Asian markets mostly up at end of a painful quarter