Working on linked list in queue mode