Queue using Two Stacks

  • + 0 comments
    q = []
    for s in [input() for _ in range(int(input()))]:
        q.append(s[2:]) if s[0] == '1' else q.pop(0) if s == '2' else print(q[0]) if s == '3' else ...