def ancestors_query(node_id, node_label, edge_label='edge'):
    """Generate Cypher query finding ancestors nodes starting at 'node_id'."""
    return "MATCH path=(m:{})-[:{}*1..]->(n:{} {{id: '{}'}})\n".format(node_label, node_id, edge_label, node_label) + """RETURN m.id AS ancestor, REDUCE(p=[], n in nodes(path) | p + [n.id]) as path
"""
