#include <iostream>
#include <string>
using namespace std;
typedef unsigned long long ull;
const ull B = 131;
const int N = 2e6+10;
ull h[N],p[N];
int n,l; string s;
ull get(int l,int r){return h[r]-h[l-1]*p[r-l+1];}
bool ok(string &t){
int i=0,j=0,d=0;
while(i<n&&j<2*l){
if(s[i]==t[j%l])i++,j++;
else if(++d>1)return 0;
else i++;
}
return d<=1&&j==2*l;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>n>>s;
if(n%2==0)return cout<<"NOT POSSIBLE",0;
l=(n-1)/2;
string x=s.substr(0,l),y=s.substr(l);
bool f1=ok(x),f2=ok(y);
if(!f1&&!f2)cout<<"NOT POSSIBLE";
else if(f1&&f2&&x!=y)cout<<"NOT UNIQUE";
else cout<<(f1?x:y);
}
#include <iostream>
#include <string>
using namespace std;
typedef unsigned long long ull;
const int MAXN = 2e6 + 10;
const ull BASE = 131;
ull h[MAXN], p[MAXN];
string s;
int n, L;
void init() {
p[0] = 1;
for (int i = 1; i <= n; i++) {
p[i] = p[i-1] * BASE;
h[i] = h[i-1] * BASE + s[i-1];
}
}
// 获取原串 [l, r] 的哈希(1-based)
ull get(int l, int r) {
if (l > r) return 0;
return h[r] - h[l-1] * p[r - l + 1];
}
// 删除 pos 后,获取前 L 的哈希
ull get_left(int pos) {
if (pos >= L) return get(1, L); // 删后面,前L不变
return get(1, pos) * p[L - pos] + get(pos + 2, L + 1);
}
// 删除 pos 后,获取后 L 的哈希
ull get_right(int pos) {
int st = L + 1;
if (pos < st) st++;
return get(st, st + L - 1);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> s;
if (n % 2 == 0) {
cout << "NOT POSSIBLE" << endl;
return 0;
}
L = (n - 1) / 2;
init();
string ans = "";
// 枚举每一个要删除的位置
for (int pos = 0; pos < n; pos++) {
ull hl = get_left(pos);
ull hr = get_right(pos);
if (hl == hr) {
string cur;
if (pos >= L) cur = s.substr(0, L);
else cur = s.substr(0, pos) + s.substr(pos + 1, L - pos);
if (ans.empty()) ans = cur;
else if (ans != cur) {
cout << "NOT UNIQUE" << endl;
return 0;
}
}
}
if (ans.empty()) cout << "NOT POSSIBLE" << endl;
else cout << ans << endl;
return 0;
}