#K93877. Unique Sorted Ingredients

    ID: 38517 Type: Default 1000ms 256MiB

Unique Sorted Ingredients

Unique Sorted Ingredients

Given a number of recipes, each consisting of a space-separated list of ingredients, your task is to determine the set of unique ingredients present in all recipes and output them in alphabetical order.

The problem requires you to consider all ingredients from the input recipes, remove duplicates, sort the ingredients lexicographically (from A to Z) and then output them as a single space-separated string. For example, if the recipes are "flour sugar eggs" and "eggs milk butter", the unique ingredients sorted alphabetically are "butter eggs flour milk sugar".

If there are no recipes, simply output an empty string.

Note: All input is read from standard input (stdin) and all output is written to standard output (stdout).

inputFormat

The first line contains a single integer T (T ≥ 0) representing the number of recipes. Each of the following T lines contains a recipe. A recipe consists of a space-separated list of ingredients.

Input is provided via stdin.

outputFormat

Output a single line containing the unique ingredients sorted in alphabetical order and separated by a single space. If there are no ingredients, output an empty string.

Output should be printed to stdout.

## sample
4
flour sugar eggs
eggs milk butter
sugar milk
salt flour
butter eggs flour milk salt sugar