from collections import deque
d = deque("abcd")                
for elem in d:                  
    print(elem.upper())
d.append('e')  
d.appendleft('f')  
print(d)     
print(type(d))
e=d.pop()
print(e)
print(d)
l=d.popleft()
print(l)
print(d)
l=list(d) 
print(l)
print(d[0])
print(d[-1])
rl=list(reversed(d))
print(rl)
b='c' in d
print(b)
d.extend('wxyz')
print(d)
d.extendleft('pqr')
print(d)
rd=deque(reversed(d))
print(d)
print(rd)
d.clear()
