def entry(i, k):
    where[i] = k
    while infants[k]:
        (r, j) = heappop(infants[k])
        if ((where[j] != k) or (j == i)):
            continue
        if (rate[i] >= (- r)):
            highest_rate[k] = rate[i]
            heappush(queue, (rate[i], k, i))
        heappush(infants[k], (r, j))
        break
    else:
        highest_rate[k] = rate[i]
        heappush(queue, (rate[i], k, i))
    heappush(infants[k], ((- rate[i]), i))
def entry(i, k):
    where[i] = k
    while infants[k]:
        (r, j) = heappop(infants[k])
        if ((where[j] != k) or (j == i)):
            continue
        if (rate[i] >= (- r)):
            highest_rate[k] = rate[i]
            heappush(queue, (rate[i], k, i))
        heappush(infants[k], (r, j))
        break
    else:
        highest_rate[k] = rate[i]
        heappush(queue, (rate[i], k, i))
    heappush(infants[k], ((- rate[i]), i))