#include <stdio.h>
#include <stdlib.h>
#define N 1000

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

Node *Tree;

int sibling( int );

int sibling ( int i ){
  if( Tree[i].parent == -1 ) return -1;
  if( Tree[Tree[i].parent].left != -1 && Tree[Tree[i].parent].left != i ) return Tree[Tree[i].parent].left;
  if( Tree[Tree[i].parent].right != -1 && Tree[Tree[i].parent].right != i ) return Tree[Tree[i].parent].right;
  return -1;
}

int main(){
  int point,number,i,j,a,b,n,deep=0,place,count=0,k;
  int *Deep;
  int num[N];
  

  scanf("%d",&n);
  Tree =  ( Node * )malloc( sizeof(Node) * n );
  Deep = ( int * )malloc( sizeof(int) * n );

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

  for( i = 0 ; i < n ; i++ ){
    place = i;
    while( Tree[place].parent != -1 ){
      deep++;
      place = Tree[place].parent;
    }
    Deep[i] = deep;
    deep = 0;
  }

  for( i = 0 ; i < n ; i++ ){
    printf("node %d: parent = %d, sibling = %d, depth = %d, ",i ,Tree[i].parent , sibling( i ) ,Deep[i]);
    if( Tree[i].parent == -1 ) printf("root, ");
    else if( Tree[i].left == -1 ) printf("leaf, ");
    else printf("internal node, ");

    printf("[");
    for( j = 0 , a = Tree[i].left  ;  a!=-1  ; j++ , a=Tree[a].right ){
      if( j ) printf(", ");
      printf("%d",a);
    }
    printf("]\n");
  }
  free(Tree);
  free(Deep);
  return 0;
}