#include <numeric>
#include <iostream>
#include <vector>

int main(int argc, const char *argv[])
{
	// Get numbah of nodes
	int num_nodes;
	std::cin >> num_nodes;

	// These will be initialized with 0
	std::vector<int> adj_matrix(num_nodes * num_nodes);

	while(true) {
		// Track the beginning and end of each edge
		int begin, end;
		if (!(std::cin >> begin >> end)){
			break;
		}
		
		// We use 0 based indexes, they use 1 based
		begin--;
		end--;

		// Store them in our adjacency matrix
		adj_matrix[begin*num_nodes + end] = 1;
		adj_matrix[end*num_nodes + begin] = 1;
	}

	// Generate degree from adj_matrix
	for(int i = 0; i < num_nodes; ++i) {
		int degrees = std::accumulate(adj_matrix.cbegin() + i*num_nodes,
				adj_matrix.cbegin() + (i+1)*num_nodes,
				0);

		std::cout << "Node " 
			<< i+1 
			<< " has a degree of " 
			<< degrees 
			<< std::endl;
	}

	// Print result
	for(const auto &elem : adj_matrix) {
		auto i = &elem - &adj_matrix[0];
		std::cout << elem << " ";
		if (i % num_nodes == num_nodes - 1) {
			std::cout << std::endl;
		}
	}

	return 0;
}