#include <stack>
#include <iostream>

using namespace std;

int main(){
    int c, num;
    stack <int> s;
    while(1){
        cin >> num;
        if(!num){
            if(!c) break;
            else{
                cout << s.top() <<endl;
                s.pop();
            }
        }
        else{
            if(c==10) cout << "Already Full" <<endl;
            else s.push(num);
        }
    }
    return 0;
}