


from __future__ import annotations
def     UpperCAmelCase_ (							__snake_case						)					->      Dict:







 """simple docstring"""


 global graph, reversed_graph, scc, component, visit, stack
 if visit[u]:
  return
 _lowercase											=True
 for v in graph[u]:
  dfs(__snake_case						)
 stack.append(__snake_case						)
def     UpperCAmelCase_ (							__snake_case						)					->      List[Any]:







 """simple docstring"""


 global graph, reversed_graph, scc, component, visit, stack
 if visit[u]:
  return
 _lowercase											=True
 component.append(__snake_case						)
 for v in reversed_graph[u]:
  dfsa(__snake_case						)
def     UpperCAmelCase_ (							)					->      Optional[Any]:







 """simple docstring"""


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


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

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

  UpperCAmelCase__            =							[]
  UpperCAmelCase__            =							[False] * n
  UpperCAmelCase__            =							[]
  UpperCAmelCase__            =							[]
  print(kosaraju())





from math import sqrt
def     UpperCAmelCase_ (							__snake_case						)					->      list[int]:







 """simple docstring"""


 _lowercase											=[1]
 for i in range(2					,						int(sqrt(__snake_case						)						) + 1					,						1						):
  if number % i == 0:
   values.append(__snake_case						)
   if int(number // i						) != i:
    values.append(int(number // i						)						)
 return sorted(__snake_case						)
def     UpperCAmelCase_ (							__snake_case						)					->      bool:







 """simple docstring"""


 return sum(factors(__snake_case						)						) > n
def     UpperCAmelCase_ (							__snake_case						)					->      bool:







 """simple docstring"""


 _lowercase											=factors(__snake_case						)
 _lowercase											=len(__snake_case						)
 _lowercase											=[[0 for i in range(number + 1						)] for j in range(r + 1						)]
 for i in range(r + 1						):
  _lowercase											=True

 for i in range(1					,						number + 1						):
  _lowercase											=False

 for i in range(1					,						r + 1						):
  for j in range(1					,						number + 1						):
   if j < values[i - 1]:
    _lowercase											=subset[i - 1][j]
   else:
    _lowercase											=subset[i - 1][j] or subset[i - 1][j - values[i - 1]]

 return subset[r][number] != 0
def     UpperCAmelCase_ (							__snake_case						)					->      bool:







 """simple docstring"""


 return abundant(__snake_case						) and not semi_perfect(__snake_case						)


if __name__ == "__main__":
  import doctest

  doctest.testmod(verbose=True)
  for number in (69, 70, 71):
    print(f'''{number} is {'' if weird(number) else 'not '}weird.''')

