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;
const long long INF = 1e18 + 1;
const int MAX = 200001;
struct trio {
  int first;
  int second;
  int third;
};
struct long_trio {
  long long first;
  long long second;
  long long third;
};
double dist_point_line(int x1, int y1, int x2, int y2, int x3, int y3) {
  double distance = abs((y3 - y1) * x2 - (x3 - x1) * y2 + x3 * y1 - x1 * y3) /
                    (2 * sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)));
  return distance;
}
double dist_point_point(int x1, int y1, int x2, int y2) {
  double distance = sqrt((x1 - y1) * (x1 - y1) + (x2 - y2) * (x2 - y2));
  return distance;
}
double inq(double k, int q) {
  if (q == 0) return 1;
  double l = inq(k, q / 2);
  if (q % 2 == 0)
    return l * l;
  else
    return l * l * k;
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long cubr(long long a) {
  long long l = -1, r = 1e6 + 2;
  while (l < r - 1) {
    long long mid = (l + r) / 2;
    if (mid * mid * mid > a)
      r = mid;
    else
      l = mid;
  }
  return l;
}
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) { return -1 * max(-a, -b); }
long long possible(long long q) {
  if (q == INF) return -1;
  return q;
}
string months[12] = {"January",   "February", "March",    "April",
                     "May",       "June",     "July",     "August",
                     "September", "October",  "November", "December"};
int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
long long fact[13] = {1,    1,     2,      6,       24,       120,      720,
                      5040, 40320, 362280, 3622800, 39916800, 479001600};
int cx[6] = {1, -1, 0, 0, 0, 0};
int cy[6] = {0, 0, 1, -1, 0, 0};
int cz[6] = {0, 0, 0, 0, 1, -1};
long long n, m, ans1, ans2, k;
string s1, s2;
int arr[MAX], b[MAX], c[MAX];
vector<int> ans;
void shift(int x) {
  ans.push_back(x);
  int ind = 0;
  for (int i = 0; i < x; i++) {
    b[ind] = arr[n - i - 1];
    ind++;
  }
  for (int i = 0; i < n - x; i++) {
    b[ind] = arr[i];
    ind++;
  }
  for (int(i) = 0; (i) != (n); i++) {
    arr[i] = b[i];
  }
}
int main() {
  cin >> n >> s1 >> s2;
  int search = 0;
  int q = n / 2 - 1;
  int high = n / 2 + 1;
  int low = n / 2;
  c[0] = n / 2;
  c[1] = n / 2 + 1;
  for (int i = 2; i < n; i++) {
    c[i] = q;
    if (q < low) {
      low--;
      q = high + 1;
    } else {
      high++;
      q = low - 1;
    }
  }
  set<int> letters[404];
  k = 1;
  for (int i = 0; i < n; i++) {
    letters[s2[i] - 'a'].insert(k);
    k++;
  }
  for (int i = 0; i < n; i++) {
    if (letters[s1[i] - 'a'].size() != 0) {
      arr[i] = *(letters[s1[i] - 'a'].begin());
      letters[s1[i] - 'a'].erase(letters[s1[i] - 'a'].begin());
    } else {
      cout << "-1";
      return 0;
    }
  }
  for (int(i) = 0; (i) != (n); i++) {
    if (arr[i] == c[search]) {
      shift(n - i - 1);
      shift(n);
      search++;
      break;
    }
  }
  for (search = 1; search < n; search++) {
    for (int(i) = 0; (i) != (n); i++) {
      if (arr[i] == c[search]) {
        shift(n - i - 1);
        shift(n - (n - i - 1) - search);
        shift(search);
        break;
      }
    }
  }
  if (arr[0] == n) shift(n);
  cout << ans.size() << endl;
  for (int(i) = 0; (i) != (ans.size()); i++) {
    cout << ans[i] << " ";
  }
}