#include <stdio.h>
#include<malloc.h>
int main() {
int space;
scanf("%d", &space);
int times;
scanf("%d", ×);
int* array = (int*)malloc(sizeof(int) * (space + 1));
int front = 0;
int rear = 0;
//有没有大佬帮我看一下为什么要执行times+100000才能通过所有案例,应当只循环times次就应该可以通过的
for (int i = 0; i <= times+1000000; i++) {
char* op = (char*)malloc(sizeof(char) * 6);
scanf("%s", op);
if (!strcmp(op, "push")) {
if (((rear +1)% (space + 1) == front)) {
printf("full\n");
} else {
int tmp;
scanf("%d", &tmp);
array[rear++] = tmp;
rear = rear % (space + 1);
}
}
if (!strcmp(op, "pop")) {
if (!(rear == front)) {
printf("%d\n", array[front++]);
front = front % (space + 1);
} else {
printf("empty\n");
}
}
if (!strcmp(op, "front")) {
if (!(rear == front)) {
printf("%d\n", array[front]);
} else {
printf("empty\n");
}
}
}
return 0;
}