implementation of deques