Solution for Sort Task