#include "stdio.h"
#include "string.h"

int 	buf[1000000];
int	endBufIndex;
char	command_key_list[4][] = {"insert","delete","deleteFirst","deleteLast"};

void insert(int value, int index) {
	int i = index;

	if(index < 1)
	{
		while(i > 0)
		{
			buf[i] = bud[i-1];
		}
	}
	buf[index] = value;

	endBufIndex++;
}
void delete(int value) {
	for(i = 0; i < 1000000; i++)
	{
		if(buf[i] == value)
		{
			buf[i] == -1;
		}
	}
	endBufIndex--;
}
void deleteFirst(int value) {
	buf[0] == -1;
	endBufIndex--;
}
void deleteFirst(int value) {
	buf[endBufIndex] == -1;
	endBufIndex--;
}


void command_check(char* str) {
	ret = strncmp(str, "insert",11);
	if(ret == 0) return 0;

	ret = strncmp(str, "delete",11);
	if(ret == 0) return 0;

	ret = strncmp(str, "deleteFirst",11);
	if(ret == 0) return 0;

	ret = strncmp(str, "deleteLast",11);
	if(ret == 0) return 0;
}

int main(int argc, char* argv[]) {
	int startIndex = 2000000;
	int i = 0;
	int ret = 0;
	int delCnt = 0;
	int endBufIndex = 0;

	// init
	for(i = 0; i < 1000000; i++)
	{
		buf[i] = -1;
	}

	for(i=1; i < argc; i++)
	{
		// command start
		if(i == 1)
		{
			ret = strncmp(argv[i], "insert",6);
			if(ret != 0) return 0;
		}
		if(delCnt > 20)
		{
			break;
		}
		command_check(argv[i]);
	}

	// Output
	for(i=0; i < 1000000; i++)
	{
		if(i == 0) printf("%d", buf[0]);
		else if(buf[i] == -1) continue;
		else printf(" %d");
	}
	printf("\n");

	return 0;
}
