Profit = TR - TC
Find the marginal costs/revenues by differentiating the total costs/revenues with respect to the output level of the relevant good.
Find maximum profit by equating marginal cost = marginal revienue in each market
I assume you know what a second derivative is so you should be able to do the rest yourself.
To get the price, use the fact that (Total Revenue / Quantity) = Price.