code: def shortlex(start, other, excludestart=False):
      if not excludestart:
          yield start
      queue = collections.deque([(start, 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))