At the Tanjai Cheena school in Khyber Pakhtunkhwa students squeeze into makeshift classrooms where plastic tarps serve as walls and electricity is sparse, as a surging population overstretches the country's fragile education system.
Sandwiched behind desks like sardines, students repeat words learned in Pashto and English during an anatomy lesson: “Guta is finger, laas is hand”.
Two teachers rotate between four classrooms at the school, which lacks even the most basic amenities including toilets.
“The girls usually go to my house and the boys to the bushes,” says principal Mohammad Bashir Khan, who has worked at the school in the picturesque Swat Valley for 19 years.
With birth control and family planning virtually unheard of in this ultraconservative region, the ill-equipped public school system has not kept up with population growth.
“In 1984, when my father started the school, there were 20 to 25 kids. Now they are more than 140,” Khan says.
Pakistan sits on a demographic time bomb after years of exponential growth and high fertility rates resulted in a population of 207 million — two-thirds of whom are under the age of 30.
And each year the country gains three to four million more people, overburdening public services from schools to hospitals.
At the Malok Abad primary school in the town of Mingora, 700 boys share six classrooms, many of which remain damaged from a 2005 earthquake with clumps of plaster still falling from their ceilings.
The youngest students study in the courtyard sitting on the ground, while others are forced to gather on the roof under the baking sun.
“We are doing our best. But those kids are neglected by the system,” says teacher Inamullah Munir. On the girls' side, the situation is even more dire with the smallest classes hosting up to 135 students packed into a space measuring about 20 square metres.
“This is emergency education,” said Faisal Khalid, a local director at the education department in Swat. The stakes are high in a country where education has long been neglected and received little in the way of funding as Pakistan focused on fighting militancy.
Swat shouldered the extra burden of combating a deadly Taliban insurgency that saw dozens of schools destroyed and the shooting of schoolgirl and education activist Malala Yousafzai in 2012.
As peace has returned to the region, public spending on education has increased, but it still falls short of the province's growing needs.
Prime Minister Imran Khan's Pakistan Tehreek-i-Insaf has made “quality education for all” its rallying cry since taking the helm of the provincial government in 2013.
In the last five years 2,700 schools have been built or expanded, while 57,000 new teachers have been recruited.
Authorities have also more than doubled Khyber Pakhtunkhwa's education budget between 2013 and 2018.
“That was the biggest increase in the history of this province,” explains Atif Khan, the former provincial education minister.
But the rise in spending is no match for the country's swelling demographics, even as the government plans to expand existing facilities and extend working hours in an attempt to meet demand.
The top-ranked public high school in provincial capital Peshawar is a striking example of the challenges facing educators and students, who number 70 to a room despite the addition of a dozen new classrooms.
“The more classrooms we build, the more they will be filled,” says Jaddi Kalil, who heads the educational services department in the area.
Pakistan now spends 2.2 per cent of its GDP on education, the country's Minister of Education Shafqat Mahmood told AFP, adding that the amount was set to double in the coming years.
Even more worrying, the increased funding has failed to put a dent in the province's illiteracy rates, with only 53 per cent of children above 10 years of age able to read and write.
The situation is replicated across Pakistan, with 22.6 million children out of school nationwide — a figure that is likely to increase, given the country's unbridled population growth.
The quality of teaching is also a cause for concern with just one in two students able to solve basic math problems upon completing primary school, according to the finance ministry.
“Only elites have access to quality education,” a recent report by the UN Development Programme (UNDP) said.
With its economy already on the rocks, Pakistan faces the unenviable task of having to create between 1.2 and 1.5 million skilled jobs annually to employ recent graduates, the UNDP report said.
Poor education is a “recipe for frustration”, while good education “allows for more cohesion and less extremism”, said Adil Najam, the author of the UNDP study.
“All the important problems of Pakistan are related to education.”