  We derive an explicit formula for the general solution of the cubic Szeg\"o
equation and of the evolution equation of the corresponding hierarchy. As an
application, we prove that all the solutions corresponding to finite rank
Hankel operators are quasiperiodic.
