#include <iostream>
#include <stdexcept>
#include <iomanip>
using namespace std;


struct vantuz
{
   vantuz& push();
   vantuz& pull();
   vantuz();
private:
   bool pushed;
};

vantuz::vantuz():pushed(false)
{
}

vantuz& vantuz::push()
{
        if(pushed)
        {
              throw logic_error("already pushed!");
        }
        pushed=!pushed;
		cout<<"push! ";
        return *this;
}

vantuz& vantuz::pull()
{
    pushed=!pushed;
    if(pushed)
    {
          throw logic_error("already pulled!");
    }
   cout<<"pull! ";
   return *this;
}

int main()
{
   try
   {
      vantuz v;
      v.push().pull().push().pull().push().pull().push().pull();
   }
   catch(logic_error& ex)
   {
   	  cout<<endl<<setw(20)<<setfill('@')<<' '<<"Runtime error!"<<setw(20)<<setfill('@')<<' '<<endl<<ex.what()<<endl;
   	  throw;
   }
   return 0;
}