'''

class Solution(object):

def levelOrder(self, root):

"""

:type root: TreeNode

:rtype: List[List[int]]

"""

if root is None:

return []

r = []

temp1 = [root]

while len(temp1) != 0:

temp = []

temp2 = []

while len(temp1) != 0:

node = temp1.pop()

temp.append(node.val)

if node.left is not None:

temp2.append(node.left)

if node.right is not None:

temp2.append(node.right)

r.append(temp[:])

temp1 = temp2[::-1]

return r

'''