orderFrequency:= function(g) local h,w; w:= []; w:= h -> Collected(List(Elements(h), Order)); return w(g); end;