```
class Solution:
# @param root, a tree node
# @return a list of lists of integers
def levelOrder(self, root):
result = []
if not root:
return result
curlevel = [root]
while curlevel != []:
vals = []
newlevel = []
for node in curlevel:
vals.append(node.val)
if node.left:
newlevel.append(node.left)
if node.right:
newlevel.append(node.right)
result.append(vals)
curlevel = newlevel
return result
```