#include <iostream>

using namespace std;

class IntStack
{
    static const int ssize = 100;
    int stack[ssize];
    int top;
public:
    IntStack() : top(0) {}
    void push(int i)
    {
        stack[top++] = i;
    }
    int pop()
    {
        return stack[--top];
    }
};

int fibonacci(int n)
{
    const int sz = 100;
    static int f[sz];
    f[0] = f[1] = 1;
    int i;
    for( i = 0; i < sz; i++ )
    if( f[i] == 0 ) break;
    while( i <= n )
    {
            f[i] = f[i-1] + f[i-2];
            i++;
    }
    return f[n];
}

int main()
{
    IntStack is;

    for( int i = 0; i < 20; i++ )
    is.push( fibonacci( i ) );
    for( int k = 0; k < 20; k++ )
    cout << is.pop() << endl;
    return 0;
}
