beecrowd | 1489

Software Engineering

X Maratona de Programação IME-USP Brasil
Timelimit: 3

Wander Vega is an experienced project manager in a large system development enterprise. He recently read in the renowned scientific journal Best Practices the results of a survey indicating that some aspects of agile development methodologies can be applied in large teams in order to increase productivity. He was surprised to find that one of these aspects is the pair programming, where two developers work together using the same computer. Eager to impose changes that are noted by the directorate, Wander decided to adopt pair programming in the next big project that he will manage. But like any good software engineer, Wander wants to optimize this process. He decided that he will use fixed pairs of developers. Also it will allocate the pairs of programmers beforehand.

But Wander is not willing to take unnecessary risks, and will only allow the composition of pairs of developers that have acceptable levels of productivity, communication and interaction capabilities in joint. If this is not possible, Wander will put his next project's developers your in a warm room, with several snacks, soft drinks and a computer, and apply the techniques of extreme programming in order to make the development of the system viable.

By evaluating his chances he realized that his plan would be reusable in other projects if he had a program to verify the feasibility of pair programming in his company. At that moment he was thinking of you, i.e. the newest intern, to write a program that solves this problem. Wander did a thorough requirements analysis and arrived at the following specification that your program must follow.


The first line of the input contains a number k, which indicates the number of instances. Each instance consists of a line containing an integer 2 ≤ n ≤ 100, the number of professional developers, followed by n lines. The i-th line starts with a number p, indicating the number of people with which i-th programmer productivity is acceptable, and is followed by p integers, each between 1 and n, indicating such partners.


The program should print a line with each instance Instance i, where i is the number of i-th instance. The next line should contain the expression pair programming if what Wander proposed is feasible. Otherwise, print the expression extreme programming. After each instance, your program should print a blank line.

Sample Input Sample Output

3 3 4 6
1 2
1 2
1 2
2 3 4
1 4
2 1 4
3 1 2 3

Instance 1
extreme programming

Instance 2
pair programming