How do I get the third gold piece?

I need help getting the pirates to give up their gold piece they're guarding. I can make them bury and unbury the treasure, and I can cause them to turn around, but I can't find anything to put into their treasure chest without it being seen!