A quantum advantage for inferring causal structure