A country bailout

This may be a dumb question, but I never exactly understood who owes whom when a country has $xx million debt (as in the recent Greece situation). Can anyone kindly explain?

The country borrowed money from other wealthier countries (like Germany, USA, Japan) to provide for its expenses. This may done through agencies like the IMF. So Greece owes Germany, USA, Japan etc. which they are unable to pau back. Now countries like Germany are pitching in to bail them out.

A country also issues sovereign debt to large investors. It’s like Treasuries, but for other countries.

sweet. thanks!