PREFIX ex: <http://example.com/>
SELECT ?s ?o WHERE {
?s a ex:C .
?s ex:p1 ?m1 .
?s ex:p1prime ?m1 .
?s ex:p1 ?m2 .
?m2 ex:p2 ?o .
?m1 ex:p2 ?o .
}