#include <bits/stdc++.h>
using namespace std;
unsigned long long num[400005], rev[400005], fact[400005];
int n, m;
char str[400005], ans[400005];
inline bool chk(int r, int len) {
  int l = r - len + 1;
  if (l < 0) return true;
  return num[r] - (l ? num[l - 1] : 0) !=
         (rev[r] - (l ? rev[l - 1] : 0) * fact[len]) * fact[l];
}
void dfs(int u, bool f = false) {
  if (u >= n) {
    puts(ans);
    exit(0);
  }
  for (ans[u] = (f ? 'a' : str[u]); ans[u] <= 'z'; ans[u]++) {
    num[u] = (u ? num[u - 1] : 0) + fact[u] * (ans[u] - 'a');
    rev[u] = (u ? rev[u - 1] : 0) * 29 + ans[u] - 'a';
    if (chk(u, m) && chk(u, m + 1)) dfs(u + 1, f | (ans[u] > str[u]));
  }
}
int main() {
  scanf("%d%s", &m, str);
  n = strlen(str);
  int idx = n - 1;
  while (str[idx] == 'z') {
    str[idx] = 'a';
    idx--;
  }
  if (idx == -1) {
    puts("Impossible");
    return 0;
  }
  str[idx]++;
  fact[0] = 1;
  for (int i = 1; i < 400005; i++) fact[i] = fact[i - 1] * 29;
  dfs(0);
  puts("Impossible");
  return 0;
}
