G7 vows to back Ukraine 'for as long as it takes'