#K9936. Unique Bib Number

    ID: 39140 Type: Default 1000ms 256MiB

Unique Bib Number

Unique Bib Number

You are given a list of registration numbers for participants in a marathon. For each registration number, you need to compute a unique bib number by repeatedly summing its digits until the result is a single digit. Mathematically, this process can be described as follows:

Let \( n \) be a registration number. Calculate \( S(n) \), the sum of the digits of \( n \). If \( S(n) \) has more than one digit, repeat the process on \( S(n) \) until a single digit is obtained. This final single digit is the unique bib number.

For example, given the registration number 9875, the processing is as follows:

\[ 9875 \to 9+8+7+5 = 29 \to 2+9 = 11 \to 1+1 = 2 \]

Your task is to implement this process for a list of registration numbers.

inputFormat

The first line of the input contains an integer \( N \), which is the number of participants. The second line contains \( N \) space-separated integers, each representing a registration number.

outputFormat

Output \( N \) single digit numbers on one line separated by a space. Each number corresponds to the unique bib number of each registration number given in the input.

## sample
4
9875 123 45678 1
2 6 3 1

</p>