Last week Rio de Janeiro was a city that bent, and bent some more, but didn't break.
A lot went wrong on Pope Francis' week-long visit to Brazil last week. There were logistical and security challenges for the city hosting not only a pope, but also nearly 2 million religious pilgrims and tourists from more than 120 countries.
The wrong turn by Pope Francis' motorcade less than an hour after his arrival last Monday meant the pontiff was briefly stuck in traffic and surrounded by an adoring mob of well-wishers. It could have put Francis in immediate danger. From a security standpoint it was inexcusable, inexplicable, and deeply embarrassing for Brazil at the exact moment when much of the world's media attention was focused on that motorcade. It left a terrible first impression. And first impressions stick.
Another big problem: the last-minute change of venue for the final weekend events, caused by poor planning. The original location had turned into a mud pit due to heavy rains, costing Rio taxpayers millions, and forcing a logistics scramble to re-organise events to Copacabana.
And there were other messes along the way, too. On Tuesday, the subway stopped working for two hours one night, causing complete and utter transit chaos. Busses were crammed to capacity early on, and the number of portable toilets on Copacabana beach were grossly insufficient for the crowds of millions.
But even with all that, it's important to remember that, over the course of two consecutive nights, Copacabana beach hosted an estimated 3 million people. For perspective, the entire population of Jamaica is 2.9 million.
On Saturday night, more than 1.5 million religious pilgrims pitched sleeping bags and slept on Copacabana beach, as well as the main avenue along the strand and the side streets. It was an unreal scene, like nothing I could have ever imaging witnessing on Copacabana.
There were lots of reported pickpockets, but no reported cases of serious crimes.
Let me just ask the question: is there any beach in the world that could host more than 2 million people on consecutive nights and not have lines at the bathrooms, packed busses, and delays in the metro? My answer: I seriously doubt it.
What I think Rio deserves at least some credit for is adapting, identifying, and alleviating problems (some of them self-inflicted) as the week progressed.
And the pope made it out of Brazil safely, with no further safety scares, despite the huge security challenges he posed.
Of course there were monumental inconveniences for the people of Rio, many of whom were basically sequestered in their homes for days on end to avoid the masses. The voters of the city ultimately will decide at the ballot box if they are pleased with the city leaders' handling of the events.
I lost count of how many times I have been asked the past couple years some version of this question: "Will Rio de Janeiro be ready for the World Cup and Olympics?" Like Brazil itself, the question is complicated, and doesn't lend itself to a yes or no answer.
It depends, really, on how you define the word 'ready'.
But 50 years from now, the iconic images from Pope Francis' visit to Rio will not be of a city in collapse. They'll be the jaw-dropping aerial shots pm Sunday morning of 3 million people on Copacabana beach to see the pope one last time on this historic trip.
Follow Gabriel Elizondo on Twitter: @elizondogabriel