Python program for group elements of list by size.