P154: Enumeration of all rooted trees with at most $n$ vertices

P154: Enumeration of all rooted trees with at most $n$ vertices
Input:
An integer $n$.
Output:
All rooted tree with at most $n$ vertices.
Complexity:
$O(1)$ time per tree and $O(n)$ space.
Comment:
Reference:
[Nakano2003] (Bibtex)