#include <bits/stdc++.h>
using namespace std;
inline void End() {
  puts("Impossible");
  exit(0);
}
inline int inv(int x) {
  if (x < 2) return x;
  return (long long)1000000007 / x * (1000000007 - inv(1000000007 % x)) %
         1000000007;
}
inline int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = (long long)a * a % m)
    if (b & 1) ans = (long long)ans * a % m;
  return ans;
}
int f[400400] = {1}, rev[400400];
int hh[400400], rh[400400];
char s[400400];
inline int h_calc(int st, int ed) {
  return (hh[ed] - (long long)hh[st] * f[ed - st] % 1000000007 + 1000000007) %
         1000000007;
}
inline int r_calc(int st, int ed) {
  return (long long)(rh[ed] - rh[st] + 1000000007) * rev[st] % 1000000007;
}
int main() {
  int d;
  scanf("%d %s", &d, s + 1);
  if (d == 1) End();
  int n = strlen(s + 1);
  for (int i = 1; i <= n; i++) f[i] = 29LL * f[i - 1] % 1000000007;
  rev[n] = inv(f[n]);
  for (int i = n; i--;) rev[i] = 29LL * rev[i + 1] % 1000000007;
  for (int i = 1, flag = 0; i <= n; i++) {
    if (flag) s[i] = 'a';
    hh[i] = (29LL * hh[i - 1] + s[i] - 'a' + 1) % 1000000007;
    rh[i] = (rh[i - 1] + (long long)f[i - 1] * (s[i] - 'a' + 1)) % 1000000007;
    char st = s[i];
    for (; s[i] <= 'z'; s[i]++) {
      hh[i] = (29LL * hh[i - 1] + s[i] - 'a' + 1) % 1000000007;
      rh[i] = (rh[i - 1] + (long long)f[i - 1] * (s[i] - 'a' + 1)) % 1000000007;
      if (d <= i && h_calc(i - d, i) == r_calc(i - d, i)) continue;
      if (d < i && h_calc(i - d - 1, i) == r_calc(i - d - 1, i)) continue;
      break;
    }
    if (st < s[i] && s[i] <= 'z') flag = 1;
    if (s[i] > 'z' || i == n && !flag) {
      if (flag) End();
      while (1) {
        for (; i >= 1 && s[i] >= 'z'; i--)
          ;
        if (!i) End();
        s[i]++;
        hh[i] = (29LL * hh[i - 1] + s[i] - 'a' + 1) % 1000000007;
        rh[i] =
            (rh[i - 1] + (long long)f[i - 1] * (s[i] - 'a' + 1)) % 1000000007;
        if (d <= i && h_calc(i - d, i) == r_calc(i - d, i)) continue;
        if (d < i && h_calc(i - d - 1, i) == r_calc(i - d - 1, i)) continue;
        break;
      }
      flag = 1;
    }
  }
  puts(s + 1);
}
