#53823: python解答


s310107@student.cysh.cy.edu.tw (柴貓)

學校 : 不指定學校
編號 : 280501
來源 : [163.27.3.93]
最後登入時間 :
2025-09-10 09:36:54

from collections import deque

n = int(input())
arr = deque()
for _ in range(n):
    line = list(map(int, input().split()))
    if len(line) == 1:
        if line[0] == 2:
            if arr: print(arr[0])
            else: print(-1)
        elif line[0] == 3 and arr: arr.popleft()
    else:
        arr.append(line[1])