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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline void read(long long &x) {
  char ch;
  bool flag = false;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') flag = true;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  x = flag ? -x : x;
}
inline void read(int &x) {
  char ch;
  bool flag = false;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') flag = true;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  x = flag ? -x : x;
}
inline void write(long long x) {
  static const long long maxlen = 100;
  static char s[maxlen];
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (!x) {
    putchar('0');
    return;
  }
  long long len = 0;
  for (; x; x /= 10) s[len++] = x % 10 + '0';
  for (long long i = len - 1; i >= 0; --i) putchar(s[i]);
}
int n;
char s[210000];
char aim[210000];
int pos[210000];
int num[26][210000], cnt[26];
int tmp[210000];
int sum = 0;
int ans[210000];
void out() {
  for (int i = 0; i < n; i++) printf("%d ", pos[i]);
  puts("");
}
void doit(int x) {
  ans[++sum] = x;
  for (int i = x; i < n; i++) tmp[i - x] = pos[i];
  for (int i = 0; i < x; i++) tmp[i + n - x] = pos[i];
  reverse(tmp, tmp + n - x);
  for (int i = 0; i < n; i++) pos[i] = tmp[i];
}
int main() {
  read(n);
  scanf("%s", s);
  scanf("%s", aim);
  for (int i = 0; i < n; i++) num[aim[i] - 'a'][++cnt[aim[i] - 'a']] = i;
  for (int i = 0; i < n; i++) {
    if (cnt[s[i] - 'a'])
      pos[i] = num[s[i] - 'a'][cnt[s[i] - 'a']--];
    else {
      puts("-1");
      return 0;
    }
  }
  for (int i = 1; i < n; i++)
    if (pos[i] == 0) {
      if (i < n - 1) doit(i + 1);
      doit(n - 1);
    }
  int l = 0, r = 0;
  int op = 1;
  while ((r < n - 1) && (pos[r + 1] == (pos[r] + 1) % n)) r++;
  while (r - l < n - 1) {
    int tmp = -1;
    int pre = pos[r];
    int len = r;
    for (int i = 0; i < n; i++)
      if (pos[i] == (pos[0] + n - op) % n) tmp = i;
    doit(tmp);
    while ((r < n) && (pos[r + 1] == (pos[r] + 1) % n)) r++;
    for (int i = 0; i < n; i++)
      if (pos[i] == pre) r = i;
    if (r != n - 1) doit(r + 1);
    l = n - 1 - len;
    r = n - 1;
    while ((l > 0) && (pos[l - 1] == (pos[l] + n - op) % n)) l--;
    if (l != 0) {
      doit(l);
      op = -op;
    }
    r -= l;
    l = 0;
    while ((r < n - 1) && (pos[r + 1] == (pos[r] + n + op) % n)) r++;
  }
  int tmp = -1;
  int len1, len2;
  for (int i = 0; i < n; i++)
    if (pos[i] == 0) tmp = i;
  if (tmp == 0) {
    if (op == -1) {
      doit(0);
      doit(n - 1);
    }
  } else {
    doit(tmp);
    doit(n - tmp);
    if (op == 1)
      doit(0);
    else
      doit(n - 1);
  }
  printf("%d\n", sum);
  for (int i = 1; i < sum; i++) printf("%d ", n - ans[i]);
  if (sum) printf("%d\n", n - ans[sum]);
  return 0;
}