Forum:Yamata Dragon

What would happen if a spirit card such as Yamata dragon was sent to the Graveyard before the End Phase? Does it stay there or get returned to the owner's hand as the card says.