


# using dfs for finding eulerian path traversal



def       _lowerCAmelCase    (				lowerCAmelCase_				:Optional[Any]		,    lowerCAmelCase_				:Dict		,    lowerCAmelCase_				:Union[str, Any]		,    lowerCAmelCase_				:Dict=None				)->Optional[int]:
   '''simple docstring'''






   snake_case_            =       (path or []) + [u]
   for v in graph[u]:
      if visited_edge[u][v] is False:
         snake_case_     ,     snake_case_            =       True, True
         snake_case_            =       dfs(lowerCAmelCase_		,    lowerCAmelCase_		,    lowerCAmelCase_		,    lowerCAmelCase_				)
   return path



def       _lowerCAmelCase    (				lowerCAmelCase_				:List[Any]		,    lowerCAmelCase_				:Tuple				)->Dict:
   '''simple docstring'''






   snake_case_            =       0
   snake_case_            =       -1
   for i in range(lowerCAmelCase_				):
      if i not in graph.keys():
         continue
      if len(graph[i]				) % 2 == 1:
         odd_degree_nodes += 1
         snake_case_            =       i
   if odd_degree_nodes == 0:
      return 1, odd_node
   if odd_degree_nodes == 2:
      return 2, odd_node
   return 3, odd_node



def       _lowerCAmelCase    (				lowerCAmelCase_				:Optional[int]		,    lowerCAmelCase_				:Any				)->Any:
   '''simple docstring'''






   snake_case_            =       [[False for _ in range(max_node + 1				)] for _ in range(max_node + 1				)]
   snake_case_     ,     snake_case_            =       check_circuit_or_path(lowerCAmelCase_		,    lowerCAmelCase_				)
   if check == 3:
      print("graph is not Eulerian"				)
      print("no path"				)
      return
   snake_case_            =       1
   if check == 2:
      snake_case_            =       odd_node
      print("graph has a Euler path"				)
   if check == 1:
      print("graph has a Euler cycle"				)
   snake_case_            =       dfs(lowerCAmelCase_		,    lowerCAmelCase_		,    lowerCAmelCase_				)
   print(lowerCAmelCase_				)



def       _lowerCAmelCase    (				)->List[Any]:
   '''simple docstring'''






   snake_case_            =       {1: [2, 3, 4], 2: [1, 3], 3: [1, 2], 4: [1, 5], 5: [4]}
   snake_case_            =       {1: [2, 3, 4, 5], 2: [1, 3], 3: [1, 2], 4: [1, 5], 5: [1, 4]}
   snake_case_            =       {1: [2, 3, 4], 2: [1, 3, 4], 3: [1, 2], 4: [1, 2, 5], 5: [4]}
   snake_case_            =       {1: [2, 3], 2: [1, 3], 3: [1, 2]}
   snake_case_            =       {
       1: [],
       2: []
       # all degree is zero
   }
   snake_case_            =       10
   check_euler(lowerCAmelCase_		,    lowerCAmelCase_				)
   check_euler(lowerCAmelCase_		,    lowerCAmelCase_				)
   check_euler(lowerCAmelCase_		,    lowerCAmelCase_				)
   check_euler(lowerCAmelCase_		,    lowerCAmelCase_				)
   check_euler(lowerCAmelCase_		,    lowerCAmelCase_				)


if __name__ == "__main__":
   main()








def       _lowerCAmelCase    (				lowerCAmelCase_				:List[str]		,    lowerCAmelCase_				:int				)->Optional[int]:
   '''simple docstring'''






   snake_case_            =       0
   while b > 0:
      if b & 1:
         res += a

      a += a
      b >>= 1

   return res



def       _lowerCAmelCase    (				lowerCAmelCase_				:int		,    lowerCAmelCase_				:List[str]		,    lowerCAmelCase_				:Dict				)->Dict:
   '''simple docstring'''






   snake_case_            =       0
   while b > 0:
      if b & 1:
         snake_case_            =       ((res % c) + (a % c)) % c

      a += a
      b >>= 1

   return res




