implement sequence on stack