Solitary confinement is terrible. Most people confined this way for a stretch are badly affected by it. A few manage to come out of it better. It’s their stories that are told in this piece: How to Survive Solitary Confinement
The people that managed ok tend to have grit and the ability to make their minds work in a way to defeat being alone and confined. To see what I mean, read the piece. It can help you in some way if you are feeling alone and confined, as we all do from time to time.