#include <bits/stdc++.h>
int inp() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum;
}
char s[400010];
bool used[30];
long long fpow[400010], hsh1[400010], hsh2[400010];
void gethash(int i) {
  hsh2[i] = (hsh2[i - 1] * 27 + (s[i] - 'a' + 1)) % 19260817;
  hsh1[i] = (hsh1[i - 1] + fpow[i - 1] * (s[i] - 'a' + 1)) % 19260817;
}
bool check(int l, int r) {
  long long ls = (hsh1[r] - hsh1[l - 1] + 19260817) % 19260817;
  long long rs =
      (hsh2[r] - (hsh2[l - 1] * fpow[r - l + 1] % 19260817) + 19260817) *
      fpow[l - 1] % 19260817;
  return ls == rs;
}
int main() {
  fpow[0] = 1;
  for (int i = 1; i <= 400000; i++) fpow[i] = fpow[i - 1] * 27 % 19260817;
  int d = inp();
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  bool flg = false;
  int pos = n;
  for (int i = 1; i < d; i++) gethash(i);
  for (int i = d; i <= n; i++) {
    gethash(i);
    if (check(i - d + 1, i) || (i > d && check(i - d, i))) {
      pos = i;
      break;
    }
  }
  for (; pos >= 1; pos--) {
    bool flg = false;
    while (s[pos] < 'z') {
      s[pos]++;
      gethash(pos);
      if (!check(pos - d + 1, pos) && (pos <= d || !check(pos - d, pos))) {
        flg = true;
        break;
      }
    }
    if (flg) break;
  }
  if (pos == 0) {
    printf("Impossible\n");
    return 0;
  }
  for (int i = pos + 1; i <= n; i++) {
    s[i] = 'a' - 1;
    while (s[i] < 'z') {
      s[i]++;
      gethash(i);
      if (!check(i - d + 1, i) && (i <= d || !check(i - d, i))) break;
    }
  }
  printf("%s\n", s + 1);
}
