text: from threading import Thread
  import time
  import random
  from queue import PriorityQueue
  
  queue = PriorityQueue()
  
  class ProducerThread(Thread):
      def run(self):
          nums = range(5)
          global queue
          while True:
              num = random.choice(nums)
              queue.put(num)
              print("Produced", num)
              time.sleep(random.random())
  
  
  class ConsumerThread(Thread):
      def run(self):
          global queue
          while True:
              num = queue.get()
              queue.task_done()
              print("Consumed", num)
              time.sleep(random.random())
  
  
  ProducerThread().start()
  ConsumerThread().start()
  