Gossip

Write a program to maintain basic information for the gossip magazines: who is a couple of who. There are two kinds of orders: “info” and “affairxx yy. The first asks for a list of all the information at that moment. The second indicates that xx and yy are a couple now. If some person zz was a couple of xx or a couple of yy, then zz becomes single.

Input

Input consists of several orders. For every “affairxx yy order, both xx and yy are words made up of only lowercase letters, such that xx and yy are different, and such that xx and yy do not have an affair at that moment.

Output

Print as many lists as “info” orders, finishing each with a line with 10 dashes. Print the couples in alphabetical order, and also the couples among them. Print the alone people in alphabetical order as well.

Observation

In the private test cases, most orders are of the “affair” kind.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T11:24:28.578Z

© Jutge.org, 2006–2026.
https://jutge.org