import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Deque<Integer> data=new LinkedList<>(); for(int i=0;i<=n;i++){ String line=sc.nextLine(); String[] strs=line.split(" "); String op=strs[0]; if("push".equals(op)){ data.addLast(Integer.parseInt(strs[1])); }else if("pop".equals(op)){ data.removeLast(); }else if("getMin".equals(op)){ Integer[] ints=data.toArray(new Integer[0]); Arrays.sort(ints); System.out.println(ints[0]); } } } }