Let $S_n$ be the symmetric group of $n$ letters, generated by elements $s_i$ for $ 1 \leq i \leq n -1$ with relations $s_is_{i+1}s_i = s_{i+1}s_is_{i+1} $ and $s_i,s_j$ commute if $|i-j| > 1$.
I would like to have an algorithm to get a list $w_1, \dots, w_{n!}$ which enumerates $S_n$ so that each $w_k$ can be expressed as a product in $s_1, \dots, s_{n-1}$.
For example for $S_3$ such a list is given by $1, s_1, s_2, s_1s_2, s_2s_1, s_1s_2s_1$. A list for $S_4$ or $S_5$ would be already nice.