Language: C++

#include <iostream>
using namespace std;

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

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

struct Node T[MAX];
long n, Depth[MAX];

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

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

	cout << "[";

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

long setDepth(long id, long parent){
	Depth[id] = parent;
	if (T[id].r != NIL) setDepth(T[id].r, p);
	if (T[id].l != NIL) setDepth(T[id].l, p + 1);
}

int main(){
	long degree, id, child, leftChild, rightSibling;
	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].left = child;
			else T[leftChild].rightSibling = child;
			leftChild = child;
			T[child].parent = id; 
		}
	}
	for (long i = 0; i < n; i++){
		if (T[i].parent == NIL) rightSibling = i;
	}

	setDepth(rightSibling, 0);

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

	return 0;
}

Compiler output:
a.cc: In function 'void print(long int)':
a.cc:17:31: error: 'D' was not declared in this scope
   17 |         cout << "depth = " << D[u] << ", ";
      |                               ^
a.cc:17:33: error: 'u' was not declared in this scope
   17 |         cout << "depth = " << D[u] << ", ";
      |                                 ^
a.cc:20:24: error: 'struct Node' has no member named 'left'
   20 |         else if (T[id].left == NIL) cout << "leaf, ";
      |                        ^~~~
a.cc:25:36: error: 'struct Node' has no member named 'l'
   25 |         for (long i = 0, c = T[id].l; c != NIL; i++, c = T[c].r){
      |                                    ^
a.cc:25:63: error: 'struct Node' has no member named 'r'
   25 |         for (long i = 0, c = T[id].l; c != NIL; i++, c = T[c].r){
      |                                                               ^
a.cc: In function 'long int setDepth(long int, long int)':
a.cc:34:19: error: 'struct Node' has no member named 'r'
   34 |         if (T[id].r != NIL) setDepth(T[id].r, p);
      |                   ^
a.cc:34:44: error: 'struct Node' has no member named 'r'
   34 |         if (T[id].r != NIL) setDepth(T[id].r, p);
      |                                            ^
a.cc:34:47: error: 'p' was not declared in this scope
   34 |         if (T[id].r != NIL) setDepth(T[id].r, p);
      |                                               ^
a.cc:35:19: error: 'struct Node' has no member named 'l'
   35 |         if (T[id].l != NIL) setDepth(T[id].l, p + 1);
      |                   ^
a.cc:35:44: error: 'struct Node' has no member named 'l'
   35 |         if (T[id].l != NIL) setDepth(T[id].l, p + 1);
      |                                            ^
a.cc:35:47: error: 'p' was not declared in this scope
   35 |         if (T[id].l != NIL) setDepth(T[id].l, p + 1);
      |                                               ^
a.cc:36:1: warning: no return statement in function returning non-void [-Wreturn-type]
   36 | }
      | ^
a.cc: In function 'int main()':
a.cc:48:43: error: 'struct Node' has no member named 'left'
   48 |                         if (j == 0) T[id].left = child;
      |                                           ^~~~