Try it this way
SELECT DISTINCT
LEAST(s1.country, s2.country) c1,
GREATEST(s1.country, s2.country) c2
FROM battles b1 JOIN battles b2
ON b1.battlename = b2.battlename
AND b1.ship <> b2.ship JOIN ships s1
ON b1.ship = s1.name JOIN ships s2
ON b2.ship = s2.name
HAVING c1 <> c2
Output:
| C1 | C2 |
|---------|---------------|
| Germany | Great Britain |
| Japan | USA |