def adjacent(g,node, n):
    """
    find all adjacent nodes of input node in g

    g: 2D array of numbers, the adjacency matrix
    node: int, the node whose neighber you wanna find

    return: a list of ints
    """
    result = []
    for i in range(n):
        if g[node][i] != 0:
            result.append(i)
    return result