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>
template <typename T>
void MACRO_VAR_Scan(T& t) {
  std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First& first, Rest&... rest) {
  std::cin >> first;
  MACRO_VAR_Scan(rest...);
}
template <typename T>
void MACRO_VEC_ROW_Init(int n, T& t) {
  t.resize(n);
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Init(int n, First& first, Rest&... rest) {
  first.resize(n);
  MACRO_VEC_ROW_Init(n, rest...);
}
template <typename T>
void MACRO_VEC_ROW_Scan(int p, T& t) {
  std::cin >> t[p];
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Scan(int p, First& first, Rest&... rest) {
  std::cin >> first[p];
  MACRO_VEC_ROW_Scan(p, rest...);
}
template <typename T>
inline T CHMAX(T& a, const T b) {
  return a = (a < b) ? b : a;
}
template <typename T>
inline T CHMIN(T& a, const T b) {
  return a = (a > b) ? b : a;
}
void CHECKTIME(std::function<void()> f) {
  auto start = std::chrono::system_clock::now();
  f();
  auto end = std::chrono::system_clock::now();
  auto res = std::chrono::duration_cast<std::chrono::nanoseconds>((end - start))
                 .count();
  std::cerr << "[Time:" << res << "ns  (" << res / (1.0e9) << "s)]\n";
}
template <class T>
std::vector<std::vector<T>> VV(int n, int m, T init = T()) {
  return std::vector<std::vector<T>>(n, std::vector<T>(m, init));
}
template <typename S, typename T>
std::ostream& operator<<(std::ostream& os, std::pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using PAIR = std::pair<ll, ll>;
using PAIRLL = std::pair<ll, ll>;
constexpr ll INFINT = 1 << 30;
constexpr ll INFINT_LIM = (1LL << 31) - 1;
constexpr ll INFLL = 1LL << 60;
constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62);
constexpr double EPS = 1e-9;
constexpr ll MOD = 1000000007;
constexpr double PI = 3.141592653589793238462643383279;
template <class T, size_t N>
void FILL(T (&a)[N], const T& val) {
  for (auto& x : a) x = val;
}
template <class ARY, size_t N, size_t M, class T>
void FILL(ARY (&a)[N][M], const T& val) {
  for (auto& b : a) FILL(b, val);
}
template <class T>
void FILL(std::vector<T>& a, const T& val) {
  for (auto& x : a) x = val;
}
template <class ARY, class T>
void FILL(std::vector<std::vector<ARY>>& a, const T& val) {
  for (auto& b : a) FILL(b, val);
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  ll n;
  MACRO_VAR_Scan(n);
  ;
  std::string s, t;
  MACRO_VAR_Scan(s, t);
  ;
  std::vector<ll> cnt(26, 0);
  for (ll i = 0; i < ll(n); ++i) ++cnt[s[i] - 'a'], --cnt[t[i] - 'a'];
  for (ll i = 0; i < ll(26); ++i) {
    if (cnt[i] != 0) {
      std::cout << (-1);
      std::cout << "\n";
      ;
      return 0;
    }
  }
  std::vector<ll> ans;
  auto shift = [&](std::string& s, ll x) {
    ans.emplace_back(x);
    std::string ss(s.substr(s.size() - x));
    for (ll i = ll(s.size() - x) - 1; i >= 0; --i) {
      s[i + x] = s[i];
    }
    for (ll i = 0; i < ll(x); ++i) {
      s[x - i - 1] = ss[i];
    }
  };
  if (n == 1) {
    std::cout << (0);
    std::cout << "\n";
    ;
    return 0;
  } else if (n == 2) {
    if (s[0] == t[0]) {
      std::cout << (0);
      std::cout << "\n";
      ;
    } else {
      std::cout << (1);
      std::cout << "\n";
      ;
      std::cout << (n);
      std::cout << "\n";
      ;
    }
    return 0;
  }
  ll l = n / 2 - 1, r = n / 2 - 1;
  while (l >= 0 && r <= n) {
    ll c = t[l];
    ll i = n - 1;
    for (;; --i) {
      if (s[i] == c) break;
    }
    shift(s, n - i);
    shift(s, n - (r - l) - (n - i));
    ++r;
    c = t[r];
    i = 0;
    for (;; ++i) {
      if (s[i] == c) break;
    }
    shift(s, n - i - 1);
    shift(s, 1);
    shift(s, n - ((r - l) + 1));
    shift(s, (r - l) + 1);
    --l;
  }
  std::cout << (ans.size());
  std::cout << "\n";
  ;
  for (ll i = 0; i < ll(ans.size()); ++i) {
    std::cout << (ans[i]);
    std::cout << (i + 1 == ans.size() ? '\n' : ' ');
    ;
  }
  return 0;
}