#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ delete (int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ insert(int *, int /*<<< orphan*/, int, int);
int is(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(int argc, const char *argv[]) {
  char com[10];
  int a[100000];
  int i, j, len = 0, n, num, v, t;
  scanf("%d", &num);
  for (i = 0; i < num; i++) {
    scanf("%s", com);
    if (is(com) == 1) {
      scanf("%d%d", &n, &v);
      insert(a, len++, n - 1, v);
    } else if (is(com) == -1) {
      scanf("%d", &n);
      delete (a, len--, n - 1);
    } else {
      printf("%d", a[0]);
      for (j = 1; j < len; j++) {
        printf(" %d", a[j]);
      }
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61ac0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x61aac(%rbp)
lea    0xe8f(%rip),%rdi
lea    -0x61ab4(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x61aa4(%rbp)
mov    -0x61aa4(%rbp),%eax
cmp    -0x61ab4(%rbp),%eax
jge    12f3 <main+0x1a3>
lea    -0x1a(%rbp),%rsi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x1a(%rbp),%rdi
call   1040 <is@plt>
cmp    $0x1,%eax
jne    1215 <main+0xc5>
lea    0xe34(%rip),%rdi
lea    -0x61ab0(%rbp),%rsi
lea    -0x61ab8(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x61aa0(%rbp),%rdi
mov    -0x61aac(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x61aac(%rbp)
mov    -0x61ab0(%rbp),%edx
sub    $0x1,%edx
mov    -0x61ab8(%rbp),%ecx
call   1060 <insert@plt>
jmp    12da <main+0x18a>
lea    -0x1a(%rbp),%rdi
call   1040 <is@plt>
cmp    $0xffffffff,%eax
jne    1267 <main+0x117>
lea    0xddb(%rip),%rdi
lea    -0x61ab0(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x61aa0(%rbp),%rdi
mov    -0x61aac(%rbp),%esi
mov    %esi,%eax
add    $0xffffffff,%eax
mov    %eax,-0x61aac(%rbp)
mov    -0x61ab0(%rbp),%edx
sub    $0x1,%edx
call   1070 <delete@plt>
jmp    12d5 <main+0x185>
mov    -0x61aa0(%rbp),%esi
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x61aa8(%rbp)
mov    -0x61aa8(%rbp),%eax
cmp    -0x61aac(%rbp),%eax
jge    12c7 <main+0x177>
movslq -0x61aa8(%rbp),%rax
mov    -0x61aa0(%rbp,%rax,4),%esi
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x61aa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61aa8(%rbp)
jmp    1285 <main+0x135>
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12da <main+0x18a>
jmp    12df <main+0x18f>
mov    -0x61aa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61aa4(%rbp)
jmp    1192 <main+0x42>
xor    %eax,%eax
add    $0x61ac0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x61aa8,%rsp
lea    0xe91(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    12c0 <main+0x160>
lea    0xe6a(%rip),%r14
lea    0x16(%rsp),%rbx
lea    0xe66(%rip),%r13
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    11d1 <main+0x71>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%r14
lea    0x16(%rsp),%rbx
add    $0x1,%r12d
cmp    0xc(%rsp),%r12d
jge    12c0 <main+0x160>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1050 <is@plt>
cmp    $0x1,%eax
jne    1230 <main+0xd0>
lea    0xe11(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0x1(%r15),%ebp
mov    0x8(%rsp),%edx
add    $0xffffffff,%edx
mov    0x10(%rsp),%ecx
lea    0x20(%rsp),%rdi
mov    %r15d,%esi
call   1070 <insert@plt>
jmp    12b8 <main+0x158>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1050 <is@plt>
cmp    $0xffffffff,%eax
je     128d <main+0x12d>
mov    %r14,%rbx
mov    0x20(%rsp),%esi
lea    0xdbe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%r15d
jl     11b0 <main+0x50>
mov    %r15d,%ebp
mov    $0x1,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x20(%rsp,%r14,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1270 <main+0x110>
jmp    11b0 <main+0x50>
lea    0xd75(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    -0x1(%r15),%ebp
mov    0x8(%rsp),%edx
add    $0xffffffff,%edx
lea    0x20(%rsp),%rdi
mov    %r15d,%esi
call   1080 <delete@plt>
mov    %ebp,%r15d
jmp    11c2 <main+0x62>
xor    %eax,%eax
add    $0x61aa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"%d%d\00"
@.str.3 = [4 x i8] c" %d\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i8]
%7 = alloca [100000 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
store i32 0, i32* %8
br label %16
16: ; preds = %68, %2
%17 = load i32, i32* %8
%18 = load i32, i32* %12
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %71
20: ; preds = %16
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%24 = call i32 @is(i8* %23)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %35
26: ; preds = %20
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* %11, i32* %13)
%28 = getelementptr inbounds [100000 x i32], [100000 x i32]* %7, i64 0, i64 0
%29 = load i32, i32* %10
%30 = add nsw i32 %29, 1
store i32 %30, i32* %10
%31 = load i32, i32* %11
%32 = sub nsw i32 %31, 1
%33 = load i32, i32* %13
%34 = call i32 @insert(i32* %28, i32 %29, i32 %32, i32 %33)
br label %67
35: ; preds = %20
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%37 = call i32 @is(i8* %36)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %47
39: ; preds = %35
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%41 = getelementptr inbounds [100000 x i32], [100000 x i32]* %7, i64 0, i64 0
%42 = load i32, i32* %10
%43 = add nsw i32 %42, -1
store i32 %43, i32* %10
%44 = load i32, i32* %11
%45 = sub nsw i32 %44, 1
%46 = call i32 @delete(i32* %41, i32 %42, i32 %45)
br label %66
47: ; preds = %35
%48 = getelementptr inbounds [100000 x i32], [100000 x i32]* %7, i64 0, i64 0
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %49)
store i32 1, i32* %9
br label %51
51: ; preds = %61, %47
%52 = load i32, i32* %9
%53 = load i32, i32* %10
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %64
55: ; preds = %51
%56 = load i32, i32* %9
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [100000 x i32], [100000 x i32]* %7, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %55
%62 = load i32, i32* %9
%63 = add nsw i32 %62, 1
store i32 %63, i32* %9
br label %51
64: ; preds = %51
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %66
66: ; preds = %64, %39
br label %67
67: ; preds = %66, %26
br label %68
68: ; preds = %67
%69 = load i32, i32* %8
%70 = add nsw i32 %69, 1
store i32 %70, i32* %8
br label %16
71: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"%d%d\00"
@.str.3 = [4 x i8] c" %d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i8]
%4 = alloca [100000 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%9 = bitcast [100000 x i32]* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %60
16: ; preds = %2
%17 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 0
br label %18
18: ; preds = %16, %55
%19 = phi i32 [ 0, %16 ], [ %57, %55 ]
%20 = phi i32 [ 0, %16 ], [ %56, %55 ]
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%22 = call i32 @is(i8* %8)
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %31
24: ; preds = %18
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %7)
%26 = add nsw i32 %20, 1
%27 = load i32, i32* %5
%28 = add nsw i32 %27, -1
%29 = load i32, i32* %7
%30 = call i32 @insert(i32* %17, i32 %20, i32 %28, i32 %29)
br label %55
31: ; preds = %18
%32 = call i32 @is(i8* %8)
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%36 = add nsw i32 %20, -1
%37 = load i32, i32* %5
%38 = add nsw i32 %37, -1
%39 = call i32 @delete(i32* %17, i32 %20, i32 %38)
br label %55
40: ; preds = %31
%41 = load i32, i32* %17
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = icmp sgt i32 %20, 1
br i1 %43, label %44, label %53
44: ; preds = %40
%45 = zext i32 %20 to i64
br label %46
46: ; preds = %44, %46
%47 = phi i64 [ 1, %44 ], [ %51, %46 ]
%48 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %49)
%51 = add nuw nsw i64 %47, 1
%52 = icmp eq i64 %51, %45
br i1 %52, label %53, label %46
53: ; preds = %46, %40
%54 = call i32 @putchar(i32 10)
br label %55
55: ; preds = %24, %53, %34
%56 = phi i32 [ %26, %24 ], [ %36, %34 ], [ %20, %53 ]
%57 = add nuw nsw i32 %19, 1
%58 = load i32, i32* %6
%59 = icmp slt i32 %57, %58
br i1 %59, label %18, label %60
60: ; preds = %55, %2
ret i32 0
}