#include <bits/stdc++.h>
using namespace std;
enum { MAXC = 400010 * 2 };
char str[MAXC], res[MAXC];
int mlen[MAXC];
int M;
char getNxt(const int &mpos, int i, char ch) {
  for (; ch <= 'z'; ++ch) {
    int mcen = mpos, tm = mlen[mcen];
    if (tm * 2 - ((mcen & 1) ^ 1) + 2 < M) break;
    if (!(mcen - i >= 0 && str[mcen - i] == ch)) {
      int ncen;
      for (ncen = mcen + 1; ncen <= (i - 1) * 2 && mcen * 2 - ncen >= 0;
           ncen++) {
        if ((i - 1 - (ncen - 1) / 2) * 2 + 2 < M) break;
        if (mlen[mcen * 2 - ncen] + (ncen - 1) / 2 >= i - 1 && ncen - i >= 0 &&
            str[ncen - i] == ch) {
          tm = min(mlen[mcen * 2 - ncen], i - 1 - (ncen - 1) / 2);
          mcen = ncen;
          break;
        }
      }
      if (mcen != ncen) {
        tm = 0;
        if (str[i - 1] == ch)
          mcen = i * 2 - 1;
        else
          mcen = i * 2;
      }
    }
    if (tm * 2 - ((mcen & 1) ^ 1) + 2 < M) break;
  }
  return ch;
}
void solve(int &mcen, int i, char ch) {
  if (!(mcen - i >= 0 && str[mcen - i] == ch)) {
    int ncen;
    for (ncen = mcen + 1; mcen * 2 - ncen >= 0; ncen++) {
      mlen[ncen] = min(mlen[mcen * 2 - ncen], i - 1 - (ncen - 1) / 2);
      if (mlen[ncen] + (ncen - 1) / 2 == i - 1 && ncen - i >= 0 &&
          str[ncen - i] == ch) {
        mcen = ncen;
        break;
      }
    }
    if (mcen != ncen) {
      mlen[i * 2 - 1] = mlen[i * 2] = 0;
      if (str[i - 1] == ch)
        mcen = i * 2 - 1;
      else
        mcen = i * 2;
    }
  }
  if (mlen[mcen] * 2 - ((mcen & 1) ^ 1) + 2 < M) {
    ++mlen[mcen];
  }
}
int main() {
  scanf("%d", &M);
  scanf("%s", str);
  int n = strlen(str), mpos = 0;
  mlen[mpos] = 0;
  int lsti = 0;
  char ch;
  for (int i = 0; i < n; i++) {
    ch = getNxt(mpos, i, str[i]);
    if (ch > str[i]) {
      if (ch <= 'z') lsti = i;
      break;
    }
    if (getNxt(mpos, i, str[i] + 1) <= 'z') lsti = i;
    solve(mpos, i, ch);
  }
  mpos = 0;
  mlen[mpos] = 0;
  int i;
  for (i = 0; i < lsti; i++) solve(mpos, i, str[i]);
  for (i = lsti; i < n; i++) {
    ch = getNxt(mpos, i, i == lsti ? str[i] + 1 : 'a');
    if (ch > 'z') break;
    solve(mpos, i, str[i] = ch);
  }
  if (i == n) {
    puts(str);
  } else
    puts("Impossible");
  return 0;
}
