It was graduation day at the Naval Academy, 1958. Standing among the graduates was a man with one of the most famous names in the Navy -- John S. McCain III.
There were McCain ships and a McCain airfield -- named after the man's father and grandfather, both war-time commanders and the first father and son to become four-star admirals.
And to the young McCain they bequeathed their military code of honor.
This John McCain, the war hero, would go on to become the Republican nominee for the president of the United States. He once wrote, "Earning the respect of my father and grandfather has been the most lasting ambition of my life."
"I work at it every day," McCain told ABC News' Diane Sawyer when she pointed out the quotation.
Living Up to the Dream
It's a big legacy, especially for a boy who was initially hesitant to pursue it.
"I was just … a bit resentful that my path had been charted for me, either intentionally or unintentionally, by my parents," McCain said. "In other words, I remember when my dad's friends would be over when I was very young, and they'd say, 'What class is he gonna be?' Not, 'Was he goin' in the Naval Academy?'"
When Sawyer asked McCain what the number 894 meant to him, he chuckled.
"It means, I think, fifth from the bottom of my class at the Naval Academy," he said.
"Could I also point out that -- it's not important -- but a lot of the class standing was determined by the number of demerits that you acquired," he said, again with a laugh.
The behavioral demerits were eared by a smart, scrappy kid who had grown up backing off bullies as he moved around to 20 schools because of the Navy.
When he landed at an upscale Episcopal prep school outside Washington, D.C., he was a passionate reader who loved military history and poetry. He had his father's favorite poem memorized -- Robert Louis Stevenson's "Requiem."
'John Wayne McCain'
But the short kid was also the kind of wrestler who could pin an opponent in 37 seconds.
And at the Naval Academy -- in an act of heresy -- he would take on upperclassmen if they tried to bully underlings, his name a trump card.
"When he saw one of the upperclassmen picking on one of the Filipino mess men in our mess hall, John just stood up and said 'You knock that off. That's not fair,'" Adm. Chuck Larsen said.
"And the 1st class man said, 'What's your name, mister?'" his former roommate Frank Gamboa said. "And John replied, 'Midshipman McCain. What's yours?'"
Along with McCain's combative DNA came a taste for risk.
"What you see with McCain is a man who is driven by a sense of duty, honor and country, but who has a kind of subversive sense about him," Jon Meacham of Newsweek magazine said. "He loves to be in the room, but he also loves to roll the grenade."
Gamboa said with a laugh, "If you didn't want to live close to the edge, then you didn't go to a party with John McCain."
His friends called him "John Wayne McCain" -- for his swagger at parties and all the girls. Some stories became the stuff of legend.
Gamboa remembered traveling with McCain to Rio de Janeiro when the would-be senator met a Brazilian model.
"It's just one of those idyllic experiences that I'll always remember and cherish," McCain said. "The telling goes -- grows much better with age."
One night at the Naval Academy, McCain started a water fight in his slovenly room, prompting a knock on the door.
"And John was facing the door, and he goes, 'Dad!'" Gamboa said. "So we turned around, here was this officer with gold braid all the way up his sleeve."
It was, in fact, McCain's father.
'He said, 'Goddamn it, Johnny, no wonder you're flunkin'. Get dressed and come down to the rotunda!'" Gamboa said.
Even though the rebellious boy was on the verge on being expelled, his father, true to his code, turned his son in.
Not as Perfect as It Seems
McCain, who said he has the greatest confidence in the young people coming up in the armed services, also said that it wasn't always easy when his father was gone for long stretches, including nearly four years in World War II.
"I think all children miss their father, or their mother, when they're absent," he said.
For much of his childhood, McCain was reared by his mother, a high-spirited heiress to an oil fortune.
Today, the apartment belonging to the McCain matriarch, 96, is still a tribute to her father-in-law and her husband -- and the Navy they loved.
'"It was his whole life, and a lot of people don't understand that," Roberta McCain said. "I do."
"McCain's father was at once an incredible pillar of strength and someone to be emulated and he also had a glaring weakness," Meacham said.
McCain's father was also an alcoholic.
"It's also harder when you're young, when you don't understand that alcoholism is a disease, and they do things that they otherwise wouldn't do," McCain said.
When McCain was 16, he found his father lying drunk on the stairway in full dress uniform. He said binges would sometimes last five or six days.
"My father fought it every day of his life. He used to pray every night on his knees. He attended AA, Alcoholics Anonymous, meetings regularly, and sometimes he was able to, for a couple, three years, not have a drink," he said. "And then, of course, the disease would take over for a while."
But from the outside the McCains seemed indestructible. And John McCain III cut a dashing figure as he headed off to Pensacola, Fla., flight school in his graduation present -- a white Corvette convertible.
As a young flier he had reason to feel charmed. He survived two plane crashes, walking away from both. And he was barely harmed in a frightening accident on board the USS Forrestal in which 134 of his fellow fighters died. Those experiences were only the start of McCain's long trip that has taken him to the campaign trail as the Republican presidential nominee.
For much more on McCain's life and influences, watch "Portrait of a President." And to read about Barack Obama's years at Harvard Law School, click here.