---
# System prepended metadata

title: Untitled

---

## 13465
```python
inputstring = input()
command = []
numbers = []
inputlist = inputstring.split(",")
#print(len(inputlist))
for i in range(0,len(inputlist)):
    try:
        x = int(inputlist[i])
        numbers.append(x)
    except ValueError:
        #numbers.append(0)
        command.append(inputlist[i])
for i in range(0,len(command)):
    r = command[i]
    if r[0]=="f":
        k = int(r[1:])
        numbers = numbers[:k]
    elif r[0]=="b":
        k = int(r[1:])*(-1)
        numbers = numbers[k:]

for i in range(0,len(command)):
    r = command[i]
    if r[0]=="i":
        if r[1]=="1":
            print(max(numbers))
        elif r[1]=="2":
            print(min(numbers))
    
        
        
#print(numbers)      
#print("=====")
#print(command)

```

```python
inputstring = input()
command = []
numbers = []
none_flag = 0
inputlist = inputstring.split(",")

for i in range(0,len(inputlist)):
    try:
        x = int(inputlist[i])
        numbers.append(x)
    except ValueError:
        command.append(inputlist[i])

for i in range(0,len(command)):
    r = command[i]
    if r[0]=="f":
        k = int(r[1:])
        numbers = numbers[:k]
    elif r[0]=="b":
        k = int(r[1:])*(-1)
        numbers = numbers[k:]
for i in range(0,len(command)):
    r = command[i]
    if r[0]=="i":
        if r[1]=="1":
            print(max(numbers))
        elif r[1]=="2":
            print(min(numbers))
        else:
            print("None")
    else:
        print("None")
```