catalan number and use of queue