from typing import Any





class 							lowercase						:


   def __init__(   self				:	int   ,		__lowerCAmelCase				:	Any)      ->					int:
         lowercase_     =      data
         lowercase_     =      None





class 							lowercase						:


   def __init__(   self				:	Optional[int])      ->					List[str]:
         lowercase_     =      None


   def __UpperCAmelCase       (   self				:	Optional[int])      ->					List[Any]:
         lowercase_     =      self.head
         while temp is not None:
               print(temp.data   ,		end=" ")
               lowercase_     =      temp.next
         print()


   def __UpperCAmelCase       (   self				:	Optional[int]   ,		__lowerCAmelCase				:	Any)      ->					int:
         lowercase_     =      Node(__lowerCAmelCase)
         lowercase_     =      self.head
         lowercase_     =      new_node


   def __UpperCAmelCase       (   self				:	Optional[int]   ,		__lowerCAmelCase				:	List[str]   ,		__lowerCAmelCase				:	Dict)      ->					List[str]:
         if node_data_a == node_data_a:
               return
         else:
               lowercase_     =      self.head
               while node_a is not None and node_a.data != node_data_a:
                     lowercase_     =      node_a.next

               lowercase_     =      self.head
               while node_a is not None and node_a.data != node_data_a:
                     lowercase_     =      node_a.next

               if node_a is None or node_a is None:
                     return

               lowercase_ ,							lowercase_     =      node_a.data, node_a.data


if __name__ == "__main__":
       lowerCAmelCase_ : Optional[int]						  =      LinkedList()
       for i in range(5, 0, -1):
              ll.push(i)

       ll.print_list()

       ll.swap_nodes(1, 4)
       print("After swapping")
       ll.print_list()







'''simple docstring'''

from __future__ import annotations


def __a (	__lowerCamelCase			:						list[list[int]]				)	->							bool:
      '''simple docstring'''


      lowercase_     =      len(__lowerCamelCase				)
      # We need to create solution object to save path.
      lowercase_     =      [[0 for _ in range(__lowerCamelCase				)] for _ in range(__lowerCamelCase				)]
      lowercase_     =      run_maze(__lowerCamelCase ,		0 ,		0 ,		__lowerCamelCase				)
      if solved:
            print("\n".join(str(__lowerCamelCase				) for row in solutions				)				)
      else:
            print("No solution exists!"				)
      return solved


def __a (	__lowerCamelCase			:						list[list[int]] ,		__lowerCamelCase			:						int ,		__lowerCamelCase			:						int ,		__lowerCamelCase			:						list[list[int]]				)	->							bool:
      '''simple docstring'''


      lowercase_     =      len(__lowerCamelCase				)
      # Final check point.
      if i == j == (size - 1):
            lowercase_     =      1
            return True

      lowercase_     =      (not i < 0) and (not j < 0)  # Check lower bounds
      lowercase_     =      (i < size) and (j < size)  # Check upper bounds

      if lower_flag and upper_flag:
            # check for already visited and block points.
            lowercase_     =      (not solutions[i][j]) and (not maze[i][j])
            if block_flag:
                  # check visited
                  lowercase_     =      1

                  # check for directions
                  if (
                      run_maze(__lowerCamelCase ,		i + 1 ,		__lowerCamelCase ,		__lowerCamelCase				)
                      or run_maze(__lowerCamelCase ,		__lowerCamelCase ,		j + 1 ,		__lowerCamelCase				)
                      or run_maze(__lowerCamelCase ,		i - 1 ,		__lowerCamelCase ,		__lowerCamelCase				)
                      or run_maze(__lowerCamelCase ,		__lowerCamelCase ,		j - 1 ,		__lowerCamelCase				)
                  ):
                        return True

                  lowercase_     =      0
                  return False
      return False


if __name__ == "__main__":
       import doctest

       doctest.testmod()






