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.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {

	static boolean[] isPrime;
	static ArrayList<Integer> primes;
	static int[] pri;

	static void sieve(int N) {
		isPrime = new boolean[N + 1];
		Arrays.fill(isPrime, true);
		isPrime[0] = false;
		isPrime[1] = false;
		for (int i = 2; i * i <= N; i++) {
			if (isPrime[i]) {
				for (int j = i * i; j <= N; j += i) {
					isPrime[j] = false;
				}
			}
		}
		for (int i = 2; i < isPrime.length; i++) {
			if (isPrime[i])
				primes.add(i);
		}
		pri = new int[primes.size()];
		for (int i = 0; i < pri.length; i++) {
			pri[i] = primes.get(i);
		}
	}

	static int help(int n) {
		int k = n;
		int c = 0;
		if (isPrime[n])
			return 1;
		else {
			for (int i = 0; i < primes.size() && pri[i] * pri[i] <= k; i++) {
				int p = pri[i];
				if (n % p == 0) {
					c = 1 + cum[n / p] - cum[n / p - 1];
				}
			}
			return c;
		}
	}

	// static void printPFsInPairs(int n) {
	// int k = n;
	// for (int i = 0; i < primes.size() && primes.get(i) <= k; i++) {
	// int p = primes.get(i);
	// int c = 0;
	// while (k % p == 0) {
	// k /= p;
	// c++;
	// }
	// if (c != 0) {
	// r.add(p);
	// r.add(c);
	// }
	// }
	// if (k != 1) {
	// r.add(k);
	// r.add(1);
	// }
	// }
	static long power(long x, Long y) {
		if (y == 0)
			return 1;
		else {
			long b = power(x, y / 2);
			if (y % 2 == 0)
				return b * b;
			else
				return b * b * x;
		}
	}

	static int[] cum;

	static int log(int n) {
		int c = 0;
		for (int i = 1; i < n; i *= 2) {
			c++;
		}
		return c;
	}

	static class SegmentTree { // 1-based DS, OOP

		int N; // the number of elements in the array as a power of 2 (i.e. after padding)
		int[] array, sTree, lazy;

		SegmentTree(int[] in) {
			array = in;
			N = in.length - 1;
			sTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero
			lazy = new int[N << 1];
			build(1, 1, N);
		}

		void build(int node, int b, int e) // O(n)
		{
			if (b == e)
				sTree[node] = array[b];
			else {
				int mid = b + e >> 1;
				build(node << 1, b, mid);
				build(node << 1 | 1, mid + 1, e);
				sTree[node] = sTree[node << 1] + sTree[node << 1 | 1];
			}
		}

		void update_point(int index, int val) // O(log n)
		{
			index += N - 1;
			sTree[index] += val;
			while (index > 1) {
				index >>= 1;
				sTree[index] = sTree[index << 1] + sTree[index << 1 | 1];
			}
		}

		void update_range(int i, int j, int val) // O(log n)
		{
			update_range(1, 1, N, i, j, val);
		}

		void update_range(int node, int b, int e, int i, int j, int val) {
			if (i > e || j < b)
				return;
			if (b >= i && e <= j) {
				sTree[node] += (e - b + 1) * val;
				lazy[node] += val;
			} else {
				int mid = b + e >> 1;
				propagate(node, b, mid, e);
				update_range(node << 1, b, mid, i, j, val);
				update_range(node << 1 | 1, mid + 1, e, i, j, val);
				sTree[node] = sTree[node << 1] + sTree[node << 1 | 1];
			}

		}

		void propagate(int node, int b, int mid, int e) {
			lazy[node << 1] += lazy[node];
			lazy[node << 1 | 1] += lazy[node];
			sTree[node << 1] += (mid - b + 1) * lazy[node];
			sTree[node << 1 | 1] += (e - mid) * lazy[node];
			lazy[node] = 0;
		}

		int query(int i, int j) {
			return query(1, 1, N, i, j);
		}

		int query(int node, int b, int e, int i, int j) // O(log n)
		{
			if (i > e || j < b)
				return 0;
			if (b >= i && e <= j)
				return sTree[node];
			int mid = b + e >> 1;
			propagate(node, b, mid, e);
			int q1 = query(node << 1, b, mid, i, j);
			int q2 = query(node << 1 | 1, mid + 1, e, i, j);
			return q1 + q2;

		}

	}

	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		char[] t = sc.next().toCharArray();
		char[] s = sc.next().toCharArray();
		ArrayList<Integer> r = new ArrayList<>();
		int c = 0;
		for (int i = 0; i < n - 1; i++) {
			if (s[i] != t[i]) {
				int j = i + 1;
				while (j < n && t[j] != s[i]) {
					j++;
				}
				if (j == n) {
					pw.println(-1);
					pw.flush();
					return;
				}
				while (j != i) {
					c++;
					r.add(j);
					char te = t[j];
					t[j] = t[j - 1];
					t[j - 1] = te;
					j--;
				}
			}
		}
		if (s[n - 1] == t[n - 1]) {
			pw.println(c);
			for (int i = 0; i < r.size(); i++) {
				pw.print(r.get(i) + " ");
			}
		} else
			pw.println(-1);
		pw.flush();

	}
}

class pair {
	int x;
	int y;

	public pair(int d, int u) {
		x = d;
		y = u;
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////////

class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s) {
		br = new BufferedReader(new InputStreamReader(s));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public double nextDouble() throws IOException {
		String x = next();
		StringBuilder sb = new StringBuilder("0");
		double res = 0, f = 1;
		boolean dec = false, neg = false;
		int start = 0;
		if (x.charAt(0) == '-') {
			neg = true;
			start++;
		}
		for (int i = start; i < x.length(); i++)
			if (x.charAt(i) == '.') {
				res = Long.parseLong(sb.toString());
				sb = new StringBuilder("0");
				dec = true;
			} else {
				sb.append(x.charAt(i));
				if (dec)
					f *= 10;
			}
		res += Long.parseLong(sb.toString()) / f;
		return res * (neg ? -1 : 1);
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

}