the requirement is sort udf. the sorting is done for whichever input comes first should be sorted together. Its not ascending or descending ,it depends on whichever item comes first need to be sorted first.
can you please help me to get the udf for this.
input

Output
