#include <stdio.h>
#define MAX 100000
#define NIL -1

typedef struct{
  int p;
  int l;
  int r;
}Tree;

Tree T[MAX];


 /*深さを数える*/
int getDepth(int x){

  int dep=0;

  while(T[x].p != NIL){
    x = T[x].p;
    dep++;
  }
  return dep;
}

void Print(x){

  int a;
  
  if(T[x].p == NIL){ 
  //printf("node %d: parent = %d, depth = %d, root, ",x,T[x].p,getDepth(x));
    printf("node %d: parent = %d , sibling = %d , degree = %d, depth = %d, height = %d, root");
  }
  else if(T[x].l == NIL){
  //printf("node %d: parent = %d, depth = %d, leaf, ",x,T[x].p,getDepth(x));
    printf("node %d: parent = %d , sibling = %d , degree = %d, depth = %d, height = %d, leaf");
  }
  else{
  //printf("node %d: parent = %d, depth = %d, internal node, ",x,T[x].p,getDepth(x)); 
    printf("node %d: parent = %d , sibling = %d , degree = %d, depth = %d, height = %d, inertnal node");  
  }
  
}


int main(void){
  v
  int n,i,j,a,b,c,r;

  scanf("%d",&n);
  for(i = 0; i < n; i++){
    T[i].p = NIL;
    T[i].l = NIL;
    T[i].r = NIL;    
  }

  for(i = 0; i < n; i++){
    scanf("%d %d",&a,&b);
    for(j = 0; j < b; j++){
      scanf("%d",&c);
      T[c].p = a;
      if(j == 0) T[a].l = c;
      else if (j >= 1) T[r].r = c;
      r = c;
    }
  }

  //for(i = 0; i <n; i++) getDepth(i);
  for(i = 0; i <n; i++) Print(i);

    return 0;
}
