Court rules out life sentences for teens