Pakistan aren't completely out of the running in the first Test against Australia in Perth, but they now face a mountain to climb to get back into the contest.
In reply to Australia's 487, Pakistan were dismissed for 271 before tea on day three, giving the home side a 216-run lead.
Australia went to stumps at 2-84, an overall lead of 300 with two days still to play.
Poor fielding and a substandard performance from their premier paceman Shaheen Afridi cost Pakistan dearly across the first two days.
The damage would have been even worse if not for debutant paceman Aamir Jamal, who showed plenty of passion on the way to taking 6-111.
Jamal's average speed of 135.6km/h made him his team's fastest bowler, with Afridi (133.7km/h) down on his usual pace.
When it was Pakistan's turn to bat, they showed they are no easybeats when they set their mind to it.
Abdullah Shafique (42 off 121 balls) and Imam (62 off 199) showed plenty of patience to take the sting out of Australia's attack.
But from 1-123 and 3-181, Pakistan suffered a nightmare period just before lunch to slump to 6-195.
Imam's dismissal was the worst of the lot.
View this post on Instagram A post shared by cricket.com.au (@cricketcomau)
After soaking up 199 balls, the 35-degree Perth heat must have got to Imam as he charged down the crease in a wild attempt to smack Lyon out of the park.
The ball spun sharply and left Imam in no-man's land, with wicketkeeper Alex Carey whipping off the bails to send the Pakistan opener packing.
"That's the danger isn't it, when you get tied down," Pakistan batting coach Adam Hollioake said of Imam's dismissal.
"They don't give you a lot of stuff to hit, so you have to take a risk at some stage.
"It's just balancing up when you take that risk, and the risk versus reward.
"I think he'll be disappointed getting out like that after doing all that hard work. But this attack, they can get you out at any stage."
Imam's departure was part of a collapse of 3-14, robbing Pakistan of the chance to keep Australia's attack sweating in the sweltering heat for a prolonged period.
It's little wonder Pakistan are prone to brain fades, given this marks only their third Test of the year.
With talents such as captain Shan Masood, Babar Azam, Abdullah Shafique, Imam and Saud Shakeel in their batting line-up, Pakistan are no mugs.
But they do need to learn how to be better for longer in Test ranks, especially against the might of Australia on home soil.