permut by sorting done