function Heap.Pop(g)local r=g[1]g[1]=g[#g]g[#g]=nil g:_HeapifyTopDown(1)return r end

function Heap:Pop()
	local v = self[1];
	self[1] = self[#self];
	self[#self] = nil;
	self:_HeapifyTopDown(1);
	return v;
end
