#include <iostream>
#include <cstring>
#include <stack>
using namespace std;
stack<int> s;
char str[100];
int n;
int main(void)
{
while(scanf("%s",&str))
{
if (strcmp(str,"push") == 0)
{
cin>>n;;
s.push(n);
cout<<"ok"<<"\n";
} else
if (strcmp(str,"pop") == 0)
{
cout<<s.top()<<"\n";
s.pop();
} else
if (strcmp(str,"back") == 0)
{
cout<<s.top()<<"\n";;
} else
if (strcmp(str,"size") == 0)
{
cout<<s.size()<<"\n";
} else
if (strcmp(str,"clear") == 0)
{
while(!s.empty())
s.pop();
cout<<"ok"<<"\n";
} else
{
cout<<"bye"<<"\n";
break;
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPHN0YWNrPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKCnN0YWNrPGludD4gczsKY2hhciBzdHJbMTAwXTsKaW50IG47CmludCBtYWluKHZvaWQpCnsKICB3aGlsZShzY2FuZigiJXMiLCZzdHIpKQogIHsKICAgIGlmIChzdHJjbXAoc3RyLCJwdXNoIikgPT0gMCkKICAgIHsKICAgICAgY2luPj5uOzsKICAgICAgcy5wdXNoKG4pOwogICAgICBjb3V0PDwib2siPDwiXG4iOwogICAgfSBlbHNlCiAgICBpZiAoc3RyY21wKHN0ciwicG9wIikgPT0gMCkKICAgIHsKICAgICAgIGNvdXQ8PHMudG9wKCk8PCJcbiI7CiAgICAgIHMucG9wKCk7CiAgICB9IGVsc2UKICAgIGlmIChzdHJjbXAoc3RyLCJiYWNrIikgPT0gMCkKICAgIHsKICAgICAgIGNvdXQ8PHMudG9wKCk8PCJcbiI7OwogICAgfSBlbHNlCiAgICBpZiAoc3RyY21wKHN0ciwic2l6ZSIpID09IDApCiAgICB7CiAgICAgICBjb3V0PDxzLnNpemUoKTw8IlxuIjsKICAgIH0gZWxzZQogICAgaWYgKHN0cmNtcChzdHIsImNsZWFyIikgPT0gMCkKICAgIHsKICAgICAgd2hpbGUoIXMuZW1wdHkoKSkgCglzLnBvcCgpOwogICAgICBjb3V0PDwib2siPDwiXG4iOwogICAgfSBlbHNlCiAgICB7CiAgICAgIGNvdXQ8PCJieWUiPDwiXG4iOwogICAgICBicmVhazsKICAgIH0KICB9CiAgcmV0dXJuIDA7Cn0=