Prioritize your queue

A PriorityQueue is a type of queue imported from the module with the same name.

It uses sort order to decide what to retrieve from it first (your object must have a way of comparing its instances):

import queue

class Rezha(object):
    def __init__(self, priority):
       self.priority = priority
    def __lt__(self, other):
       return self.priority > other.priority

q = queue.PriorityQueue()
while not q.empty():
# output is 100 / 55 / 11

Having defined the __lt__ method, our PriorityQueue knows now how to sort elements of type Rezha.