queue, duplicates and reverse