#include <iostream>
using namespace std;
struct stack {
long long s[100];
int cursor=0;
void push(long long n){
s[cursor++]=n;
}
long long pop(){
return s[--cursor];
}
long long back(){
return s[cursor-1];
}
unsigned size(){
return cursor;
}
void clear(){
cursor=0;
s[cursor]=0;
}
};
int main() {
stack x;
string b;
long long n;
while(cin>>b){
if(b=="push"){
cin>>n;
x.push(n);
cout<<"ok"<<endl;
}
else if(b=="pop"){
if(x.size()==0){
cout<<"error"<<endl;
}
else
cout<<x.pop()<<endl;
}
else if(b=="back"){
if(x.size()==0){
cout<<"error"<<endl;
}
else cout<<x.back()<<endl;
}
else if(b=="size"){
cout<<x.size()<<endl;
}
else if(b=="clear"){
x.clear();
cout<<"ok"<<endl;
}
else if(b=="exit"){
cout<<"bye"<<endl;
break;
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsgCnN0cnVjdCBzdGFjayB7IAkJCglsb25nIGxvbmcgc1sxMDBdOyAKCWludCBjdXJzb3I9MDsgIAoJdm9pZCBwdXNoKGxvbmcgbG9uZyBuKXsgIAoJCXNbY3Vyc29yKytdPW47IAoJfSAKCWxvbmcgbG9uZyBwb3AoKXsgCgkJcmV0dXJuIHNbLS1jdXJzb3JdOyAKCX0gCglsb25nIGxvbmcgYmFjaygpeyAKCQlyZXR1cm4gc1tjdXJzb3ItMV07IAoJfSAKCXVuc2lnbmVkIHNpemUoKXsgCgkJcmV0dXJuIGN1cnNvcjsgCgl9IAoJdm9pZCBjbGVhcigpeyAKCQljdXJzb3I9MDsgCgkJc1tjdXJzb3JdPTA7IAoJfSAKfTsgCmludCBtYWluKCkgeyAKCXN0YWNrIHg7IAoJc3RyaW5nIGI7ICAgIAoJbG9uZyBsb25nIG47IAoJd2hpbGUoY2luPj5iKXsgICAKCQlpZihiPT0icHVzaCIpeyAgICAKCQkJY2luPj5uOyAKCQkJeC5wdXNoKG4pOyAKCQkJY291dDw8Im9rIjw8ZW5kbDsgCgkJf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