You are given a string $s$ consisting only of lowercase Latin letters.

You can rearrange all letters of this string as you wish. Your task is to obtain a good string by rearranging the letters of the given string or report that it is impossible to do it.

Let's call a string good if it is not a palindrome. Palindrome is a string which is read from left to right the same as from right to left. For example, strings "abacaba", "aa" and "z" are palindromes and strings "bba", "xd" are not.

You have to answer $t$ independent queries.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 100$) — number of queries.

Each of the next $t$ lines contains one string. The $i$-th line contains a string $s_i$ consisting only of lowercase Latin letter. It is guaranteed that the length of $s_i$ is from $1$ to $1000$ (inclusive).


-----Output-----

Print $t$ lines. In the $i$-th line print the answer to the $i$-th query: -1 if it is impossible to obtain a good string by rearranging the letters of $s_i$ and any good string which can be obtained from the given one (by rearranging the letters) otherwise.


-----Example-----
Input
3
aa
abacaba
xdd

Output
-1
abaacba
xdd


-----Note-----

In the first query we cannot rearrange letters to obtain a good string.

Other examples (not all) of correct answers to the second query: "ababaca", "abcabaa", "baacaba".

In the third query we can do nothing to obtain a good string.

Difficulty: interview

Starter code:

Solutions:
# map(int, input())
t = int(input())
for i in range(t):
	s = sorted(input())
	if s[0] == s[-1]:
		print(-1)
		continue
	print(''.join(s))

import math, sys

def mp():
    return list(map(int, input().split()))

def main():
    n = int(input())
    for i in range(n):
        a = list(input().strip())
        a.sort()
        if a[0] == a[-1]:
            print(-1)
        else:
            print(''.join(a))
        
deb = 0
if deb:
    file = open('input.txt', 'w')
else:
    input = sys.stdin.readline
    
main()

for _ in range(int(input())):
	s = ''.join(sorted(input()))
	if s[0] == s[-1]:
		print('-1')
	else:
		print(s)


def mi():
	return list(map(int, input().split()))
'''
3
aa
abacaba
xdd
'''
from collections import Counter as c
for _ in range(int(input())):
	li = list(input())
	s = c(li)
	if len(s)==1:
		print(-1)
	else:
		print(''.join(sorted(li)))


read = lambda: [int(i) for i in input().split()]

t = int(input())
while t > 0:
    t -= 1
    s = input()
    s_sort = sorted(s)
    if s_sort[0] == s_sort[-1]:
        print(-1)
    else:
        print(''.join(s_sort))

t = int(input())
for i in range(t):
    s = input()
    if s != s[0] * len(s):
        print(''.join(sorted(s)))
    else:
        print(-1)

def solve(s):
	s = "".join(sorted(s))
	if s==s[::-1]:
		return -1
	else:
		return s

t = int(input())
for _ in range(t):
	x = input()
	print(solve(x))

n = int(input())

for i in range(n):
  s = input()

  arr = sorted(s)

  if (arr[0] == arr[-1]):
    print(-1)
  else:
    print(''.join(arr))



#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operatins###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###

 
 
##### Main ####
t=int(input())
for tt in range(t):
    s=str(input())
    s=list(s)
    s.sort()
    if(s==s[::-1]):
        print(-1)
    else:
        b=""
        for ss in s:
            b+=ss
        print(b)
        
    #a=list(map(int,sys.stdin.readline().split(' ')))
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

n=int(input())
for x in range(n):
    s=input()
    s=''.join(sorted(list(s)))
    if(s==s[::-1]):
        print(-1)
    else:
        print(s)

t=int(input())
for i in range(t):
    s=list(input())
    if len(set(s))==1:print(-1)
    else:
        s.sort()
        a=''
        for i in s:a+=i
        print(a)


# -*- coding: utf-8 -*-

import math
import collections
import bisect
import heapq
import time
import itertools
import sys

"""
created by shhuan at 2018/12/15 22:40

"""


def check(val):
    l, r = 0, len(val)-1

    while l < r:
        if val[l] != val[r]:
            return True
        l += 1
        r -= 1

    return False

T = int(input())
for ti in range(T):
    s = list(input())
    s.sort()
    if check(s):
        print(''.join(s))
    else:
        print(-1)

import sys
from math import ceil, floor

input = sys.stdin.readline

t = int(input())
for zzz in range(t):
    s = list(input().strip())
    s.sort()
    i = 0
    j = len(s) - 1
    valid = True
    while (i <= j):
        if s[i] != s[j]:
            valid = False
            break
        i += 1
        j -= 1
    if not valid:
        print(''.join([str(x) for x in s]))
    else:
        print(-1)

t = int(input())
for q in range(t):
    s = sorted(list(input()))
    if s[0] == s[-1]:
        print(-1)
    else:
        print(*s, sep='')


#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        #print(*args, **kwargs, file=sys.stderr)
        # in python 3.4 **kwargs is invalid???
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') #标准输出重定向至文件
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') #标准输出重定向至文件
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
N, = getIntList()
#print(N)

for _ in range(N):
    s = input()
    c = s[0]
    ok = False
    for x in s:
        if x!=c:
            g = list(s)
            g.sort()
            s = ''.join(g)
            print(s)
            ok = True
            break
    if not ok:
        print(-1)




n = int(input())
for i in range(n):
    d = input()
    u = sorted(d)
    if u == u[::-1]:
        print(-1)
    else:
        print("".join(u))

n = int(input())
for i in range(n):
    s = input()
    se = set()
    a = []
    for j in s:
        se.add(j)
        a.append(j)
    if len(se) == 1:
        print(-1)
    else:
        a.sort()
        for j in a:
            print(j, end = '')
        print()


t = int(input())
for i in range(t):
    s = input()
    r = ''.join(sorted(list(s)))
    if r[0] == r[-1]:
        print(-1)
    else:
        print(r)



t=int(input())
A=[input() for i in range(t)]


for a in A:
    ANS=sorted(list(a))

    if ANS[0]==ANS[-1]:
        print(-1)
        continue

    else:
        for a in ANS:
            print(a,end="")

        print()