Problem:
A rooted binary tree is a tree with a root node in which every node has at most two children.  Your task is to write a program which reads a rooted binary tree _T_ and prints the following information for each node _u_ of _T_ :    * node ID of _u_   * parent of _u_   * sibling of _u_   * the number of children of _u_   * depth of _u_   * height of _u_   * node type (root, internal node or leaf)  If two nodes have the same parent, they are **siblings**. Here, if _u_ and _v_ have the same parent, we say _u_ is a sibling of _v_ (vice versa).  The height of a node in a tree is the number of edges on the longest simple downward path from the node to a leaf.  Here, the given binary tree consists of _n_ nodes and evey node has a unique ID from 0 to _n_ -1.

Incorrect submission (verdict: Wrong Answer):
# -*- coding: utf-8 -*-

class Node(object):
    def __init__(self, N):
        self.parent = [-1 for i in range(N)]
        self.left = [-1 for i in range(N)]
        self.right = [-1 for i in range(N)]
        self.depth = [-1 for i in range(N)]
        self.sibling = [-1 for i in range(N)]
        self.hight = [0 for i in range(N)]
        self.degree = [0 for i in range(N)]
        self.max_depth = None

    def set_depth(self, u):
        d, U = 0, u
        while T.parent[u] is not -1:
            u = T.parent[u]
            d += 1
        self.depth[U] = d

    def set_hight(self, u):
        self.hight[u] = self.max_depth - self.depth[u]
        

N = int(input())

# create node
T = Node(N)


for j in range(N):
    A = [int(i) for i in input().split()]

    
    T.left[A[0]] = A[1]

    
    for u in A[1:]:
        if u is not -1:
            T.parent[u] = A[0]
            T.degree[A[0]] += 1
            
    
    if (A[1] is not -1) and (A[2] is not -1):
        T.right[A[1]] = A[2]
        T.sibling[A[1]], T.sibling[A[2]] = A[2], A[1]


for i in range(N):
    T.set_depth(i)

# set max_depth
T.max_depth = max(T.depth)


for i in range(N):
    T.set_hight(i)

# ??????
for i in range(N):
    
    if T.parent[i] is -1:
        node = "root"
    elif T.left[i] is -1:
        node = "leaf"
    else:
        node = "internal node"

    print("node {0}: parent = {1}, sibling = {2}, degree = {3}, depth = {4}, hight = {5}, {6}".format(i, T.parent[i], T.sibling[i], T.degree[i], T.depth[i], T.hight[i], node))

Fixed, accepted submission:
# -*- coding: utf-8 -*-

class Node(object):
    def __init__(self, N):
        self.parent = [-1 for i in range(N)]
        self.left = [-1 for i in range(N)]
        self.right = [-1 for i in range(N)]
        self.depth = [-1 for i in range(N)]
        self.sibling = [-1 for i in range(N)]
        self.height = [0 for i in range(N)]
        self.degree = [0 for i in range(N)]

    def set_depth(self, u):
        d, U = 0, u
        while T.parent[u] is not -1:
            u = T.parent[u]
            d += 1
        self.depth[U] = d

    def set_height(self, u):
        h1 = h2 = 0
        if self.left[u] is not -1:
            h1 = self.set_height(self.left[u]) + 1
        if self.right[u] is not -1:
            h2 = self.set_height(self.right[u]) + 1
        
        self.height[u] = max(h1, h2)
        return max(h1, h2)
            

N = int(input())

# create node
T = Node(N)


for j in range(N):
    A = [int(i) for i in input().split()]

    
    T.left[A[0]] = A[1]
    T.right[A[0]] = A[2]
    
    
    for u in A[1:]:
        if u is not -1:
            T.parent[u] = A[0]
            T.degree[A[0]] += 1
            
    
    if (A[1] is not -1) and (A[2] is not -1):
        T.sibling[A[1]], T.sibling[A[2]] = A[2], A[1]


for i in range(N):
    T.set_depth(i)


T.set_height(T.parent.index(-1))

# ??????
for i in range(N):
    
    if T.parent[i] is -1:
        node = "root"
    elif T.left[i] is -1 and T.right[i] is -1:
        node = "leaf"
    else:
        node = "internal node"

    print("node {0}: parent = {1}, sibling = {2}, degree = {3}, depth = {4}, height = {5}, {6}".format(i, T.parent[i], T.sibling[i], T.degree[i], T.depth[i], T.height[i], node))