#include <bits/stdc++.h>
using namespace std;
int d, n;
string s;
vector<int> d1, d2;
int mx[400005];
int upto[400005];
long long pw[400005];
long long inv_pw[400005];
long long fhash[400005], bhash[400005];
bool can_be[400005];
long long bigmod(int a, int n) {
  if (n == 0) return 1;
  long long ans = bigmod(a, n / 2);
  ans = (ans * ans) % 1000000007;
  if (n & 1) {
    ans = (ans * a) % 1000000007;
  }
  return ans;
}
void manachar() {
  d1.resize(n);
  for (int i = 0, l = 0, r = -1; i < n; i++) {
    int k = (i > r) ? 1 : min(d1[l + r - i], r - i + 1);
    while (0 <= i - k && i + k < n && s[i - k] == s[i + k]) {
      k++;
    }
    d1[i] = k--;
    if (i + k > r) {
      l = i - k;
      r = i + k;
    }
  }
  d2.resize(n);
  for (int i = 0, l = 0, r = -1; i < n; i++) {
    int k = (i > r) ? 0 : min(d2[l + r - i + 1], r - i + 1);
    while (0 <= i - k - 1 && i + k < n && s[i - k - 1] == s[i + k]) {
      k++;
    }
    d2[i] = k--;
    if (i + k > r) {
      l = i - k - 1;
      r = i + k;
    }
  }
  for (int i = 0; i < n; i++) {
    int r = i + d1[i] - 1;
    int sz = d1[i] * 2 - 1;
    mx[r] = max(mx[r], sz);
  }
  for (int i = 0; i < n; i++) {
    int r = i + d2[i] - 1;
    int sz = d2[i] * 2;
    mx[r] = max(mx[r], sz);
  }
  int last = 0;
  for (int i = n - 1; i >= 0; i--) {
    mx[i] = max(mx[i], last);
    last = mx[i] - 2;
  }
  upto[0] = mx[0];
  for (int i = 1; i < n; i++) upto[i] = max(upto[i - 1], mx[i]);
}
bool match(int l, int r) {
  long long now1 = fhash[r];
  if (l != 0) {
    now1 = (now1 - fhash[l - 1]) % 1000000007;
    now1 = (now1 + 1000000007) % 1000000007;
  }
  now1 = (now1 * inv_pw[l]) % 1000000007;
  long long now2 = bhash[r];
  if (l != 0) {
    now2 = (now2 - bhash[l - 1]) % 1000000007;
    now2 = (now2 + 1000000007) % 1000000007;
  }
  now2 = (now2 * inv_pw[n - 1 - r]) % 1000000007;
  return now1 == now2;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  pw[0] = 1;
  for (int i = 1; i < 400005; i++) {
    pw[i] = (pw[i - 1] * 137) % 1000000007;
  }
  for (int i = 0; i < 400005; i++) {
    inv_pw[i] = bigmod(pw[i], 1000000007 - 2);
  }
  cin >> d >> s;
  n = s.size();
  manachar();
  long long now = 0, p = 1;
  for (int i = 0; i < n; i++) {
    now = (now + s[i] * pw[i]) % 1000000007;
    fhash[i] = now;
  }
  now = 0;
  for (int i = 0; i < n; i++) {
    now = (now + s[i] * pw[n - 1 - i]) % 1000000007;
    bhash[i] = now;
  }
  for (int i = 0; i < n; i++) {
    if (upto[i - 1] < d) {
      can_be[i] = false;
      for (char c = s[i] + 1; c <= 'z'; c++) {
        long long temp1 = fhash[i], temp2 = bhash[i];
        if (i != 0) {
          fhash[i] = (fhash[i - 1] + c * pw[i]) % 1000000007;
          bhash[i] = (bhash[i - 1] + c * pw[n - 1 - i]) % 1000000007;
        } else {
          fhash[i] = (c * pw[i]) % 1000000007;
          bhash[i] = (c * pw[n - 1 - i]) % 1000000007;
        }
        bool f = true;
        int l = i - d + 1, r = i;
        if (l >= 0 && match(l, r)) {
          f = false;
        }
        l = i - (d + 1) + 1, r = i;
        if (l >= 0 && match(l, r)) {
          f = false;
        }
        if (f) can_be[i] = true;
        fhash[i] = temp1;
        bhash[i] = temp2;
      }
    }
  }
  int w = -1;
  for (int i = n - 1; i >= 0; i--) {
    if (can_be[i]) {
      w = i;
      break;
    }
  }
  if (w == -1) {
    cout << "Impossible";
    return 0;
  }
  string ans;
  for (int i = 0; i < w; i++) ans += s[i];
  for (int i = w; i < n; i++) {
    char start = 'a';
    if (i == w) start = s[i] + 1;
    for (char c = start; c <= 'z'; c++) {
      if (i != 0) {
        fhash[i] = (fhash[i - 1] + c * pw[i]) % 1000000007;
        bhash[i] = (bhash[i - 1] + c * pw[n - 1 - i]) % 1000000007;
      } else {
        fhash[i] = (c * pw[i]) % 1000000007;
        bhash[i] = (c * pw[n - 1 - i]) % 1000000007;
      }
      bool f = true;
      int l = i - d + 1, r = i;
      if (l >= 0 && match(l, r)) {
        f = false;
      }
      l = i - (d + 1) + 1, r = i;
      if (l >= 0 && match(l, r)) {
        f = false;
      }
      if (f) {
        ans += c;
        break;
      }
    }
  }
  cout << ans;
}
