#UnknownID16. JIXMPII57IFY100#*':

JIXMPII57IFY100#*':

Statement

For a string p p , let f(p) f(p) be the number of distinct non-empty substrings ^{\text{∗}} of p p .

Shohag has a string s s . Help him find a non-empty string p p such that p p is a substring of s s and f(p) f(p) is even or state that no such string exists.

^{\text{∗}} A string a a is a substring of a string b b if a a can be obtained from b b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.

Format

Input

The first line contains a single integer t t ( 1t104 1 \le t \le 10^4 ) — the number of test cases.

The first and only line of each test case contains a string s s ( 1s105 1 \le |s| \le 10^5 ) consisting of lowercase English letters.

It is guaranteed that the sum of the length of s s over all test cases doesn't exceed 3105 3 \cdot 10^5 .

Output

For each test case, print a non-empty string that satisfies the conditions mentioned in the statement, or 1 -1 if no such string exists. If there are multiple solutions, output any.

Sample

5
dcabaac
a
youknowwho
codeforces
bangladesh
abaa
-1
youknowwho
eforce
bang