import collections
d1 = collections.deque("abcdefghacmqdcb")
print d1
print "Poped element ",d1.pop()
print d1
print "Poped left element ",d1.popleft()
print d1
import collections
d1 = collections.deque("abcdefghacmqdcb")
print d1
print "Poped element ",d1.pop()
print d1
print "Poped left element ",d1.popleft()
print d1