A pair of goats were rescued Tuesday after they found themselves in a tricky situation -- the animals were stuck on the beam of a Pennsylvania bridge high off the ground. Officials aren't quite sure how they escaped and got up there.

The goats wandered from their farm in Lawrence County, Pennsylvania, and onto a beam on the Mahoning River Bridge, Pennsylvania Turnpike officials said. The beam is only eight inches wide, according to CBS Pittsburgh, and the goats were teetering over 100 feet above the ground.

The goats were stranded for 18 hours, the station reports.

Get Breaking News Delivered to Your Inbox

When the animals were discovered by the Pennsylvania State Police, workers sprang to action. They borrowed a crane from PennDOT, extended it over the side of the bridge and managed to get the goats down safely. Pennsylvania Turnpike officials shared photos of the dramatic rescue on Facebook.

Yesterday, two goats wandered away from a local farm and onto a beam on the Mahoning River Bridge. When discovered by... Posted by Pennsylvania Turnpike on Wednesday, April 4, 2018

"Went underneath and we grabbed the white goat first, 'cause she was the one facing the other direction," Todd Tilson, a longtime Pennsylvania Turnpike worker who helped with the rescue, told CBS Pittsburgh. "We thought if we could get her up that there was a chance that we could get the brown one to be able to walk back on the beam on its own."

Fortunately for all involved, it worked out exactly as planned.

Two goats wandered away from their farm and found themselves stranded on the side of a Pennsylvania bridge. Pennsylvania Turnpike

Both goats were returned home safely to their farm, according to Turnpike officials.

"It's unbelievable, but with this day in society, I think everyone wants a feel-good story," Tilson told CBS Pittsburgh. "And it was a feel-good story with a happy ending that we did not know how it was gonna turn out."