Buggy python submission (verdict: Runtime Error):
import sys

class Node:
    def __init__(self, id, children):
        self.id = id
        self.parent = -1
        self.depth = 0
        self.type = "root"
        self.children = children

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    N = lines[0]

    tree = []
    for i in range(int(N)):
        tree.append(Node(i, map(int, lines[i + 1][4:].split())))

    for node in tree:
        if not node.children:
            node.type = "leaf"

        for child in node.children:
            tree[child].parent = node.id
            tree[child].depth = node.depth + 1
            if tree[child].type != "leaf"
                tree[child].type = "internal node"

    for node in tree:
        print "node {0.id}: parent = {0.parent}, depth = {0.depth}, {0.type}, {0.children}".format(node)

Fixed submission:
import sys

class Node:
    def __init__(self):
        self.id = id
        self.parent = -1
        self.sibling = -1
        self.type = "leaf"

    def printInfo(self):
        print "node {0.id}: parent = {0.parent}, sibling = {0.sibling}, degree = {0.degree}, depth = {0.depth}, height = {0.height}, {0.type}".format(self)

def setTree(id, tree, depth):
    tree[id].depth = depth
    height = degree = 0
    for i in range(2):
        child = tree[id].children[i]
        if child != -1:
            degree += 1
            tree[child].parent = id
            tree[child].sibling = tree[id].children[~i]
            height = max(setTree(child, tree, depth + 1) + 1, height)
    tree[id].height = height
    tree[id].degree = degree
    if height != 0:
        tree[id].type = "internal node"

    return height

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    N = int(lines[0])
    del lines[0]

    tree = []
    for i in range(N):
        tree.append(Node())

    root = N * (N - 1) / 2
    for line in lines:
        info = map(int, line.split())
        tree[info[0]].children = info[1:]
        tree[info[0]].id = info[0]
        for i in tree[info[0]].children:
            if i != -1:
                root -= i

    setTree(root, tree, 0)
    tree[root].type = "root"

    for node in tree:
        node.printInfo()

Buggy python submission (verdict: Runtime Error):
import sys

class Node:
    def __init__(self, id, left, right, degree, depth, type):
        self.id = id
        self.parent = None
        self.sibling = -1
        self.degree = degree
        self.depth = depth
        self.height = 0
        self.type = type
        self.left = left
        self.right = right

    def printInfo(self):
        print "node {0.id}: parent = {0.parent.id}, sibling = {0.sibling}, degree = {0.degree}, depth = {0.depth}, height = {0.height}, {0.type}".format(self)

def buildTree(id, nodeList, depth):
    leftId, rightId = nodeList[id][0], nodeList[id][1]
    if leftId == -1 and rightId == -1:
        dummy = Node(-1, None, None, 0, 0, "")
        return Node(id, dummy, dummy, 0, depth, "leaf")
    degree = 0
    if leftId == -1:
        left = Node(-1, None, None, 0, 0, "")
    else:
        left = buildTree(leftId, nodeList, depth + 1)
        degree += 1
    if rightId == -1:
        right = Node(-1, None, None, 0, 0, "")
    else:
        right = buildTree(rightId, nodeList, depth + 1)
        degree += 1
    node = Node(id, left, right, degree, depth, "internal node")

    node.left.parent = node
    node.left.sibling = node.right.id
    node.right.parent = node
    node.right.sibling = node.left.id
    node.height = max(node.left.height, node.right.height) + 1
    return node

def tree2linear(node, list):
    list[node.id] = node
    if node.left.id != -1:
        tree2linear(node.left, list)
    if node.right.id != -1:
        tree2linear(node.right, list)

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    N = int(lines[0])
    del lines[0]

    nodeList = [[]] * N
    sum = N * (N - 1) / 2
    for line in lines:
        line = map(int, line.split())
        id, children = line[0], line[1:]
        nodeList[id] = children
        for child in children:
            if child == -1:
                break
            sum -= child

    root = buildTree(sum, nodeList, 0)
    root.type = "root"
    root.parent = Node(-1, None, None, 0, 0, "")

    nodeList = [0] * N
    tree2linear(root, nodeList)
    for node in nodeList:
        node.printInfo()

Fixed submission:
import sys

class Node:
    def __init__(self):
        self.id = id
        self.parent = -1
        self.sibling = -1
        self.type = "leaf"

    def printInfo(self):
        print "node {0.id}: parent = {0.parent}, sibling = {0.sibling}, degree = {0.degree}, depth = {0.depth}, height = {0.height}, {0.type}".format(self)

def setTree(id, tree, depth):
    tree[id].depth = depth
    height = degree = 0
    for i in range(2):
        child = tree[id].children[i]
        if child != -1:
            degree += 1
            tree[child].parent = id
            tree[child].sibling = tree[id].children[~i]
            height = max(setTree(child, tree, depth + 1) + 1, height)
    tree[id].height = height
    tree[id].degree = degree
    if height != 0:
        tree[id].type = "internal node"

    return height

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    N = int(lines[0])
    del lines[0]

    tree = []
    for i in range(N):
        tree.append(Node())

    root = N * (N - 1) / 2
    for line in lines:
        info = map(int, line.split())
        tree[info[0]].children = info[1:]
        tree[info[0]].id = info[0]
        for i in tree[info[0]].children:
            if i != -1:
                root -= i

    setTree(root, tree, 0)
    tree[root].type = "root"

    for node in tree:
        node.printInfo()