The donkey and the greyhound lay down under a big tree , and the cat and the cock got up into the branches , the cock flying right up to the topmost twig , where he thought he would be safe from all danger .