done with inverse RSK algorithm