def has_cycle_visit(visiting, parents, adjacency_list, s):
  """
  Check if there is a cycle in a graph starting
  at the node s

  """
  visiting[s] = True
  for u in adjacency_list[s]:
    if u in visiting:
      return True
    if u in parents:
      continue
    parents[u] = s
    if has_cycle_visit(visiting, parents, adjacency_list, u):
      return True
  del visiting[s]
  return False