Add __hash__ implementation (for priority queue).