Sloving Pointer Problem in Deque Class