code: def up(self, i):
          
          x = self.heap[i]
          while i > 1 and x < self.heap[i // 2]:
              self.heap[i] = self.heap[i // 2]
              self.rank[self.heap[i // 2]] = i
              i //= 2
          self.heap[i] = x       # insertion index found
          self.rank[x] = i
docs: The value of heap[i] has decreased. Maintain heap invariant.