why does this solution works?