#include <stdio.h>

int main(void){
	int Q[20];
	int hp, tp, m, num;
  	Q[2]=81;
	Q[3]=26;
	Q[4]=45;
	hp=2;
	tp=4;
	m=3;
	printf("数値を入力");
    scanf("%d",&num);
while (num!=-1){
if (m<20){
	tp=(tp+1)%20;
	Q[tp]=num;
	m=m+1;
}
scanf("%d",&num);
}
while (m>0){
printf("%d ",Q[hp]);
hp=(hp+1)%20;
m=m-1;
}
	// your code goes here
	return 0;
}
