from heapq import heappush,heappop def check(d,t): a,b,s=t if d