



"""simple docstring"""
class 							lowerCamelCase_:





					'''simple docstring'''



					def __init__(    self   ):
									_lowerCamelCase        =				0
									_lowerCamelCase        =				0
									_lowerCamelCase        =				{}

					def 			snake_case__      (    self				,       lowerCamelCase__   ):
									if vertex not in self.adjacency:
													_lowerCamelCase        =				{}
													self.num_vertices += 1

					def 			snake_case__      (    self				,       lowerCamelCase__				,       lowerCamelCase__				,       lowerCamelCase__   ):
									self.add_vertex(lowerCamelCase__   )
									self.add_vertex(lowerCamelCase__   )

									if head == tail:
													return

									_lowerCamelCase        =				weight
									_lowerCamelCase        =				weight

					def 			snake_case__      (    self   ):
									_lowerCamelCase        =				self.get_edges()
									for edge in edges:
													_lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase        =				edge
													edges.remove((tail, head, weight)   )
									for i in range(len(lowerCamelCase__   )   ):
													_lowerCamelCase        =				list(edges[i]   )

									edges.sort(key=lambda lowerCamelCase__   : e[2]   )
									for i in range(len(lowerCamelCase__   ) - 1   ):
													if edges[i][2] >= edges[i + 1][2]:
																	_lowerCamelCase        =				edges[i][2] + 1
									for edge in edges:
													_lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase        =				edge
													_lowerCamelCase        =				weight
													_lowerCamelCase        =				weight

					def __str__(    self   ):
									_lowerCamelCase        =				''''''
									for tail in self.adjacency:
													for head in self.adjacency[tail]:
																	_lowerCamelCase        =				self.adjacency[head][tail]
																	string += F"""{head} -> {tail} == {weight}\n"""
									return string.rstrip('''\n'''   )

					def 			snake_case__      (    self   ):
									_lowerCamelCase        =				[]
									for tail in self.adjacency:
													for head in self.adjacency[tail]:
																	output.append((tail, head, self.adjacency[head][tail])   )
									return output

					def 			snake_case__      (    self   ):
									return self.adjacency.keys()

					@staticmethod
					def 			snake_case__      (    lowerCamelCase__=None				,       lowerCamelCase__=None   ):
									_lowerCamelCase        =				Graph()
									if vertices is None:
													_lowerCamelCase        =				[]
									if edges is None:
													_lowerCamelCase        =				[]
									for vertex in vertices:
													g.add_vertex(lowerCamelCase__   )
									for edge in edges:
													g.add_edge(*lowerCamelCase__   )
									return g


					class 							lowerCamelCase_:





										'''simple docstring'''



										def __init__(    self   ):
														_lowerCamelCase        =				{}
														_lowerCamelCase        =				{}

										def __len__(    self   ):
														return len(self.parent   )

										def 			snake_case__      (    self				,       lowerCamelCase__   ):
														if item in self.parent:
																		return self.find(lowerCamelCase__   )

														_lowerCamelCase        =				item
														_lowerCamelCase        =				0
														return item

										def 			snake_case__      (    self				,       lowerCamelCase__   ):
														if item not in self.parent:
																		return self.make_set(lowerCamelCase__   )
														if item != self.parent[item]:
																		_lowerCamelCase        =				self.find(self.parent[item]   )
														return self.parent[item]





										def 			snake_case__      (    self				,       lowerCamelCase__				,       lowerCamelCase__   ):
														_lowerCamelCase        =				self.find(lowerCamelCase__   )
														_lowerCamelCase        =				self.find(lowerCamelCase__   )

														if roota == roota:
																		return roota

														if self.rank[roota] > self.rank[roota]:
																		_lowerCamelCase        =				roota
																		return roota

														if self.rank[roota] < self.rank[roota]:
																		_lowerCamelCase        =				roota
																		return roota

														if self.rank[roota] == self.rank[roota]:
																		self.rank[roota] += 1
																		_lowerCamelCase        =				roota
																		return roota
														return None

					@staticmethod
					def 			snake_case__      (    lowerCamelCase__   ):
									_lowerCamelCase        =				graph.num_vertices

									_lowerCamelCase        =				Graph.UnionFind()
									_lowerCamelCase        =				[]
									while num_components > 1:
													_lowerCamelCase        =				{}
													for vertex in graph.get_vertices():
																	_lowerCamelCase        =				-1

													_lowerCamelCase        =				graph.get_edges()
													for edge in edges:
																	_lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase        =				edge
																	edges.remove((tail, head, weight)   )
													for edge in edges:
																	_lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase        =				edge
																	_lowerCamelCase        =				union_find.find(lowerCamelCase__   )
																	_lowerCamelCase        =				union_find.find(lowerCamelCase__   )
																	if seta != seta:
																					if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
																									_lowerCamelCase        =				[head, tail, weight]

																					if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
																									_lowerCamelCase        =				[head, tail, weight]
													for vertex in cheap_edge:
																	if cheap_edge[vertex] != -1:
																					_lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase        =				cheap_edge[vertex]
																					if union_find.find(lowerCamelCase__   ) != union_find.find(lowerCamelCase__   ):
																									union_find.union(lowerCamelCase__				,       lowerCamelCase__   )
																									mst_edges.append(cheap_edge[vertex]   )
																									_lowerCamelCase        =				num_components - 1
									_lowerCamelCase        =				Graph.build(edges=lowerCamelCase__   )
									return mst





"""simple docstring"""
from __future__ import annotations

from typing import Any



def        lowerCAmelCase_(   lowercase_     :							list[Any]							)	->       None:
				create_state_space_tree(lowercase_						,   []						,   0							)



def        lowerCAmelCase_(   lowercase_     :							list[Any]						,   lowercase_     :							list[Any]						,   lowercase_     :							int							)	->       None:

				if index == len(lowercase_							):
								print(lowercase_							)
								return

				create_state_space_tree(lowercase_						,   lowercase_						,   index + 1							)
				current_subsequence.append(sequence[index]							)
				create_state_space_tree(lowercase_						,   lowercase_						,   index + 1							)
				current_subsequence.pop()


if __name__ == "__main__":
			__SCREAMING_SNAKE_CASE  :						list[Any]    							=      [3, 1, 2, 4]
			generate_all_subsequences(seq)

			seq.clear()
			seq.extend(['''A''', '''B''', '''C'''])
			generate_all_subsequences(seq)
