Operation on grades poses two big challenges for steam locomotives. The first problem is wheel slip. Most steam locomotives have a considerable amount of their weight on unpowered wheels, which makes it easier for the powered (driver) wheels to slip. This effect is magnified by the uneven application of power from the pistons. Diesel-electrics generally have all wheels powered and the effort is smooth because of the electric drive. Shays are in-between. Cog and cable railways don't rely on wheel traction and so can handle much steeper grades. The second problem is boiler tilt. Conventional fire-tube boiler designs used in locos require that the boiler be almost exactly level so that the boiler parts designed to be under water really are under water. Expose the crown sheet and....boom. Yet at the same time the steam dome must not be full of water. This is why Shays tend to be small locomotives with short boilers. Electrification....that's the way.