proc pullDown[T](x: var seq[T]; i, n: int) {.inline.}
proc pushUp[T](x: var seq[T]; i, n: int) {.inline.}