Language: C++

#include <iostream>
using namespace std;

const long MAX = 100001;
const long NIL = -1;

struct Node{
	long parent, leftChild, rightSibling;
};

long n, Depth[MAX];

void print(struct Node T[], long id){
	cout << "node " << id << ": ";
	cout << "parent = " << T[id].parent << ", ";
	cout << "depth = " << Depth[id] << ", ";

	if (T[id].parent == NIL) cout << "root, ";
	else if (T[id].leftChild == NIL) cout << "leaf, ";
	else cout << "internal node, ";

	cout << "[";

	for (long i = 0, c = T[id].leftChild; c != NIL; i++, c = T[c].rightSibling){
		if (i) cout << ", ";
		cout << c;
	}
	cout << "]" << endl;
}

long setDepth(struct Node T[], long id, long parent){
	Depth[id] = parent;
	if (T[id].rightSibling != NIL) setDepth(T[id].rightSibling, parent);
	if (T[id].leftChild != NIL) setDepth(T[id].leftChild, parent + 1);
}

int main(){
	long degree, id, child, left, right;
	struct Node T[MAX];
	cin >> n;
	for (long i = 0; i < n; i++){
		T[i].parent = T[i].leftChild = T[i].rightSibling = NIL;
	}
	for (long i = 0; i < n; i++){
		cin >> id >> degree;
		for (long j = 0; j < degree; j++){
			cin >> child;
			if (j == 0) T[id].leftChild = child;
			else T[leftChild].rightSibling = child;
			left = child;
			T[child].parent = id; 
		}
	}
	for (long i = 0; i < n; i++){
		if (T[i].parent == NIL) right = i;
	}

	setDepth(T, right, 0);

	for (long i = 0; i < n; i++) print(T, i);

	return 0;
}

Compiler output:
a.cc: In function 'long int setDepth(Node*, long int, long int)':
a.cc:33:55: error: invalid conversion from 'long int' to 'Node*' [-fpermissive]
   33 |         if (T[id].rightSibling != NIL) setDepth(T[id].rightSibling, parent);
      |                                                 ~~~~~~^~~~~~~~~~~~
      |                                                       |
      |                                                       long int
a.cc:33:48: error: too few arguments to function 'long int setDepth(Node*, long int, long int)'
   33 |         if (T[id].rightSibling != NIL) setDepth(T[id].rightSibling, parent);
      |                                        ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:6: note: declared here
   31 | long setDepth(struct Node T[], long id, long parent){
      |      ^~~~~~~~
a.cc:34:52: error: invalid conversion from 'long int' to 'Node*' [-fpermissive]
   34 |         if (T[id].leftChild != NIL) setDepth(T[id].leftChild, parent + 1);
      |                                              ~~~~~~^~~~~~~~~
      |                                                    |
      |                                                    long int
a.cc:34:45: error: too few arguments to function 'long int setDepth(Node*, long int, long int)'
   34 |         if (T[id].leftChild != NIL) setDepth(T[id].leftChild, parent + 1);
      |                                     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:6: note: declared here
   31 | long setDepth(struct Node T[], long id, long parent){
      |      ^~~~~~~~
a.cc:35:1: warning: no return statement in function returning non-void [-Wreturn-type]
   35 | }
      | ^
a.cc: In function 'int main()':
a.cc:49:32: error: 'leftChild' was not declared in this scope
   49 |                         else T[leftChild].rightSibling = child;
      |                                ^~~~~~~~~