implementation for queue in list style