#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <stack>
using namespace std;
const int INF = 1E9 + 7;
class Stack {
private :
struct node {
int key;
struct node * pre;
struct node * nexT;
}*tail;
int length;
public:
Stack () {
tail = NULL;
length = 0;
}
~Stack () {
delete tail;
}
void push (int x);
int pop ();
int top ();
inline int size () {return length;}
inline bool empty () {return length == 0;}
};
void Stack:: push (int x) {
node * temp;
temp = new (node);
tail -> nexT = temp;
temp -> pre = tail;
tail = temp;
temp -> key = x;
tail -> nexT = NULL;
}
int Stack:: top () {
if (empty()) return INF;
return tail -> key;
}
int Stack:: pop() {
if (empty()) return INF;
if (size () == 1) {
tail = NULL;
return -INF;
}
node * temp = tail;
tail = tail -> pre;
tail -> nexT = NULL;
int ans = temp -> key;
delete temp;
return ans;
}
int main () {
return 0;
}