def dfs(graph, start, end):
    stack = [start]
    visited = []
    while stack:
        u = stack.pop()
        visited.append(u)
        if (end in visited):
            return 1
        for v in graph[u]:
            if ((v not in visited) and (v not in stack)):
                stack.append(v)
    return 0
def dfs(graph, start, end):
    stack = [start]
    visited = []
    while stack:
        u = stack.pop()
        visited.append(u)
        if (end in visited):
            return 1
        for v in graph[u]:
            if ((v not in visited) and (v not in stack)):
                stack.append(v)
    return 0