Sukkah, chapter two, mishnah three. The mishnah opens: one who makes his sukkah on top of a wagon or on top of a boat - "kesheirah" - it is valid, and one may even go up into it on Yom Tov.
The Gemara explains that a sukkah built on a boat is valid when it is sturdy enough to stand up to an ordinary wind blowing on dry land. Even though it could not withstand the wind that blows at sea, that is enough, since a sukkah is a temporary dwelling, and nothing more than a temporary structure is required.
The permission to go up into it on Yom Tov is not really necessary in its own right, and it is taught here only to set up a contrast with the cases that follow in the mishnah.
A sukkah at the top of a tree or on an animal:
The mishnah continues: one who makes his sukkah at the top of a tree or on the back of a camel - it is valid, but "ein olin lah b'Yom Tov" - one may not go up into it on Yom Tov. The reason lies in two rabbinic prohibitions:
Climbing a tree: one may not climb a tree on Yom Tov, a decree lest he detach a branch while climbing.
Riding an animal: one may not ride an animal on Yom Tov, a decree lest he snap off a branch to strike it with.
Since these are only rabbinic prohibitions, the sukkah itself is valid, and one may go up into it on Chol HaMoed; only on Yom Tov itself is going up into it forbidden.
A sukkah supported by a tree:
The mishnah deals with a sukkah made in a tree, in a case where two of its walls come from the tree. The case can be understood in two ways:
The tree itself serves as the walls of the sukkah.
The floor of the sukkah rests on the tree.
The mishnah rules that whether two walls come from the tree and one is man made, or two walls are man made and one comes from the tree - it is valid, but one may not enter it on Yom Tov. The reason for the prohibition depends on the two ways of understanding the case:
If the floor rests on the tree: one who enters the sukkah is like someone climbing the tree, and for that reason it is forbidden.
If the tree serves only as the walls: people tend to place their belongings on the s'chach that is supported by the tree, and he thereby makes use of the tree on Yom Tov.
Three man made walls:
If three of the walls are man made and only one comes from the tree - it is valid, and one may even enter it on Yom Tov. For the sukkah stands entirely, or for the most part, on the strength of the three man made walls, and the tree is secondary to it.
And this is the rule: whenever the tree could be removed and the sukkah would still be able to stand on its own - whether by its walls or by its floor - it is valid, and one may enter it on Yom Tov, since it is not dependent on the tree.