





from collections import Counter
from functools import total_ordering

from data_structures.heap.heap import Heap




@total_ordering
class 	_UpperCAmelCase						:




					def __init__(    self     ,   __lowerCAmelCase     ,   __lowerCAmelCase							)    ->	None:
							UpperCamelCase__								=						word
							UpperCamelCase__								=						count




					def __eq__(    self     ,   __lowerCAmelCase							)    ->	bool:
							if not isinstance(_UpperCAmelCase     ,   _UpperCAmelCase							):
									return NotImplemented
							return self.count == other.count




					def __lt__(    self     ,   __lowerCAmelCase							)    ->	bool:
							if not isinstance(_UpperCAmelCase     ,   _UpperCAmelCase							):
									return NotImplemented
							return self.count < other.count



def      a    (   _lowercase :  list[str]			,    _lowercase :  int							)  ->Union[str, Any]:
		UpperCamelCase__								=						Heap()
		UpperCamelCase__								=						Counter(_lowercase							)
		heap.build_max_heap(
		    [WordCount(_lowercase			,    _lowercase							) for word, count in count_by_word.items()]							)
		return [heap.extract_max().word for _ in range(min(_lowercase			,    len(_lowercase							)							)							)]


if __name__ == "__main__":
				import doctest

				doctest.testmod()













def  UpperCAmelCase__						(    lowerCamelCase	:			list    ):
   lowerCamelCase									=1.3
   lowerCamelCase									=len(lowerCamelCase    )
   lowerCamelCase									=False

   while not completed:
      # Update the gap value for a next comb
      lowerCamelCase									=int(gap / shrink_factor    )
      if gap <= 1:
         lowerCamelCase									=True

      lowerCamelCase									=0
      while index + gap < len(lowerCamelCase    ):
         if data[index] > data[index + gap]:
            # Swap values
            lowerCamelCase				,       lowerCamelCase									=data[index + gap], data[index]
            lowerCamelCase									=False
         index += 1

   return data


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   _UpperCAmelCase					:						List[Any]         =     input('Enter numbers separated by a comma:\n').strip()
   _UpperCAmelCase					:						Optional[Any]         =     [int(item) for item in user_input.split(',')]
   print(comb_sort(unsorted))