// 야간용 2번 문제

#include <stdio.h>
#define NIL	(0)
class Stack {
	int *_s;
	int *_top;
public:
	Stack(int n) {
		_s = new int[10*n];
		_top = _s;
		for(int i = 0; i < 10*n; i++) {
			*(_s+i) = -1;
		}
	}
	void push(int x) {
		if (x/2*2 == x) {
			*_top = x; _top++;
			*_top = x; _top++;
		} else {
			*_top = 9; _top++;
		}
	}
	int pop(int x) {
		return *_top;
	}
	void print() {
		while (*_s != -1) {
			printf("%d",*_s);
			_s++;
		}
		printf("\n");
	}
};
void main() {
	int data[5] = { 0, 1, 2, 3, 4 };
	Stack x(5);

	for(int i = 0; i < 5; i++) {
		x.push(data[i]);
		x.pop(data[i]);
	}
	x.print();
}