Code:
\count255=1
\loop
\foreach \n in {\section ,\subsection ,\Thm }
\n{};
\ifnum\count255 < 255
\advance\count255 by 1
\repeat
basically other than a proper list of each and a way to map it to the proper ordering of things all you need on top of autonumbering and a few cool packages.