Aiden Markram needed an innings like this. He needed to get smacked, to survive, to scrap, to scurry, to have irritations behind the sightscreen and eventually to find the space to play his shots. Most of all, he needed to show that he can play in the subcontinent.

His previous efforts brought just 97 runs in eight innings at an average of 10.50, including three ducks and raised questions about his technique against spin. He was dismissed by Rangana Herath four times in four innings in Sri Lanka in 2018 and by R Ashwin and Ravindra Jadeja once each in India in 2019. By the time Umesh Yadav and Ishant Sharma were responsible for his pair in Pune, Markram's mind was so scrambled that he punched a wall in the dressing room and ruled himself out of the final Test with a broken hand.

By then, Markram's coming down to earth was complete. After a dream start to his Test career - he averaged 55.55 in his first 10 Tests - Markram's next eight saw him score just two half-centuries and average a mere 23.64. Still, South Africa gave him a long rope and played him in the Boxing Day Test against England that followed the India tour where he scored 20 and 2 and fractured his finger. He sat out the rest of the 2019-20 summer. But South Africa's hopes for him, helped by his domestic form, saw him slot straight back in for this season's Tests. Now, he has repaid their faith.

This was an innings of discipline, determination and a dose of luck. Markram could have been out on 4 when Ahsan Raza ruled that Shaheen Afridi had trapped him lbw, but a review showed that the ball pitched outside leg. He could have been out on 22 when Afridi hit him again, with delivery that snuck under the bat, but ball-tracking said it was missing leg. Between those two reviews, Markram faced 57 balls and scored 18 runs. Four of them came off a ball that found extra bounce and was worked fine, four more from a misfield and the rest were small releases of pressure - one so small that Markram found himself competing with a direct hit at the non-striker's end to complete a leg-bye.

There was another jittery moment, one run and 25 balls later, when he skied a drive off Yasir Shah that didn't carry to short extra cover. Seventeen balls and another four runs after that, Babar Azam dropped him at slip, again off Shah.

Despite the threat of the Pakistan spinners, Markram persisted, each over trying a little harder to figure out how best to play them. Eventually, he settled on the big stride forward, which worked until he didn't meet the pitch of a Nauman Ali delivery late in the day, to end his innings before he had properly finished the job. Markram would have wanted to take South Africa into the fourth day, so he could build on the lead. Nonetheless, he needed an innings like this to show he can do it.

He took 158 balls to get to 50, his slowest one in Test cricket, which must have felt particularly so for a player as naturally positive as he is. At times, he even looked comfortable, like when he was driving through the offside. His straight drive off Hasan Ali was a shot for the ages. Shah was impressed. He remembered Markram being good on seaming wickets in South Africa in early 2019, but has now seen him "play the spin very well".

There was praise from his team-mates too. "His innings was extremely important," Kagiso Rabada said. "He is a magnificent player. I have known him since age group level and we have conversations about cricket together. He wants to contribute. You can see he really wants to be here. And he applied himself well. He has gone through some challenges and our job is to overcome those challenges. We are constantly under the spotlight, constantly being criticised even though we criticise [ourselves] more than anyone else will. Those are challenges he has faced and it's something you have to do over and over and over again which is not easy. I am happy he got runs today. He would have loved to get a hundred. He will probably be disappointed but he gave us a real chance"

And he didn't do it alone.

Rassie van der Dussen, who batted with Markram through most of the day, also needed a knock like this.

This is van der Dussen's first challenge away from home and it came with South Africa on the brink of serious trouble. He came to the crease after a hurting Dean Elgar braved a painful blow on his hand only to misjudge a sweep, with South Africa still 110 runs behind and Markram in the midst of a go-slow. To van der Dussen's credit, he fell in line with his more experienced team-mate and adopted the same pace of run-scoring.

Though van der Dussen never looked entirely comfortable against the spinners and maintained a perpetually wooden stance, he worked out a way. Like Markram, he wasn't afraid to stride out, even against the quicks. At one stage, van der Dussen was stationed outside his crease in an attempt to negate reverse swing. He defended well, if not always gracefully, and with shots like the pull, he showed his strength on the leg side. While Markram scored 41 of his 74 runs on the off side, van der Dussen scored 43 of his 64 on the on side and the pair complemented each other well.

Where van der Dussen needs to improve is in his footwork but the confidence he would have gained from almost three-and-a-half hours in the middle, seeing off the spinners, would have helped. Like Markram, he would have been disappointed not to take South Africa to the close without further damage, and disappointed that he did not convert.

A dozen innings into his Test career, and 45 as an international, van der Dussen yet to reach three figures. But his experience in the domestic game and the maturity he has shown at top level has meant he has been entrusted with key positions in the line-up: No.3 in Tests, top five in ODIs and T20Is, and has even entered the captaincy conversation. Markram is part of that too.

And with their 127-run partnership, this pair has given the selectors something to start talking about.

Firdose Moonda is ESPNcricinfo's South Africa correspondent