#include <deque>
#include <iostream>

using namespace std;

int main(){
  deque<int> q;
  q.push_back(1);
  q.push_back(2);
  q.push_back(3);
  q.push_front(-1);
  q.push_front(-2);
  q.push_front(-3);
  cout << q.size() << endl;
  cout << q.front() << ", " << q.back() << endl;
  cout << q.at(0) << ", " << q[q.size()-1] << endl;
  q.pop_back();
  cout << "q.pop_back();" << endl;
  cout << q.size() << endl;
  cout << q.front() << ", " << q.back() << endl;
  cout << q.at(0) << ", " << q[q.size()-1] << endl;
  q.pop_front();
  cout << "q.pop_front();" << endl;
  cout << q.size() << endl;
  cout << q.front() << ", " << q.back() << endl;
  cout << q.at(0) << ", " << q[q.size()-1] << endl;
  return 0;
}
