#K88992. Version Update Aggregation

    ID: 37431 Type: Default 1000ms 256MiB

Version Update Aggregation

Version Update Aggregation

You are given a series of version update operations. The initial version is \(0.0.0\). For each update, the operation is represented as a string in the format +a.b.c, where \(a\), \(b\), and \(c\) are non-negative integers. An update adds its components to the current version component-wise, i.e., the major, minor, and patch numbers are summed separately.

You need to process multiple test cases. For each test case, start from version \(0.0.0\) and apply a list of updates in order. Finally, output the resulting version in the format major.minor.patch.

Note: All numbers are added without any carrying over; they are computed independently.

inputFormat

The input is read from stdin and has the following format:

  • The first line contains an integer \(T\) representing the number of test cases.
  • For each test case:
    • The first line contains an integer \(N\) representing the number of update operations.
    • The next \(N\) lines each contain a string representing an update operation in the format +a.b.c.

It is guaranteed that the input will contain at least one test case and each test case will have at least one update.

outputFormat

For each test case, output the final version after applying all update operations. The output for each test case should be printed on a new line to stdout in the format major.minor.patch.

## sample
2
3
+1.0.0
+0.1.0
+0.0.2
3
+0.0.1
+0.0.1
+0.1.0
1.1.2

0.1.2

</p>