Calculate profit when trading between more than two goods

When trading two goods (or currencies) it is relatively easy to say if you are making profit when you know the exchange rates. For example Person A trades Bananas for Person B's Apples. Person A gives Person B 5 Bananas and receives 10 Apples from Person B:

A -> 5 Bananas -> B

A <- 10 Apples <- B

Now after a while Person B wants to have more Apples because supplies are running low. Person A now sells the Apples back for Bananas, but of course, a profit is favourable, so now they cost 7 Bananas (we can assume that Person B has sufficient supply of Bananas to trade):

A -> 10 Apples -> B

B -> 7 Bananas -> A

If we only look at these two transactions you can clearly see, that Person A had 5 Bananas before and now has 7 (ignoring any Bananas obtained by means of production or other trades). There is profit for Person A. It is possible for Person A to calculate exchange rates from the information obtained by looking at Trade 1 only and then subsequently calculate if the proposed Trade 2 will be profitable.

Now it gets more complex, as Person A has developed the production of more goods and Person B did so as well. They both now produce Bananas Apples and Oranges and trade them.

So now if we have the following trade:

A -> 5 Bananas -> B

A <- 10 Apples <- B

We can again calculate a exchange-rate between Bananas and Apples and check out if a future trade is profitable between these goods. But now both Persons decide to trade Oranges as well:

A -> 5 Bananas -> B

A <- 20 Oranges <- B

I now have the following questions:

Let's say only Trade 3 and Trade 4 have taken place and there is no other influence on the exchange rates between the goods. Can Person A calculate the profitability of future trades of Apples or Oranges for Bananas or Bananas for Apples or Oranges? In detail, for which of the following trades can Person A calculate the profitability using only the information obtained from Trade 3 and Trade 4, and if it is possible, how would this be calculated?

Bananas -> Apples

Bananas -> Oranges

Apples -> Bananas

Oranges -> Bananas

Additionally: Again only from the information drawn from Trade 3 and Trade 4 can Person A calculate the profitability of a trade between Oranges and Apples or vice versa?