Giving conditions to Nodes

When i query " match (n:label{Name_1:'A'})
match (n)--(p)--(q)--(r)
return n,p,q,r"

But B receives connection from other nodes aswell, like

Here I want B to be given only when I query every node connected to B with a query like

" match (n:label{Name_1:'A '}),(m:label{Name_1:'F'}),(o:label{Name_1:'E'})
match (n)--(p)--(q)--(r)
return n,m,o,p,q,r"

Can we attain it?

Is it something like this what you are looking for:

match (n:Label)--(m:Label{name:'B'})--(o:Label{name:'C'})--(p:Label{name:'D'})
where in ['A', 'E', 'F']
return n,m,o,p

in order to assign a variable name to the expected node, you may "reuse" the p-node 'B' in a template extension

MATCH (n:Label{name:'A'})--(p:Label{name:'B'})--(q:Label{name:'C'})--(r:Label{name:'D'}), 
RETURN m,n,o,p,q,r

but same result as