text: class Stack:
      def __init__(self):
          self.my_stack = []
  
      def __str__(self):
          return '; '.join(self.my_stack)
  
      def push(self, new_elem):
          self.my_stack.append(new_elem)
  
      def pop(self):
          if len(self.my_stack) == 0:
              return None
          return self.my_stack.pop()
  
  
  class TaskManager:
      def __init__(self):
          self.task = dict()
  
      def __str__(self):
          info_list = []
  
          if self.task:
              for i_task in sorted(self.task.keys()):
                  info_list.append(f'{i_task} {self.task[i_task]}')
  
          return '\n'.join(info_list)
  
      def new_task(self, task, priority):
          if priority not in self.task:
              self.task[priority] = Stack()
          self.task[priority].push(task)
  
  
  manager = TaskManager()
  manager.new_task("сделать уборку", 4)
  manager.new_task("помыть посуду", 4)
  manager.new_task("отдохнуть", 1)
  manager.new_task("поесть", 2)
  manager.new_task("сдать дз", 2)
  print(manager)
  