When I straighten it, it curls at the ends. When I curl it, it goes limp. What's going on?

(My hair is medium-thickness, layered, and slightly wavy, if this helps.)