Step-by-step explanation:
By comparing the opportunity cost of producing wine in the two countries, you can tell that Spain has a comparative advantage in the production of wine and Denmark has a comparative advantage in the production of rye.
Spain can gain from specialization and trade as long as it receives more than 5 of rye for each bottle of wine it exports to Denmark. Similarly, Denmark can gain from trade as long as it receives more than 1/10 of wine for each bushel of rye it exports to Spain.
The terms of trade (that is, price of wine in terms of rye) would allow both Denmark and Spain to gain from trade :
9 bushels of rye per bottle of wine
8 bushels of rye per bottle of wine