#ABC284F. [ABC284F] ABCBAC

[ABC284F] ABCBAC

Score : 500500 points

Problem Statement

For a string SS of length NN and an integer i (0iN)i\ (0\leq i\leq N), let us define the string fi(S)f_i(S) as the concatenation of:

  • the first ii characters of SS,
  • the reversal of SS, and
  • the last (Ni)(N-i) characters of SS,

in this order. For instance, if S=S= abc and i=2i=2, we have fi(S)=f_i(S)= abcbac.

You are given a string TT of length 2N2N. Find a pair of a string SS of length NN and an integer i (0iN)i\ (0\leq i\leq N) such that fi(S)=Tf_i(S)=T. If no such pair of SS and ii exists, report that fact.

Constraints

  • 1N1061\leq N \leq 10^6
  • NN is an integer.
  • TT is a string of length 2N2N consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

NN

TT

Output

If no pair of SS and ii satisfies the condition, print -1. Otherwise, print SS and ii, separated by a newline. If multiple pairs of SS and ii satisfy the condition, you may print any of them.

3
abcbac
abc
2

As mentioned in the problem statement, if S=S= abc and i=2i=2, we have fi(S)=f_i(S)= abcbac, which equals TT, so you should print abc and 22.

4
abababab
abab
1

S=S= abab and i=3i=3 also satisfy the condition.

3
agccga
cga
0

S=S= agc and i=3i=3 also satisfy the condition.

4
atcodeer
-1

If no pair of SS and ii satisfies the condition, print -1.