


"""simple docstring"""


def   snake_case		(     UpperCamelCase__       :						list    )   ->      list:

      if len(UpperCamelCase__    ) <= 1:
            return [tuple(UpperCamelCase__    )]

      lowerCamelCase					:					Optional[int]        =	[]

      def generate(UpperCamelCase__       :						int			,				UpperCamelCase__       :						list    ):
            lowerCamelCase					:					List[Any]        =	[0] * n
            res.append(tuple(UpperCamelCase__    )    )

            lowerCamelCase					:					Optional[Any]        =	0
            while i < n:
                  if c[i] < i:
                        if i % 2 == 0:
                              lowerCamelCase     ,			lowerCamelCase					:					Optional[int]        =	arr[i], arr[0]
                        else:
                              lowerCamelCase     ,			lowerCamelCase					:					Optional[int]        =	arr[i], arr[c[i]]
                        res.append(tuple(UpperCamelCase__    )    )
                        c[i] += 1
                        lowerCamelCase					:					Any        =	0
                  else:
                        lowerCamelCase					:					Optional[Any]        =	0
                        i += 1

      generate(len(UpperCamelCase__    )			,				UpperCamelCase__    )
      return res


if __name__ == "__main__":
    __lowerCamelCase      :Optional[int]	    =		input('Enter numbers separated by a comma:\n').strip()
    __lowerCamelCase      :Optional[Any]	    =		[int(item) for item in user_input.split(',')]
    print(heaps(arr))








"""simple docstring"""


__lowerCamelCase      :List[Any]	    =		{0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}

__lowerCamelCase      :Union[str, Any]	    =		{0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}




def   snake_case		(     UpperCamelCase__       :						dict[int, list[int]]			,				UpperCamelCase__       :						int			,				UpperCamelCase__       :						list[bool]    )   ->      list[int]:
      lowerCamelCase					:					Tuple        =	True
      lowerCamelCase					:					Any        =	[]

      for neighbour in graph[vert]:
            if not visited[neighbour]:
                  order += topology_sort(UpperCamelCase__			,				UpperCamelCase__			,				UpperCamelCase__    )

      order.append(UpperCamelCase__    )

      return order




def   snake_case		(     UpperCamelCase__       :						dict[int, list[int]]			,				UpperCamelCase__       :						int			,				UpperCamelCase__       :						list[bool]    )   ->      list[int]:
      lowerCamelCase					:					List[Any]        =	True
      lowerCamelCase					:					int        =	[vert]

      for neighbour in reversed_graph[vert]:
            if not visited[neighbour]:
                  component += find_components(UpperCamelCase__			,				UpperCamelCase__			,				UpperCamelCase__    )

      return component






def   snake_case		(     UpperCamelCase__       :						dict[int, list[int]]    )   ->      list[list[int]]:
      lowerCamelCase					:					int        =	len(UpperCamelCase__    ) * [False]
      lowerCamelCase					:					dict[int, list[int]]        =	{vert: [] for vert in range(len(UpperCamelCase__    )    )}

      for vert, neighbours in graph.items():
            for neighbour in neighbours:
                  reversed_graph[neighbour].append(UpperCamelCase__    )

      lowerCamelCase					:					int        =	[]
      for i, was_visited in enumerate(UpperCamelCase__    ):
            if not was_visited:
                  order += topology_sort(UpperCamelCase__			,				UpperCamelCase__			,				UpperCamelCase__    )

      lowerCamelCase					:					Tuple        =	[]
      lowerCamelCase					:					str        =	len(UpperCamelCase__    ) * [False]

      for i in range(len(UpperCamelCase__    )    ):
            lowerCamelCase					:					Any        =	order[len(UpperCamelCase__    ) - i - 1]
            if not visited[vert]:
                  lowerCamelCase					:					List[str]        =	find_components(UpperCamelCase__			,				UpperCamelCase__			,				UpperCamelCase__    )
                  components_list.append(UpperCamelCase__    )

      return components_list




