
'''simple docstring'''





a__						:				Any           =    [chr(i) for i in range(3_2, 1_2_6)]
a__						:				Union[str, Any]           =    list(range(len(alphabets)))
a__						:				str           =    list(range(len(alphabets)))
a__						:				Optional[Any]           =    list(range(len(alphabets)))
a__						:				Union[str, Any]           =    list(reversed(range(len(alphabets))))
a__						:				Any           =    []
a__						:				Optional[int]           =    0





def     snake_case							(						)->     Tuple:







      """simple docstring"""
      global gear_one_pos
      global gear_two_pos
      global gear_three_pos
      __A    		=     gear_one[0]
      gear_one.append(UpperCAmelCase		)
      del gear_one[0]
      gear_one_pos += 1
      if gear_one_pos % int(len(UpperCAmelCase		)		) == 0:
            __A    		=     gear_two[0]
            gear_two.append(UpperCAmelCase		)
            del gear_two[0]
            gear_two_pos += 1
            if gear_two_pos % int(len(UpperCAmelCase		)		) == 0:
                  __A    		=     gear_three[0]
                  gear_three.append(UpperCAmelCase		)
                  del gear_three[0]
                  gear_three_pos += 1





def     snake_case							(						UpperCAmelCase		)->     int:







      """simple docstring"""
      __A    		=     alphabets.index(UpperCAmelCase		)
      __A    		=     gear_one[target]
      __A    		=     gear_two[target]
      __A    		=     gear_three[target]
      __A    		=     reflector[target]
      __A    		=     gear_three.index(UpperCAmelCase		)
      __A    		=     gear_two.index(UpperCAmelCase		)
      __A    		=     gear_one.index(UpperCAmelCase		)
      code.append(alphabets[target]		)
      rotator()


if __name__ == "__main__":
 a__						:				Tuple           =    list(input("Type your message:\n"))
 while True:
  try:
   a__						:				Tuple           =    int(input("Please set token:(must be only digits)\n"))
   break
  except Exception as error:
   print(error)
 for _ in range(token):
  rotator()
 for j in decode:
  engine(j)
 print("\n" + "".join(code))
 print(
     f'''\nYour Token is {token} please write it down.\nIf you want to decode '''
     "this message again you should input same digits as token!"
 )








'''simple docstring'''





from __future__ import annotations





def     snake_case							(						UpperCAmelCase		)->     List[Any]:







      """simple docstring"""
      global graph, reversed_graph, scc, component, visit, stack
      if visit[u]:
            return
      __A    		=     True
      for v in graph[u]:
            dfs(UpperCAmelCase		)
      stack.append(UpperCAmelCase		)





def     snake_case							(						UpperCAmelCase		)->     List[Any]:







      """simple docstring"""
      global graph, reversed_graph, scc, component, visit, stack
      if visit[u]:
            return
      __A    		=     True
      component.append(UpperCAmelCase		)
      for v in reversed_graph[u]:
            dfsa(UpperCAmelCase		)





def     snake_case							(						)->     Any:







      """simple docstring"""
      global graph, reversed_graph, scc, component, visit, stack
      for i in range(UpperCAmelCase		):
            dfs(UpperCAmelCase		)
      __A    		=     [False] * n
      for i in stack[::-1]:
            if visit[i]:
                  continue
            __A    		=     []
            dfsa(UpperCAmelCase		)
            scc.append(UpperCAmelCase		)
      return scc


if __name__ == "__main__":
 # n - no of nodes, m - no of edges
 a__    ,						a__						:				Tuple           =    list(map(int, input().strip().split()))

 a__						:				list[list[int]]           =    [[] for _ in range(n)]  # graph
 a__						:				list[list[int]]           =    [[] for i in range(n)]  # reversed graph
 # input graph data (edges)
 for _ in range(m):
  a__    ,						a__						:				Tuple           =    list(map(int, input().strip().split()))
  graph[u].append(v)
  reversed_graph[v].append(u)

 a__						:				list[int]           =    []
 a__						:				list[bool]           =    [False] * n
 a__						:				list[int]           =    []
 a__						:				list[int]           =    []
 print(kosaraju())






