first use list and method sorted(list,cmp,key,reverse)