#C4572. Skyline Silhouette

    ID: 48125 Type: Default 1000ms 256MiB

Skyline Silhouette

Skyline Silhouette

You are given N skyscrapers. Each skyscraper is represented by a list of non-negative integers indicating its height at different horizontal positions. The goal is to compute the overall skyline silhouette of these skyscrapers.

The skyline silhouette is defined as the maximum height at each horizontal position among all skyscrapers. If a skyscraper does not extend to a certain position, it is ignored for that position.


Input/Output Format:

The input is read from standard input (stdin) and the output should be written to standard output (stdout). See the input and output descriptions below for details.


Example:

For example, if the input is:

3
3 0 3 2
4 1 1
2 3 2 1

Then the skyline silhouette is:

4 3 3 2

inputFormat

The first line of input contains a single integer N (N ≥ 0), which is the number of skyscrapers.

Each of the following N lines contains several space-separated integers. Each line represents the heights of a skyscraper at consecutive horizontal positions. There is no extra information given about the number of integers per line.

outputFormat

Output the skyline silhouette as a sequence of space-separated integers on a single line. Each integer represents the maximum height at that horizontal position among all skyscrapers.

## sample
3
3 0 3 2
4 1 1
2 3 2 1
4 3 3 2