# Path: arraystack.py
# class Stack(object):
# 
#     def __init__(self, max_size):
#         if max_size <= 0:
#             max_size = 1
#         self.stack = [None]*max_size
#         self.sp = 0
# 
#     def push(self, v):
#         if self.sp >= len(self.stack):
#             self.stack = self.stack + [None]*len(self.stack)
#         self.stack[self.sp] = v
#         self.sp += 1
# 
#     def pop(self):
#         assert self.sp > 0
#         self.sp -= 1
#         return self.stack[self.sp]
# 
#     def size(self):
#         return self.sp
# 
#     def is_empty(self):
#         return self.size() == 0


from arraystack import Stack
# Reversal using a stack.
# Copyright © 2014 Bart Massey
# [This program is licensed under the "MIT License"]
# Please see the file COPYING in the source
# distribution of this software for license terms.


def stack_reverse(l):
    s = Stack(len(l))
    for e in l:
        s.push(e)
    r = []
    while not s.is_empty():
        r.append(s.pop())
    return r

def list_reverse(l):

# Path: arraystack.py
# class Stack(object):
# 
#     def __init__(self, max_size):
#         if max_size <= 0:
#             max_size = 1
#         self.stack = [None]*max_size
#         self.sp = 0
# 
#     def push(self, v):
#         if self.sp >= len(self.stack):
#             self.stack = self.stack + [None]*len(self.stack)
#         self.stack[self.sp] = v
#         self.sp += 1
# 
#     def pop(self):
#         assert self.sp > 0
#         self.sp -= 1
#         return self.stack[self.sp]
# 
#     def size(self):
#         return self.sp
# 
#     def is_empty(self):
#         return self.size() == 0


# Path: reverse.py
from arraystack import Stack

# Reversal using a stack.
# Copyright © 2014 Bart Massey
# [This program is licensed under the "MIT License"]
# Please see the file COPYING in the source
# distribution of this software for license terms.


def stack_reverse(l):
    s = Stack(len(l))
    for e in l:
        s.push(e)
    r = []
    while not s.is_empty():
        r.append(s.pop())
    return r

def list_reverse(l):

    r = []