#include <stdio.h>
#include <stdlib.h>

typedef struct{
  int parent;
  int left;
  int right;
}Node;

Node *T;
int n;

void maigoCenter(void);
int findSibling(int);
int countDegree(int);
int findDepth(int);
int findHeight(int);
void printType(int);

int main(){
  int i, id;

  scanf("%d", &n);

  T = malloc(sizeof(Node) * n);

  for(i=0; i<n; i++){
    T[i].parent = -1;
    scanf("%d%d%d", &id, &T[i].left, &T[i].right);
  }

  maigoCenter();

  for(i=0; i<n; i++){
    printf("node %d: parent = %d, sibling = %d, ", i, T[i].parent, findSibling(i));
    printf("degree = %d, ", countDegree(i));
    printf("depth = %d, ", findDepth(i));
    printf("height = %d, ", findHeight(i));
    printType(i);
  }

  return 0;
}

void maigoCenter(void){
  int i;

  for(i=0; i<n; i++){
    if(T[i].left != -1){
      T[T[i].left].parent = i;
    }
    if(T[i].right != -1){
      T[T[i].right].parent = i;
    }
  }

} 