You are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.

You can successively perform the following move any number of times (possibly, zero):

  * swap any two adjacent (neighboring) characters of s (i.e. for any i = \{1, 2, ..., n - 1\} you can swap s_i and s_{i + 1}). 



You can't apply a move to the string t. The moves are applied to the string s one after another.

Your task is to obtain the string t from the string s. Find any way to do it with at most 10^4 such moves.

You do not have to minimize the number of moves, just find any sequence of moves of length 10^4 or less to transform s into t.

Input

The first line of the input contains one integer n (1 ≤ n ≤ 50) — the length of strings s and t.

The second line of the input contains the string s consisting of n lowercase Latin letters.

The third line of the input contains the string t consisting of n lowercase Latin letters.

Output

If it is impossible to obtain the string t using moves, print "-1".

Otherwise in the first line print one integer k — the number of moves to transform s to t. Note that k must be an integer number between 0 and 10^4 inclusive.

In the second line print k integers c_j (1 ≤ c_j < n), where c_j means that on the j-th move you swap characters s_{c_j} and s_{c_j + 1}.

If you do not need to apply any moves, print a single integer 0 in the first line and either leave the second line empty or do not print it at all.

Examples

Input

6
abcdef
abdfec


Output

4
3 5 4 5 


Input

4
abcd
accd


Output

-1

Note

In the first example the string s changes as follows: "abcdef" → "abdcef" → "abdcfe" → "abdfce" → "abdfec".

In the second example there is no way to transform the string s into the string t through any allowed moves.
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author wilso
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class codeforces {
    static final long MOD2 = 998_244_353;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
       
        int tc = 1;
        for (int rep = 0; rep < tc; rep++) {
            int N = sc.ni();
            String s = sc.next();
            String t = sc.next();
            int[] f1 = new int[26];
            int[] f2 = new int[26];
            char[] a = s.toCharArray();
            char[] b = t.toCharArray();
            for (int i = 0; i < N; i++) {
                f1[s.charAt(i) - 'a']++;
                f2[t.charAt(i) - 'a']++;
            }
            boolean bad = false;
            for (int aa = 0; aa < 26; aa++) {
                if (f1[aa] != f2[aa]) {
                    bad = true;
                    break;
                }
            }
            if (bad) pw.println(-1);
            StringBuilder sb = new StringBuilder();
            if (!bad) {
                int i = 0;
                int ct = 0;
                for (int j = 0; j < N; j++) {
                    if (a[j] == b[j]) continue;
                    else {
                        int idx = -1;
                        for (i = j+1; i < N; i++) {
                            if (a[i] == b[j]) {
                                idx = i;
                                break;
                            }
                        }
                        for (i = idx-1; i >= j; i--) {
                            char temp = a[i+1];
                            a[i+1] = a[i];
                            a[i] = temp;
                            sb.append((i+1) + " ");
                            ct++;
                        }
                    }
                }
                pw.println(ct);
                pw.println(sb.toString());
            }
        }
        
        pw.close();
    }
    
    
    static String solve(int n, int t, int k, int[] arr) {
        int ret = n-t;
        if (k > ret) return "-1";
        int[] ref = new int[n];
        int parent = 0;
        int idx = 1;
        for (int i = 0; i < t; i++) {
            int pos = idx;
            for (int j = 0; j < arr[i]; j++) {
                ref[idx] = parent;
                if (ret > k && parent < pos-1) {
                    parent++;
                    if (j+1 < arr[i]) ret--;
                }
                idx++;
            }
            parent = pos;
        }
        if (ret == k) {
            StringBuilder sb = new StringBuilder();
            sb.append(n);
            sb.append("\n");
            for (int i = 1; i < n; i++) {
                sb.append((i+1) + " " + (ref[i] + 1));
//                sb.append(i + " " + ref[i]);
                sb.append("\n");
            }
            return sb.toString();
        }
        else {
            return "-1";
        }
    }
 
    static int summation(int x) {
        return x * (x+1) / 2;
    }  
    static long pow(long num, long exp, long mod){
        long ans=1;
        for(int i=1;i<=exp;i++){
            ans=(ans*num)%mod;
        }
        return ans;
    }
    static boolean isPrime(int n)
    {
 
        if (n <= 1)
            return false;
        else if (n == 2)
            return true;
        else if (n % 2 == 0)
            return false;
        for (int i = 3; i <= Math.sqrt(n); i += 2) {
            if (n % i == 0)
                return false;
        }
        return true;
    }
    static int gcd(int a, int b)
    {
        if (a == 0)
            return b; 
        return gcd(b % a, a); 
    }
    static long gcd(long a, long b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }
    static int lcm(int a, int b)
    {
        return (a / gcd(a, b)) * b;
    }
    public static void sort(int[] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            int temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr);
    }
    public static void sort(long[] arr) {
        Random rgen = new Random();
        for (int i = 0; i < arr.length; i++) {
            int r = rgen.nextInt(arr.length);
            long temp = arr[i];
            arr[i] = arr[r];
            arr[r] = temp;
        }
        Arrays.sort(arr);
    }
    static int charint(char c) {
        return Integer.parseInt(String.valueOf(c));
    }
    
    /* */
    //printing methods
    /* */
    //WOW!
    /* */
    public static void printArr(PrintWriter pw, int[] arr) {
        StringBuilder sb = new StringBuilder();
        for (int x : arr) {
            sb.append(x + "");
        }
        sb.setLength(sb.length() - 1);
        pw.println(sb.toString());
    }
    public static void printArr2d(PrintWriter pw, int[][] arr) {
        StringBuilder sb = new StringBuilder();
        for (int[] row : arr) {
            for (int x : row) {
                sb.append(x + " ");
            }
            sb.setLength(sb.length() - 1);
            sb.append("\n");
        }
        pw.println(sb.toString());
    }
}

class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner() {
        br = new BufferedReader(new InputStreamReader(System.in), 32768);
        st = null;
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
                
            }
        }
        return st.nextToken();
    }

    int ni() {
        return Integer.parseInt(next());
    }

    int[] intArray(int N) {
        int[] ret = new int[N];
        for (int i = 0; i < N; i++)
            ret[i] = ni();
        return ret;
    }

    long nl() {
        return Long.parseLong(next());
    }

    long[] longArray(int N) {
        long[] ret = new long[N];
        for (int i = 0; i < N; i++)
            ret[i] = nl();
        return ret;
    }

    double nd() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

class MultiSet {
    TreeMap<Long, Integer> map = new TreeMap<>();
    private int size = 0;
    public MultiSet() {
    }
    public void add(Long val) {
        map.put(val, map.getOrDefault(val, 0) + 1);
        size++;
    }
    public void remove(Long val) {
        map.put(val, map.get(val) - 1);
        if (map.get(val) == 0) {
            map.remove(val);
        }
        size--;
    }
    public int size() {
        return size;
    }
    public Long higher(Long val) {
        return map.higherKey(val);
    }
    public Long lower(Long val) {
        return map.lowerKey(val);
    }
    public Long ceiling(Long val) {
        return map.ceilingKey(val);
    }
    public Long floor(Long val) {
        return map.floorKey(val);
    }
    public Long first() {
        return map.firstKey();
    }
    public Long last() {
        return map.lastKey();
    }
    public boolean isEmpty() {
        return map.isEmpty();
    }
}
