G8 finance ministers agree on deal to relieve debts of 18 poorest nations