CF566D Restructuring Company
Description
Even the most successful company can go through a crisis period when you have to make a hard decision — to restructure, discard and merge departments, fire employees and do other unpleasant stuff. Let's consider the following model of a company.
There are $ n $ people working for the Large Software Company. Each person belongs to some department. Initially, each person works on his own project in his own department (thus, each company initially consists of $ n $ departments, one person in each).
However, harsh times have come to the company and the management had to hire a crisis manager who would rebuild the working process in order to boost efficiency. Let's use $ team(person) $ to represent a team where person $ person $ works. A crisis manager can make decisions of two types:
1. Merge departments $ team(x) $ and $ team(y) $ into one large department containing all the employees of $ team(x) $ and $ team(y) $ , where $ x $ and $ y $ ( $ 1
Input Format
N/A
Output Format
N/A