

"""simple docstring"""





from collections import deque
from math import floor
from random import random
from time import time


class      _lowercase :


      def __init__(    self				:	int						):





            """simple docstring"""







            __snake_case      :    Optional[int]  			={}


      def _UpperCamelCase						(    self				:	Union[str, Any]							,   a				:	Dict							,   a				:	List[str]							,   a				:	List[str]=1						):





            """simple docstring"""







            if self.graph.get(_UpperCAmelCase						):
                  if self.graph[u].count([w, v]						) == 0:
                        self.graph[u].append([w, v]						)
            else:
                  __snake_case      :    Optional[int]  			=[[w, v]]
            if not self.graph.get(_UpperCAmelCase						):
                  __snake_case      :    Dict  			=[]


      def _UpperCamelCase						(    self				:	Any						):





            """simple docstring"""







            return list(self.graph						)


      def _UpperCamelCase						(    self				:	Optional[Any]							,   a				:	List[str]							,   a				:	List[Any]						):





            """simple docstring"""







            if self.graph.get(_UpperCAmelCase						):
                  for _ in self.graph[u]:
                        if _[1] == v:
                              self.graph[u].remove(_UpperCAmelCase						)


      def _UpperCamelCase						(    self				:	Optional[Any]							,   a				:	int=-2							,   a				:	Union[str, Any]=-1						):





            """simple docstring"""







            if s == d:
                  return []
            __snake_case      :    int  			=[]
            __snake_case      :    Any  			=[]
            if s == -2:
                  __snake_case      :    Tuple  			=list(self.graph						)[0]
            stack.append(_UpperCAmelCase						)
            visited.append(_UpperCAmelCase						)
            __snake_case      :    List[str]  			=s

            while True:
                  # check if there is any non isolated nodes
                  if len(self.graph[s]						) != 0:
                        __snake_case      :    Any  			=s
                        for node in self.graph[s]:
                              if visited.count(node[1]						) < 1:
                                    if node[1] == d:
                                          visited.append(_UpperCAmelCase						)
                                          return visited
                                    else:
                                          stack.append(node[1]						)
                                          visited.append(node[1]						)
                                          __snake_case      :    List[Any]  			=node[1]
                                          break

            # check if all the children are visited
                  if s == ss:
                        stack.pop()
                        if len(_UpperCAmelCase						) != 0:
                              __snake_case      :    Union[str, Any]  			=stack[len(_UpperCAmelCase						) - 1]
                  else:
                        __snake_case      :    Tuple  			=ss

                  # check if se have reached the starting point
                  if len(_UpperCAmelCase						) == 0:
                        return visited


      def _UpperCamelCase						(    self				:	List[Any]							,   a				:	List[Any]=-1						):





            """simple docstring"""







            if c == -1:
                  __snake_case      :    Union[str, Any]  			=floor(random() * 1_0_0_0_0						) + 1_0
            for i in range(_UpperCAmelCase						):
                  # every vertex has max 100 edges
                  for _ in range(floor(random() * 1_0_2						) + 1						):
                        __snake_case      :    Any  			=floor(random() * c						) + 1
                        if n != i:
                              self.add_pair(_UpperCAmelCase							,   _UpperCAmelCase							,   1						)


      def _UpperCamelCase						(    self				:	Dict							,   a				:	Union[str, Any]=-2						):





            """simple docstring"""







            __snake_case      :    str  			=deque()
            __snake_case      :    Union[str, Any]  			=[]
            if s == -2:
                  __snake_case      :    List[str]  			=list(self.graph						)[0]
            d.append(_UpperCAmelCase						)
            visited.append(_UpperCAmelCase						)
            while d:
                  __snake_case      :    Any  			=d.popleft()
                  if len(self.graph[s]						) != 0:
                        for node in self.graph[s]:
                              if visited.count(node[1]						) < 1:
                                    d.append(node[1]						)
                                    visited.append(node[1]						)
            return visited


      def _UpperCamelCase						(    self				:	int							,   a				:	str						):





            """simple docstring"""







            __snake_case      :    Optional[Any]  			=0
            for x in self.graph:
                  for y in self.graph[x]:
                        if y[1] == u:
                              count += 1
            return count


      def _UpperCamelCase						(    self				:	Dict							,   a				:	Tuple						):





            """simple docstring"""







            return len(self.graph[u]						)


      def _UpperCamelCase						(    self				:	Optional[int]							,   a				:	Any=-2						):





            """simple docstring"""







            __snake_case      :    Dict  			=[]
            __snake_case      :    Tuple  			=[]
            if s == -2:
                  __snake_case      :    List[str]  			=list(self.graph						)[0]
            stack.append(_UpperCAmelCase						)
            visited.append(_UpperCAmelCase						)
            __snake_case      :    Optional[int]  			=s
            __snake_case      :    List[Any]  			=[]

            while True:
                  # check if there is any non isolated nodes
                  if len(self.graph[s]						) != 0:
                        __snake_case      :    List[str]  			=s
                        for node in self.graph[s]:
                              if visited.count(node[1]						) < 1:
                                    stack.append(node[1]						)
                                    visited.append(node[1]						)
                                    __snake_case      :    Tuple  			=node[1]
                                    break

            # check if all the children are visited
                  if s == ss:
                        sorted_nodes.append(stack.pop()						)
                        if len(_UpperCAmelCase						) != 0:
                              __snake_case      :    List[Any]  			=stack[len(_UpperCAmelCase						) - 1]
                  else:
                        __snake_case      :    Optional[int]  			=ss

                  # check if se have reached the starting point
                  if len(_UpperCAmelCase						) == 0:
                        return sorted_nodes


      def _UpperCamelCase						(    self				:	int						):





            """simple docstring"""







            __snake_case      :    Union[str, Any]  			=[]
            __snake_case      :    Optional[int]  			=[]
            __snake_case      :    Optional[Any]  			=list(self.graph						)[0]
            stack.append(_UpperCAmelCase						)
            visited.append(_UpperCAmelCase						)
            __snake_case      :    int  			=-2
            __snake_case      :    List[Any]  			=[]
            __snake_case      :    Optional[int]  			=s
            __snake_case      :    Optional[Any]  			=False
            __snake_case      :    str  			=set()

            while True:
                  # check if there is any non isolated nodes
                  if len(self.graph[s]						) != 0:
                        __snake_case      :    Any  			=s
                        for node in self.graph[s]:
                              if (
                                  visited.count(node[1]						) > 0
                                  and node[1] != parent
                                  and indirect_parents.count(node[1]						) > 0
                                  and not on_the_way_back
                              ):
                                    __snake_case      :    Dict  			=len(_UpperCAmelCase						) - 1
                                    while len_stack >= 0:
                                          if stack[len_stack] == node[1]:
                                                anticipating_nodes.add(node[1]						)
                                                break
                                          else:
                                                anticipating_nodes.add(stack[len_stack]						)
                                                len_stack -= 1
                              if visited.count(node[1]						) < 1:
                                    stack.append(node[1]						)
                                    visited.append(node[1]						)
                                    __snake_case      :    Tuple  			=node[1]
                                    break

            # check if all the children are visited
                  if s == ss:
                        stack.pop()
                        __snake_case      :    List[str]  			=True
                        if len(_UpperCAmelCase						) != 0:
                              __snake_case      :    Optional[Any]  			=stack[len(_UpperCAmelCase						) - 1]
                  else:
                        __snake_case      :    Dict  			=False
                        indirect_parents.append(_UpperCAmelCase						)
                        __snake_case      :    Optional[int]  			=s
                        __snake_case      :    Dict  			=ss

                  # check if se have reached the starting point
                  if len(_UpperCAmelCase						) == 0:
                        return list(_UpperCAmelCase						)


      def _UpperCamelCase						(    self				:	List[Any]						):





            """simple docstring"""







            __snake_case      :    List[Any]  			=[]
            __snake_case      :    List[str]  			=[]
            __snake_case      :    str  			=list(self.graph						)[0]
            stack.append(_UpperCAmelCase						)
            visited.append(_UpperCAmelCase						)
            __snake_case      :    Optional[Any]  			=-2
            __snake_case      :    List[str]  			=[]
            __snake_case      :    List[str]  			=s
            __snake_case      :    Optional[int]  			=False
            __snake_case      :    Optional[Any]  			=set()

            while True:
                  # check if there is any non isolated nodes
                  if len(self.graph[s]						) != 0:
                        __snake_case      :    Optional[Any]  			=s
                        for node in self.graph[s]:
                              if (
                                  visited.count(node[1]						) > 0
                                  and node[1] != parent
                                  and indirect_parents.count(node[1]						) > 0
                                  and not on_the_way_back
                              ):
                                    __snake_case      :    str  			=len(_UpperCAmelCase						) - 1
                                    while len_stack_minus_one >= 0:
                                          if stack[len_stack_minus_one] == node[1]:
                                                anticipating_nodes.add(node[1]						)
                                                break
                                          else:
                                                return True
                              if visited.count(node[1]						) < 1:
                                    stack.append(node[1]						)
                                    visited.append(node[1]						)
                                    __snake_case      :    Any  			=node[1]
                                    break

            # check if all the children are visited
                  if s == ss:
                        stack.pop()
                        __snake_case      :    List[Any]  			=True
                        if len(_UpperCAmelCase						) != 0:
                              __snake_case      :    str  			=stack[len(_UpperCAmelCase						) - 1]
                  else:
                        __snake_case      :    List[Any]  			=False
                        indirect_parents.append(_UpperCAmelCase						)
                        __snake_case      :    str  			=s
                        __snake_case      :    Any  			=ss

                  # check if se have reached the starting point
                  if len(_UpperCAmelCase						) == 0:
                        return False


      def _UpperCamelCase						(    self				:	Optional[Any]							,   a				:	Dict=-2							,   a				:	Tuple=-1						):





            """simple docstring"""







            __snake_case      :    Any  			=time()
            self.dfs(_UpperCAmelCase							,   _UpperCAmelCase						)
            __snake_case      :    Tuple  			=time()
            return end - begin







      def _UpperCamelCase						(    self				:	List[str]							,   a				:	Optional[Any]=-2						):





            """simple docstring"""







            __snake_case      :    Dict  			=time()
            self.bfs(_UpperCAmelCase						)
            __snake_case      :    str  			=time()
            return end - begin



class      _lowercase :


      def __init__(    self				:	int						):





            """simple docstring"""







            __snake_case      :    Tuple  			={}


      def _UpperCamelCase						(    self				:	str							,   a				:	Union[str, Any]							,   a				:	Tuple							,   a				:	Any=1						):





            """simple docstring"""







            if self.graph.get(_UpperCAmelCase						):
                  # if there already is a edge
                  if self.graph[u].count([w, v]						) == 0:
                        self.graph[u].append([w, v]						)
            else:
                  # if u does not exist
                  __snake_case      :    Tuple  			=[[w, v]]
            # add the other way
            if self.graph.get(_UpperCAmelCase						):
                  # if there already is a edge
                  if self.graph[v].count([w, u]						) == 0:
                        self.graph[v].append([w, u]						)
            else:
                  # if u does not exist
                  __snake_case      :    Optional[int]  			=[[w, u]]


      def _UpperCamelCase						(    self				:	Dict							,   a				:	List[Any]							,   a				:	List[Any]						):





            """simple docstring"""







            if self.graph.get(_UpperCAmelCase						):
                  for _ in self.graph[u]:
                        if _[1] == v:
                              self.graph[u].remove(_UpperCAmelCase						)
        # the other way round
            if self.graph.get(_UpperCAmelCase						):
                  for _ in self.graph[v]:
                        if _[1] == u:
                              self.graph[v].remove(_UpperCAmelCase						)


      def _UpperCamelCase						(    self				:	int							,   a				:	Dict=-2							,   a				:	Optional[Any]=-1						):





            """simple docstring"""







            if s == d:
                  return []
            __snake_case      :    Dict  			=[]
            __snake_case      :    Union[str, Any]  			=[]
            if s == -2:
                  __snake_case      :    Any  			=list(self.graph						)[0]
            stack.append(_UpperCAmelCase						)
            visited.append(_UpperCAmelCase						)
            __snake_case      :    Optional[int]  			=s

            while True:
                  # check if there is any non isolated nodes
                  if len(self.graph[s]						) != 0:
                        __snake_case      :    List[str]  			=s
                        for node in self.graph[s]:
                              if visited.count(node[1]						) < 1:
                                    if node[1] == d:
                                          visited.append(_UpperCAmelCase						)
                                          return visited
                                    else:
                                          stack.append(node[1]						)
                                          visited.append(node[1]						)
                                          __snake_case      :    str  			=node[1]
                                          break

            # check if all the children are visited
                  if s == ss:
                        stack.pop()
                        if len(_UpperCAmelCase						) != 0:
                              __snake_case      :    Optional[Any]  			=stack[len(_UpperCAmelCase						) - 1]
                  else:
                        __snake_case      :    Optional[Any]  			=ss

                  # check if se have reached the starting point
                  if len(_UpperCAmelCase						) == 0:
                        return visited


      def _UpperCamelCase						(    self				:	Optional[int]							,   a				:	List[Any]=-1						):





            """simple docstring"""







            if c == -1:
                  __snake_case      :    Tuple  			=floor(random() * 1_0_0_0_0						) + 1_0
            for i in range(_UpperCAmelCase						):
                  # every vertex has max 100 edges
                  for _ in range(floor(random() * 1_0_2						) + 1						):
                        __snake_case      :    List[Any]  			=floor(random() * c						) + 1
                        if n != i:
                              self.add_pair(_UpperCAmelCase							,   _UpperCAmelCase							,   1						)


      def _UpperCamelCase						(    self				:	Optional[Any]							,   a				:	Optional[Any]=-2						):





            """simple docstring"""







            __snake_case      :    List[Any]  			=deque()
            __snake_case      :    Tuple  			=[]
            if s == -2:
                  __snake_case      :    int  			=list(self.graph						)[0]
            d.append(_UpperCAmelCase						)
            visited.append(_UpperCAmelCase						)
            while d:
                  __snake_case      :    Union[str, Any]  			=d.popleft()
                  if len(self.graph[s]						) != 0:
                        for node in self.graph[s]:
                              if visited.count(node[1]						) < 1:
                                    d.append(node[1]						)
                                    visited.append(node[1]						)
            return visited


      def _UpperCamelCase						(    self				:	Optional[int]							,   a				:	List[Any]						):





            """simple docstring"""







            return len(self.graph[u]						)


      def _UpperCamelCase						(    self				:	Optional[Any]						):





            """simple docstring"""







            __snake_case      :    List[Any]  			=[]
            __snake_case      :    Union[str, Any]  			=[]
            __snake_case      :    Tuple  			=list(self.graph						)[0]
            stack.append(_UpperCAmelCase						)
            visited.append(_UpperCAmelCase						)
            __snake_case      :    Tuple  			=-2
            __snake_case      :    Any  			=[]
            __snake_case      :    Dict  			=s
            __snake_case      :    Optional[int]  			=False
            __snake_case      :    List[str]  			=set()

            while True:
                  # check if there is any non isolated nodes
                  if len(self.graph[s]						) != 0:
                        __snake_case      :    int  			=s
                        for node in self.graph[s]:
                              if (
                                  visited.count(node[1]						) > 0
                                  and node[1] != parent
                                  and indirect_parents.count(node[1]						) > 0
                                  and not on_the_way_back
                              ):
                                    __snake_case      :    Union[str, Any]  			=len(_UpperCAmelCase						) - 1
                                    while len_stack >= 0:
                                          if stack[len_stack] == node[1]:
                                                anticipating_nodes.add(node[1]						)
                                                break
                                          else:
                                                anticipating_nodes.add(stack[len_stack]						)
                                                len_stack -= 1
                              if visited.count(node[1]						) < 1:
                                    stack.append(node[1]						)
                                    visited.append(node[1]						)
                                    __snake_case      :    Optional[Any]  			=node[1]
                                    break

            # check if all the children are visited
                  if s == ss:
                        stack.pop()
                        __snake_case      :    List[str]  			=True
                        if len(_UpperCAmelCase						) != 0:
                              __snake_case      :    Optional[Any]  			=stack[len(_UpperCAmelCase						) - 1]
                  else:
                        __snake_case      :    Optional[int]  			=False
                        indirect_parents.append(_UpperCAmelCase						)
                        __snake_case      :    Any  			=s
                        __snake_case      :    Dict  			=ss

                  # check if se have reached the starting point
                  if len(_UpperCAmelCase						) == 0:
                        return list(_UpperCAmelCase						)


      def _UpperCamelCase						(    self				:	int						):





            """simple docstring"""







            __snake_case      :    Any  			=[]
            __snake_case      :    Optional[int]  			=[]
            __snake_case      :    Optional[Any]  			=list(self.graph						)[0]
            stack.append(_UpperCAmelCase						)
            visited.append(_UpperCAmelCase						)
            __snake_case      :    List[Any]  			=-2
            __snake_case      :    Optional[int]  			=[]
            __snake_case      :    Dict  			=s
            __snake_case      :    int  			=False
            __snake_case      :    Tuple  			=set()

            while True:
                  # check if there is any non isolated nodes
                  if len(self.graph[s]						) != 0:
                        __snake_case      :    int  			=s
                        for node in self.graph[s]:
                              if (
                                  visited.count(node[1]						) > 0
                                  and node[1] != parent
                                  and indirect_parents.count(node[1]						) > 0
                                  and not on_the_way_back
                              ):
                                    __snake_case      :    str  			=len(_UpperCAmelCase						) - 1
                                    while len_stack_minus_one >= 0:
                                          if stack[len_stack_minus_one] == node[1]:
                                                anticipating_nodes.add(node[1]						)
                                                break
                                          else:
                                                return True
                              if visited.count(node[1]						) < 1:
                                    stack.append(node[1]						)
                                    visited.append(node[1]						)
                                    __snake_case      :    Dict  			=node[1]
                                    break

            # check if all the children are visited
                  if s == ss:
                        stack.pop()
                        __snake_case      :    List[Any]  			=True
                        if len(_UpperCAmelCase						) != 0:
                              __snake_case      :    Dict  			=stack[len(_UpperCAmelCase						) - 1]
                  else:
                        __snake_case      :    Dict  			=False
                        indirect_parents.append(_UpperCAmelCase						)
                        __snake_case      :    Dict  			=s
                        __snake_case      :    Any  			=ss

                  # check if se have reached the starting point
                  if len(_UpperCAmelCase						) == 0:
                        return False


      def _UpperCamelCase						(    self				:	Dict						):





            """simple docstring"""







            return list(self.graph						)


      def _UpperCamelCase						(    self				:	Optional[Any]							,   a				:	Tuple=-2							,   a				:	Tuple=-1						):





            """simple docstring"""







            __snake_case      :    Dict  			=time()
            self.dfs(_UpperCAmelCase							,   _UpperCAmelCase						)
            __snake_case      :    Union[str, Any]  			=time()
            return end - begin







      def _UpperCamelCase						(    self				:	Optional[Any]							,   a				:	Optional[Any]=-2						):





            """simple docstring"""







            __snake_case      :    Tuple  			=time()
            self.bfs(_UpperCAmelCase						)
            __snake_case      :    Optional[Any]  			=time()
            return end - begin










"""simple docstring"""





def     __lowercase					(    a :				int       ,		a :				int )					->					int:
      return x if y == 0 else greatest_common_divisor(a       ,		x % y )



def     __lowercase					(    a :				int       ,		a :				int )					->					int:
      return (x * y) // greatest_common_divisor(a       ,		a )



def     __lowercase					(    a :				int = 20 )					->					int:
      __snake_case      :    Optional[Any]  			=1
      for i in range(1       ,		n + 1 ):
            __snake_case      :    Optional[int]  			=lcm(a       ,		a )
      return g


if __name__ == "__main__":
    print(F'''{solution() = }''')


