TOKYO - Foreign ministers from Japan, the United States, Europe and elsewhere on Wednesday agreed to work together in dealing with the situation in Afghanistan, as they seek to ensure safe departures for those fleeing the Taliban-controlled country, the Japanese government said.