code: def reverse_shortlex(end, other, excludeend=False):
      if not excludeend:
          yield end
      queue = collections.deque([(end, other)])
      while queue:
          current, other = queue.popleft()
          while other:
              first, other = other[0], other[1:]
              result = current & first
              yield result
              if other:
                  queue.append((result, other))