#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	vector<int> adjList[n];
	vector<int> visited(n);
	vector<int> child(n,-1);
	queue<int> q;
	for(int i=0;i<n-1;i++){
		int x,y;
		cin>>x>>y;
		adjList[x].push_back(y);
		adjList[y].push_back(x);
	}
	visited[0]=1;
	q.push(0);
	while(!q.empty()){
		int count=0;
		int node=q.front();
		// cout<<node<<" ";
		q.pop();
		for(auto adjNode : adjList[node]){
			if(!visited[adjNode]){
				q.push(adjNode);
				visited[adjNode]=1;
				count++;
			}
		}
		child[node]=count;
	}
	for(int i=0;i<child.size();i++){
		if(child[i]==0)
			cout<<"child of node "<<i<<" : "<<child[i]<<"\n";
		else
			cout<<"node "<<i<<" is a leaf node \n";
	}
	return 0;
}