Change Deque API from addFirst/removeFirst to offerFirst/pollFirst.