#include <stdio.h>

int main(){
  int n,i,k,j;
  scanf("%d",&n);
  int id[n],c[n][100000];

  for(i=0;i<n;i++){
    scanf("%d",&id[i]);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&c[i][j]);
    }
  }


    for(i=0;i<n;i++){
      printf("node %d: parent = %d, depth = %d, ",id[i],,);
      if(){
	printf("root, [");
	printf("]\n");
      }
      if(){
	printf("internal node, [");
	printf("]\n");
      }
      if(){
	printf("leaf, [");
	printf("]\n");
      }
    }

      return 0;
}

