Problem: Xavier asks his friend to perform a particular task.The task is to find out the ASCII value of each character of a given STRING and then add them up to find the weight of the given string as 'W',now after finding out the weight his task is to divide the weight of string W with the length of string 'L'such that the final answer is 'F' rounded of to previous integer value in case of float or double value.

Now Xavier introduces a twist in the tail the twist seems to be as follows:-

1.If 'F' is odd then to needs to find out reverse of the given string.For eg:- if 'F'
  is 109 and input string is xyzabc the output must be cbazyx.

2.If 'F' is even then print the original string.

INPUT

First line inputs the no of test cases T.

Second line inputs the string on which the task is to be performed.

OUTPUT

T no of outputs according to the above task.

Constraints

T ≤ 100.
L ≤ 100.

SAMPLE INPUT
1
xyzabc

SAMPLE OUTPUT
cbazyx

Explanation

The input string is "xyzabc"
then,

The ASCII value of x is 120. 

The ASCII value of y is 121.

The ASCII value of z is 122.

The ASCII value of a is 97.

The ASCII value of b is 98.

The ASCII value of c is 99.

W=657.

F=109.

So output="cbazyx".

Solution (in PYTHON):

Solution:
# Read input from stdin and provide input before running code

import string
T = int(raw_input())
for i in xrange(T):
    string = raw_input()
    W = 0
    for letter in  string:
        W+= ord(letter)
    L = len(string)
    F = W/L
    if F%2!=0:
        string = string[::-1]
        print string
    elif F%2 ==0:
        print string