link = []
for i in range(int(input())):
    ipt = input().split()
    if ipt[0] == 'insert':
        x,y = int(ipt[1]),int(ipt[2])
        if x in link:
            link.insert(link.index(x),y)
        else:
            link.append(y)
    if ipt[0] == 'delete':
        x = int(ipt[1])
        if x in link:
            link.remove(x)
print('NULL') if not link else  [print(i,end=' ') for i in link]