Write a program that reads numbers and stores them in a deque. Any even number should be added as the first element, an odd number as the last. Then the program must output all elements from the first to the last.
The first line contains the number of elements. Each line followed the first one contains an element.