Language: C

int main(){
  int i, j, n, id;
  Node T[MAX], tmp;

  scanf("%d",&n);
  for(i = 0; i < n; i++){
    T[i].p = -1;
    T[i].dep = 0;
  }
  for(i = 0; i < n; i++){
    scanf("%d",&id);
    scanf("%d",&T[id].k);
    T[id].l = (int *)malloc(sizeof(int) * T[id].k);
    for(j = 0; j < T[id].k; j++){
      scanf("%d",&T[id].l[j]);
      T[T[id].l[j]].p = id;
    }    
  }

  for(i = 0; i < n; i++){
    tmp = T[i];
    while(1){
      if(tmp.p == -1) break;
      T[i].dep++;
      tmp = T[tmp.p];
	}  
  }


  for(i = 0; i < n; i++){
    if(T[i].dep == 0){
      printf("node %d: parent = %d, depth = %d, root, [", i, T[i].p, T[i].dep);
      
      for(j = 0; j < T[i].k-1; j++){
	printf("%d, ", T[i].l[j]);
      }
 
      if(T[i].k != 0) printf("%d]\n",T[i].l[j]);
      else printf("]\n");
    }
    else if(T[i].k != 0 && T[i].p != -1){
      printf("node %d: parent = %d, depth = %d, internal node, [", i, T[i].p, T[i].dep);
      for(j = 0; j < T[i].k - 1; j++){
	printf("%d, ", T[i].l[j]);
      }
      printf("%d]\n",T[i].l[j]);
    }
    else if(T[i].k == 0){
      printf("node %d: parent = %d, depth = %d, leaf, []\n", i, T[i].p,  T[i].dep);
    }
  }

  return 0;

}

Compiler output:
main.c: In function 'main':
main.c:3:3: error: unknown type name 'Node'
    3 |   Node T[MAX], tmp;
      |   ^~~~
main.c:3:10: error: 'MAX' undeclared (first use in this function)
    3 |   Node T[MAX], tmp;
      |          ^~~
main.c:3:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(){
main.c:5:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:5:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:13:22: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   13 |     T[id].l = (int *)malloc(sizeof(int) * T[id].k);
      |                      ^~~~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
  +++ |+#include <stdlib.h>
    1 | int main(){
main.c:13:22: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   13 |     T[id].l = (int *)malloc(sizeof(int) * T[id].k);
      |                      ^~~~~~
main.c:13:22: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:23:13: error: request for member 'p' in something not a structure or union
   23 |       if(tmp.p == -1) break;
      |             ^
main.c:25:18: error: request for member 'p' in something not a structure or union
   25 |       tmp = T[tmp.p];
      |                  ^
main.c:32:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   32 |       printf("node %d: parent = %d, depth = %d, root, [", i, T[i].p, T[i].dep);
      |       ^~~~~~
main.c:32:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:32:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:32:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:42:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   42 |       printf("node %d: parent = %d, depth = %d, internal node, [", i, T[i].p, T[i].dep);
      |       ^~~~~~
main.c:42:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:49:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   49 |       printf("node %d: parent = %d, depth = %d, leaf, []\n", i, T[i].p,  T[i].dep);
      |       ^~~~~~
main.c:49:7: note: include '<stdio.h>' or provide a declaration of 'printf'