#include #include #include int main(){ int numberOfInstructions, typeOfInstruction, number; std::vector stack; std::stringstream result; std::cin >> numberOfInstructions; for(int counter = 0; counter < numberOfInstructions; counter ++){ std::cin >> typeOfInstruction; if(typeOfInstruction == 1){ std::cin >> number; stack.push_back(number); } if(typeOfInstruction == 2) if(stack.size() > 0) stack.pop_back(); if(typeOfInstruction == 3){ std::cin >> number; bool isEmpty = true; for(unsigned counter = 0; counter < stack.size(); counter ++) if(stack[counter] <= number){ result << stack[counter] << " "; isEmpty = false; } if(isEmpty) result << "Empty\n"; else result << "\n"; } } std::cout << result.str(); return 0; }