Problem: Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!

Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.

The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.

Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.

Input

The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).

After that, there are two strings s and t, consisting of n lowercase Latin letters each.

Output

If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number  - 1.

Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.

Examples

Input

6
abacbb
babcba


Output

4
6 3 2 3


Input

3
aba
bba


Output

-1

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author khokharnikunj8
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemELockPuzzle solver = new ProblemELockPuzzle();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemELockPuzzle {
        ArrayList<Integer> ans;

        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            char a[] = in.scanChars(n);
            char b[] = in.scanChars(n);
            int temp[] = new int[26];
            for (int i = 0; i < n; i++) temp[(int) a[i] - 97]++;
            for (int i = 0; i < n; i++) temp[(int) b[i] - 97]--;
            for (int i = 0; i < 26; i++)
                if (temp[i] != 0) {
                    out.println(-1);
                    return;
                }
            ans = new ArrayList<>();
            for (int i = n - 1; i >= 0; i--)
                for (int j = (n - i - 1); j < n; j++)
                    if (a[j] == b[i]) {
                        Doit(j, a);
                        break;
                    }
            out.println(ans.size());
            for (int i = 0; i < ans.size(); i++) out.print(ans.get(i) + " ");
        }

        private void Doit(int x, char[] ar) {
            reverse(-1, ar);
            reverse(ar.length - x - 1, ar);
            reverse(ar.length - 2, ar);
        }

        private void reverse(int x, char[] ar) {
            ans.add(ar.length - x - 1);
            ArrayList<Character> arrayList = new ArrayList<>();
            for (int i = x + 1, j = ar.length - 1; i < j; i++, j--) {
                char temp = ar[i];
                ar[i] = ar[j];
                ar[j] = temp;
            }
            for (int i = 0; i <= x; i++) arrayList.add(ar[i]);
            int i;
            for (i = 0; i + x + 1 < ar.length; i++) ar[i] = ar[i + x + 1];
            for (int j = 0; j < arrayList.size(); j++, i++) ar[i] = arrayList.get(j);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        public char[] scanChars(int n) {
            char[] ar = new char[n];
            int c = scan();
            boolean flag = true;
            while (isWhiteSpace(c)) c = scan();
            ar[0] = (char) c;
            for (int i = 1; i < n; i++) ar[i] = (char) (c = scan());
            return ar;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}