What was supposed to be a boat trip to Tahiti for sailors Jennifer Appel and Tasha Fuiava turned into an ordeal of nearly five months spent adrift in the Pacific. But the two survived to tell the tale. They were finally rescued by the United States Navy on Wednesday, October 25, along with their two dogs, Gizmodo reports.

Appel and Fuiava—who are both from Hawaii—left Honolulu for Tahiti on May 3, a journey of more than 2700 miles as the crow flies. Shortly after launch, rough weather caused their engine to fail, but the two women decided to continue the trip by sailing. At some point, the vessel lost a mast, and the two couldn't call for help, as their phone had fallen overboard. After around two months at sea, the sailors began sending out futile distress calls while subsisting on a year's supply of dry food stored on their boat.

Sharks attacked the weakened vessel at night. It was "very depressing, and it was very hopeless," Appel told media outlets after her rescue, according to Gizmodo.

Luckily, a Taiwanese fishing vessel eventually spotted their boat as it drifted about 900 miles southeast of Japan, and its sailors contacted the U.S. Coast Guard in Guam. Navy ship USS Ashland arrived the next morning, and crew brought Appel, Fuiava, and their furry friends on board.

Tasha Fuiaba, an American mariner who had been sailing for five months on a damaged sailboat, climbs the accommodation ladder to board the USS Ashland.U.S. Navy photo by Mass Communication Specialist 3rd Class Jonathan Clay

Sailors help Zeus, one of two dogs who were aided by the ship USS Ashland.U.S. Navy photo by Mass Communication Specialist 3rd Class Jonathan Clay

Command Master Chief Gary Wise welcomes aboard Jennifer Appel.U.S. Navy photo by Mass Communication Specialist 3rd Class Jonathan Clay

Appel and Fuiava received food and medical care, and will remain on board until the Ashland's next port of call.

"They saved our lives," Appel said in a statement. "The pride and smiles we had when we saw [the navy] on the horizon was pure relief."

Watch a video of their rescue below:

[h/t Gizmodo]