Price when both supply and demand have market power I have an intermediate sector that operates using labor only. There is 1-1 pairs between firms and workers, with profits

$$\pi = (Ap - w)\cdot 1$$

$p$ is the price, $A$ productivity, $w$ wage. Entrance to this market comes through a Mortensen Pissarides matching market, where vacancies and unemployed meet. Free entry and search cost $c$ implies 

$$ \frac{c}{q(\theta)} = \pi $$

where $q(\theta)$ is the matching rate given market tightness.

There is matching on the final goods market happening as well, which is why there is a free-entry given search cost $k$ to becoming a final goods producer. The details are not important here, but the final goods producer operate without using labor. Let $e$ denote the measure of intermediate firms (since it's also the employment rate), and $s$ the measure of final firms. 

I'm wondering how prices are determined here. Wages are given by Nash bargaining, such that

$$ w = \arg\max_{\tilde w} \beta \log (\tilde w - U) + (1 - \beta) \log(\pi(\tilde w))$$

for some outside-option value $U$. However, I wonder how the price of the intermediate good $p$ is determined, given that firms of both sides ($e$, $s$) have some market power. I'm happy to do additional assumptions if necessary, as long as the approach is in line with what has been done in the literature.

To be frank, I don't care about details on this margin at all, I just need closure.
I suppose one way to solve this - but I'm still looking for a proper way without - is to fall back to matching.

If there is matching between the intermediate and the final stage, at zero search cost and symmetric arrival rates, the surplus will be split given the Nashbargaining weights - which then determines the price.