//                             In The Name Of Allah
//                              Mohammad Hosseini
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

const int N = 2e5 + 100, OO = 1e9 + 7, T = (1 << 14) + 10, M = 998244353, P = 6151, SQ = 280, lg = 20;
typedef pair <int, int> pii;
vector <int> v[N], a[N];
pii b[N];
int deg[N], l[N], r[N];

int32_t main() {
    use_fast;
	int n, m;
	cin >> n >> m;
	set <pii> st;
	for(int i = 0; i < n; i++) {
		a[i].resize(m + 10);
		for(int j = 0; j < m; j++)
			cin >> a[i][j];
	}
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++)
			b[j] = {a[i][j], j};
		sort(b, b + m);
		l[0] = -1;
		for(int j = 1; j < m; j++) {
			if(b[j].ff == b[j - 1].ff || b[j - 1].ff == -1)
				l[j] = l[j - 1];
			else
				l[j] = j - 1;
			if(l[j] == -1 || b[j].ff == -1)
				continue;
			if(st.find({b[l[j]].ss, b[j].ss}) != st.end())
				continue;
			st.insert({b[l[j]].ss, b[j].ss});
			v[b[l[j]].ss].pb(b[j].ss);
			deg[b[j].ss]++;
		}
		r[m - 1] = -1;
		for(int j = m - 2; j >= 0; j--) {
			if(b[j].ff == b[j + 1].ff || b[j + 1].ff == -1)
				r[j] = r[j + 1];
			else
				r[j] = j + 1;
			if(r[j] == -1 || b[j].ff == -1)
				continue;
			if(st.find({b[j].ss, b[r[j]].ss}) != st.end())
				continue;
			st.insert({b[j].ss, b[r[j]].ss});
			v[b[j].ss].pb(b[r[j]].ss);
			deg[b[r[j]].ss]++;
		}
	}
	queue <int> q;
	vector <int> tp;
	for(int i = 0; i < m; i++)
		if(!deg[i])
			q.push(i);
	while(!q.empty()) {
		int x = q.front();
		q.pop();
		tp.pb(x);
		for(auto u : v[x]) {
			deg[u]--;
			if(!deg[u])
				q.push(u);
		}
	}
	if(tp.size() != m)
		return cout << -1, 0;
	for(auto u : tp)
		cout << u + 1 << " ";
	return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ...
*/


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

    int N, M; cin >> M >> N;
    vector<vi> graph(N);

    F0R(it, M) {
        map<int, vi> S;
        F0R(i, N) {
            int cur; cin >> cur;
            if (cur == -1) continue;
            S[cur].pb(i);
        }
        int lstDif = -1;
        for (auto it = S.begin(); it != S.end(); it++) {
            auto it2 = it; it2++;
            if (it2 == S.end()) break;
            vi cur; int P = sz(graph);
            trav(a, it->s) {
                graph[a].pb(P);
            }
            trav(b, it2->s) {
                cur.pb(b);
            }
            graph.pb(cur);
        }
    }

    int oN = N;
    N = sz(graph);
    int in[N];
    F0R(i, N) in[i] = 0;
    F0R(i, N) trav(a, graph[i]) in[a]++;

    queue<int> q;
    F0R(i, N) {
        if (in[i] == 0) q.push(i);
    }
    vi ans;
    while (!q.empty()) {
        int cur = q.front(); q.pop();
        if (cur < oN) ans.pb(cur);
        trav(a, graph[cur]) {
            in[a]--;
            if (in[a] == 0) {
                q.push(a);
            }
        }
    }

    if (sz(ans) == oN) {
        F0R(i, oN) cout << ans[i]+1 << " ";
    } else {
        cout << -1;
    }
    cout << nl;

	return 0;
}

// read the question correctly (ll vs int)
// template by bqi343


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

    int N, M; cin >> M >> N;
    vector<vi> graph(N);

    F0R(it, M) {
        map<int, int> S;
        F0R(i, N) {
            int cur; cin >> cur;
            if (cur == -1) continue;
            if (S.ub(cur) != S.end()) {
                graph[S.ub(cur)->s].pb(i);
            }
            if (S.lb(cur) != S.begin()) {
                graph[i].pb((--S.lb(cur))->s);
            }
            S[cur] = i;
        }
    }

    int in[N];
    F0R(i, N) in[i] = 0;
    F0R(i, N) trav(a, graph[i]) in[a]++;

    queue<int> q;
    F0R(i, N) {
        if (in[i] == 0) q.push(i);
    }
    vi ans;
    while (!q.empty()) {
        int cur = q.front(); q.pop();
        ans.pb(cur);
        trav(a, graph[cur]) {
            in[a]--;
            if (in[a] == 0) {
                q.push(a);
            }
        }
    }

    if (sz(ans) == N) {
        F0Rd(i, N) cout << ans[i]+1 << " ";
    } else {
        cout << -1;
    }
    cout << nl;

	return 0;
}

// read the question correctly (ll vs int)
// template by bqi343


#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

vector < vector<int> > g, gr;
vector<bool> used;
vector<int> order, component;

void dfs1 (int v)
{
    used[v] = true;
    for (size_t i=0; i<g[v].size(); ++i)
        if (!used[ g[v][i] ])
            dfs1 (g[v][i]);
    order.push_back (v);
}

void dfs2 (int v)
{
    used[v] = true;
    component.push_back (v);
    for (size_t i=0; i<gr[v].size(); ++i)
        if (!used[ gr[v][i] ])
            dfs2 (gr[v][i]);
}

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    int fake=m;
    g.resize(1e6);
    gr.resize(1e6);
    for (int i=0;i<n;i++)
    {
        map<int,vector<int> > v;
        for (int j=0;j<m;j++)
        {
            int x;
            cin >> x;
            v[x].push_back(j);
        }
        for (auto &p:v){
            if (p.first==-1)
                continue;
            for (auto x:p.second)
            {
                g[fake].push_back(x);
                g[x].push_back(fake+1);
                gr[fake+1].push_back(x);
                gr[x].push_back(fake);
            }
            ++fake;
        }
        ++fake;
    }

    used.assign (fake, false);
    for (int i=0; i<fake; ++i)
        if (!used[i])
            dfs1 (i);
    used.assign (fake, false);
    vector<int> ans;
    for (int i=0; i<fake; ++i)
    {
        int v = order[fake-1-i];
        if (!used[v])
        {
            dfs2 (v);
            int kol=0;
            for (auto x:component){
                if (x<m)
                    ++kol;
                if (x<m)
                    ans.push_back(x+1);
            }
            component.clear();
            if (kol==0)
                continue;
            if (kol>2)
            {
                cout << -1;
                return 0;
            }
        }
    }
    for (auto x:ans)
        cout << x << ' ';
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

vector < vector<int> > g, gr;
vector<bool> used;
vector<int> order, component;

void dfs1 (int v)
{
    used[v] = true;
    for (size_t i=0; i<g[v].size(); ++i)
        if (!used[ g[v][i] ])
            dfs1 (g[v][i]);
    order.push_back (v);
}

void dfs2 (int v)
{
    used[v] = true;
    component.push_back (v);
    for (size_t i=0; i<gr[v].size(); ++i)
        if (!used[ gr[v][i] ])
            dfs2 (gr[v][i]);
}

int main()
{
    int n,m;
    cin >> n >> m;
    int fake=m;
    g.resize(m+n*m+100);
    gr.resize(m+n*m+100);
    for (int i=0;i<n;i++)
    {
        map<int,vector<int> > v;
        for (int j=0;j<m;j++)
        {
            int x;
            cin >> x;
            v[x].push_back(j);
        }
        for (auto &p:v){
            if (p.first==-1)
                continue;
            for (auto x:p.second)
            {
                g[fake].push_back(x);
                g[x].push_back(fake+1);
                gr[fake+1].push_back(x);
                gr[x].push_back(fake);
            }
            ++fake;
        }
        ++fake;
    }

    used.assign (fake, false);
    for (int i=0; i<fake; ++i)
        if (!used[i])
            dfs1 (i);
    used.assign (fake, false);
    vector<int> ans;
    for (int i=0; i<fake; ++i)
    {
        int v = order[fake-1-i];
        if (!used[v])
        {
            dfs2 (v);
            int kol=0;
            for (auto x:component){
                if (x<m)
                    ++kol;
                if (x<m)
                    ans.push_back(x+1);
            }
            component.clear();
            if (kol==0)
                continue;
            if (kol>2)
            {
                cout << -1;
                return 0;
            }
        }
    }
    for (auto x:ans)
        cout << x << ' ';
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

vector < vector<int> > g, gr;
vector<bool> used;
vector<int> order, component;

void dfs1 (int v)
{
    used[v] = true;
    for (size_t i=0; i<g[v].size(); ++i)
        if (!used[ g[v][i] ])
            dfs1 (g[v][i]);
    order.push_back (v);
}

void dfs2 (int v)
{
    used[v] = true;
    component.push_back (v);
    for (size_t i=0; i<gr[v].size(); ++i)
        if (!used[ gr[v][i] ])
            dfs2 (gr[v][i]);
}

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    int fake=m;
    g.resize(m+n*(m+1)+n+100);
    gr.resize(m+n*(m+1)+n+100);
    for (int i=0;i<n;i++)
    {
        map<int,vector<int> > v;
        for (int j=0;j<m;j++)
        {
            int x;
            cin >> x;
            v[x].push_back(j);
        }
        for (auto &p:v){
            if (p.first==-1)
                continue;
            for (auto x:p.second)
            {
                g[fake].push_back(x);
                g[x].push_back(fake+1);
                gr[fake+1].push_back(x);
                gr[x].push_back(fake);
            }
            ++fake;
        }
        ++fake;
    }

    used.assign (fake, false);
    for (int i=0; i<fake; ++i)
        if (!used[i])
            dfs1 (i);
    used.assign (fake, false);
    vector<int> ans;
    for (int i=0; i<fake; ++i)
    {
        int v = order[fake-1-i];
        if (!used[v])
        {
            dfs2 (v);
            int kol=0;
            for (auto x:component){
                if (x<m)
                    ++kol;
                if (x<m)
                    ans.push_back(x+1);
            }
            component.clear();
            if (kol==0)
                continue;
            if (kol>2)
            {
                cout << -1;
                return 0;
            }
        }
    }
    for (auto x:ans)
        cout << x << ' ';
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

vector < vector<int> > g, gr;
vector<bool> used;
vector<int> order, component;

void dfs1 (int v)
{
    used[v] = true;
    for (size_t i=0; i<g[v].size(); ++i)
        if (!used[ g[v][i] ])
            dfs1 (g[v][i]);
    order.push_back (v);
}

void dfs2 (int v)
{
    used[v] = true;
    component.push_back (v);
    for (size_t i=0; i<gr[v].size(); ++i)
        if (!used[ gr[v][i] ])
            dfs2 (gr[v][i]);
}

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    int fake=m;
    g.resize(1e6);
    gr.resize(1e6);
    for (int i=0;i<n;i++)
    {
        map<int,vector<int> > v;
        for (int j=0;j<m;j++)
        {
            int x;
            cin >> x;
            v[x].push_back(j);
        }
        for (auto &p:v){
            if (p.first==-1)
                continue;
            for (auto x:p.second)
            {
                g[fake].push_back(x);
                g[x].push_back(fake+1);
                gr[fake+1].push_back(x);
                gr[x].push_back(fake);
            }
            ++fake;
        }
        ++fake;
    }

    used.assign (fake, false);
    for (int i=0; i<fake; ++i)
        if (!used[i])
            dfs1 (i);
    used.assign (fake, false);
    vector<int> ans;
    for (int i=0; i<fake; ++i)
    {
        int v = order[fake-1-i];
        if (!used[v])
        {
            dfs2 (v);
            int kol=0;
            for (auto x:component){
                if (x<m)
                    ++kol;
                if (x<m)
                    ans.push_back(x+1);
            }
            component.clear();
            if (kol==0)
                continue;
            if (kol>=2)
            {
                cout << -1;
                return 0;
            }
        }
    }
    for (auto x:ans)
        cout << x << ' ';
}


////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

const int N = 3e5;
int outdeg[N + 5];
vector<int> lst[N + 5];
vector<pair<int,int> > element;
vector<int> ans;

void hora(int tc) {
	int n, m;
	cin>>n>>m;
	int curr = m;
	for(int i = 0;i < n;i++) {
		element.clear();
		for(int j = 0;j < m;j++) {
			int x;
			cin>>x;
			element.PB({x, j + 1});
		}
		sort(element.begin(), element.end());
		int last = 0;
		bool fi = 0;
		for(int j = 0;j < m;j++) {
			if(element[j].FI == -1) continue;
			if(j != 0 && element[j].FI != element[j - 1].FI) {
				if(fi != 0) {
					curr++;
					for(int k = j - 1; k >= 0 ;k--) {
						if(element[j - 1].FI != element[k].FI) break;
						lst[element[k].SE].PB(curr);
						outdeg[curr]++;
					}
					last = curr;
				}
			}
			lst[last].PB(element[j].SE);
			outdeg[element[j].SE]++;
			fi = 1;
		}
	}
	queue<int> q;
	for(int i = 0;i <= curr;i++) if(outdeg[i] == 0) q.push(i);
	while(!q.empty()) {
		int u = q.front();
		q.pop();
		if(u <= m && u >= 1) ans.PB(u);
		for(auto x: lst[u]) {
			outdeg[x]--;
			if(outdeg[x] == 0) q.push(x);
		}
	}
	if(ans.size() != m) cout<<-1<<endl;
	else {
		for(auto x: ans) cout<<x<<" ";
		cout<<endl;
	}
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

const int N = 1e5;
vector<vector<int> > arr;

bool cmp(vector<int> &A, vector<int> &B) {
	int sz = A.size();
	for(int i = 0;i < sz;i++) {
		if(A[i] == -1 || B[i] == -1) continue;
		if(A[i] == B[i]) continue;
		return A[i] < B[i];
	}
	return false;
}

void hora(int tc) {
	int n, m;
	cin>>n>>m;
	vector<int> sz;
	sz.assign(n + 1, 0);
	for(int i = 0;i < m;i++) arr.PB(sz);
	for(int i = 0;i < n;i++) {
		for(int j = 0;j < m;j++) {
			int x;
			cin>>x;
			arr[j][i] = x;
		}
	}
	for(int i = 0;i < m;i++) arr[i][n] = i + 1;
	sort(arr.begin(), arr.end(), cmp);
//	for(int i = 0;i < m;i++) {
//		for(auto x: arr[i]) cout<<x<<" ";
//		cout<<endl;
//	}
	for(int i = 0;i < arr[0].size() - 1;i++) {
		int last = 0;
		for(int j = 0;j < m - 1;j++) {
			if(arr[j][i] == -1) arr[j][i] = last;
			else last = arr[j][i];
			if(arr[j + 1][i] != -1 && arr[j][i] > arr[j + 1][i]) {
				cout<<"-1"<<endl;
				return ;
			}
		}
	}
	for(int i = 0;i < m;i++) cout<<arr[i][n]<<" ";
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
pair<int,int> a[100010];
vector<int> g[200010];
vector<int> ve;
int vis[100010]={0},m,n;
bool dfs(int x)
{
	if(vis[x]==1)
	{
		return false;
	}
	if(vis[x]==2)
	{
		return true;
	}
	int i,k;
	bool bo;
	vis[x]=1;
	for(i=0;i<g[x].size();i++)
	{
		k=g[x][i];
		bo=dfs(k);
		if(!bo){
			return false;
		}
	}
	vis[x]=2;
	if(x<m)
		ve.push_back(x);
	return true;
}
int main()
{
	int i,j,k,newn;
	scanf("%d%d",&n,&m);
	newn=m;
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			scanf("%d",&a[j].first);
			a[j].second=j;
		}
		sort(a,a+m);
		for(j=0;j<m;j++)
		{
			if(a[j].first>-1)
			{
				break;
			}
		}
		while(j<m)
		{
			g[a[j].second].push_back(newn);
		//	printf("%d->%d\n",a[j].second,newn);
			for(j=j+1;j<m;j++)
			{
				if(a[j].first==a[j-1].first)
				{
					g[a[j].second].push_back(newn);
		//			printf("%d->%d\n",a[j].second,newn);
				}
				else
				{
					break;
				}
			}
			if(j==m)
			{
				newn++;
				break;
			}
			g[newn].push_back(a[j].second);
		//	printf("%d->%d\n",newn,a[j].second);
			for(k=j+1;k<m;k++)
			{
				if(a[k].first==a[k-1].first)
				{
					g[newn].push_back(a[k].second);
		//			printf("%d->%d\n",newn,a[k].second);
				}
			}
			newn++;
			//j++;
		}
	}
	bool bo=1;
	for(i=newn-1;i>=0;i--)
	{
		bo=bo&dfs(i);
	}
	if(bo)
	{
		for(i=ve.size()-1;i>=0;i--)
		{
			printf("%d ",ve[i]+1);
		}
	}
	else
	{
		printf("-1\n");
	}
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
struct node
{
	int a,b;
	bool friend operator <(node A,node B)
	{
		return A.a<B.a;
	}
}a[100010];
vector<int> g[100010];
vector<int> ve;
int vis[100010]={0};
bool dfs(int x)
{
	if(vis[x]==1)
	{
		return 0;
	}
	if(vis[x]==2)
	{
		return 1;
	}
	int i,k;
	vis[x]=1;
	for(i=0;i<g[x].size();i++)
	{
		k=g[x][i];
		if(!dfs(k)) return 0;
	}
	vis[x]=2;
	ve.push_back(x);
	return 1;
}
int main()
{
	int i,j,k,n,m,l;
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			scanf("%d",&a[j].a);
			a[j].b=j;
		}
		sort(a,a+m);
		for(j=1;j<m;j++)
		{
			if(a[j].a==-1||a[j-1].a==-1)
				continue;
			if(a[j].a==a[j-1].a)
			{
				for(k=j+1;k<m;k++)
				{
					if(a[k].a>a[j].a)
					{
						break;
					}
				}
				if(k<m)
				{
					for(l=j-1;l<k;l++)
					{
						g[a[l].b].push_back(a[k].b);
					}
				}
				continue;
			}
			g[a[j-1].b].push_back(a[j].b);
		}
	}
	bool bo=1;
	for(i=m-1;i>=0;i--)
	{
		bo=bo&dfs(i);
	}
	if(!bo)
	{
		printf("-1\n");
	}
	else
	{
		for(i=ve.size()-1;i>=0;i--)
		{
			printf("%d ",ve[i]+1);
		}
	}
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
struct node
{
	int a,b;
	bool friend operator <(node A,node B)
	{
		return A.a<B.a;
	}
}a[100010];
vector<int> g[100010];
vector<int> ve;
int vis[100010]={0};
bool dfs(int x)
{
	if(vis[x]==1)
	{
		return 0;
	}
	if(vis[x]==2)
	{
		return 1;
	}
	int i,k;
	vis[x]=1;
	for(i=0;i<g[x].size();i++)
	{
		k=g[x][i];
		if(!dfs(k)) return 0;
	}
	vis[x]=2;
	ve.push_back(x);
	return 1;
}
int main()
{
	int i,j,k,n,m,l;
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			scanf("%d",&a[j].a);
			a[j].b=j;
		}
		sort(a,a+m);
		for(j=1;j<m;j++)
		{
			if(a[j].a==-1||a[j-1].a==-1)
				continue;
			if(a[j].a==a[j-1].a)
			{
				for(k=j+1;k<m;k++)
				{
					if(a[k].a>a[j].a)
					{
						break;
					}
				}
				if(k<m)
				{
					for(l=j-1;l<k;l++)
					{
						g[a[l].b].push_back(a[k].b);
					}
				}
				continue;
			}
			g[a[j-1].b].push_back(a[j].b);
		}
	}
	bool bo=1;
	for(i=0;i<n;i++)
	{
		bo=bo&dfs(i);
	}
	if(!bo)
	{
		printf("-1\n");
	}
	else
	{
		for(i=ve.size()-1;i>=0;i--)
		{
			printf("%d ",ve[i]+1);
		}
	}
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
#define ll long long
using namespace std;
struct node
{
	ll a;
	int b;
	bool friend operator <(node A,node B)
	{
		return A.a<B.a;
	}
}a[100010];
vector<int> g[100010];
vector<int> ve;
int vis[100010]={0};
bool dfs(int x)
{
	if(vis[x]==1)
	{
		return 0;
	}
	if(vis[x]==2)
	{
		return 1;
	}
	int i,k;
	vis[x]=1;
	for(i=0;i<g[x].size();i++)
	{
		k=g[x][i];
		if(!dfs(k))
			return 0;
	}
	vis[x]=2;
	ve.push_back(x);
	return 1;
}
int main()
{
	int i,j,k,n,m,l;
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			scanf("%d",&a[j].a);
			a[j].b=j;
		}
		sort(a,a+m);
		for(j=1;j<m;j++)
		{
			if(a[j-1].a==-1)
				continue;
			if(a[j].a==a[j-1].a)
			{
				for(k=j+1;k<m;k++)
				{
					if(a[k].a>a[j].a)
					{
						break;
					}
				}
				if(k<m)
				{
					for(l=j-1;l<k;l++)
					{
						g[a[l].b].push_back(a[k].b);
						//printf("%d->%d\n",a[l].b,a[k].b);
					}
				}
				continue;
			}
			g[a[j-1].b].push_back(a[j].b);
			//printf("%d->%d\n",a[j-1].b,a[j].b);
		}
	}/*
	for(i=0;i<m;i++)
	{
		for(j=0;j<g[i].size();j++)
		{
			printf("%d->%d\n",i,g[i][j]);
		}
	}*/
	bool bo=1;
	for(i=m-1;i>=0;i--)
	{
		bo=bo&dfs(i);
	}
	if(!bo)
	{
		printf("-1\n");
	}
	else
	{
		for(i=ve.size()-1;i>=0;i--)
		{
			printf("%d ",ve[i]+1);
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ub(a,x) upper_bound(a.begin(),a.end(),x)-a.begin()
#define lb(a,x) lower_bound(a.begin(),a.end(),x)-a.begin()
#define ll long long int
#define endl "\n";
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back

main()
{
    speed;
    int n;
    cin>>n;
    string s;
    cin>>s;
    sort(all(s));
    cout<<s;
}


#include <bits/stdc++.h>
using namespace std;

#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ub(a,x) upper_bound(a.begin(),a.end(),x)-a.begin()
#define lb(a,x) lower_bound(a.begin(),a.end(),x)-a.begin()
#define ll long long int
#define endl "\n";
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back

main()
{
    speed;
    int n;
    cin>>n;
    string s;
    cin>>s;
sort(all(s));
cout<<s;
return 0;
    int hash[26] = {0};
    for(int i=0;i<n;i++)
    {
        hash[s[i]-'a']++;
    }
    int max_odd=0,max_ind = -1;
    for(int i=0;i<26;i++)
    {
        if(hash[i]&1)
        {
            if(hash[i]>max_odd)
            {
                max_odd = hash[i];
                max_ind = i;
            }
        }
    }
    string ans;
    for(int i=0;i<max_odd;i++)
    {
        ans += (char)(max_ind+'a');
    }
    for(int i=0;i<26;i++)
    {
        if(hash[i]%2==0)
        {
            string temp;
            for(int j=0;j<hash[i]/2;j++)
            {
                temp += (char)(i+'a');
            }
            ans = temp+ans+temp;
        }
    }
    for(int i=0;i<26;i++)
    {
        if(hash[i]&1 && i!=max_ind)
        {
            for(int j=0;j<hash[i];j++)
            {
                ans += (char)(i+'a');
            }
        }
    }
    cout<<ans<<"\n";
    sort(all(s));
    cout<<s;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>
#include <random>
#include <ctime>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a == b) {
        for (int i = 0; i < a; i++) {
            res += ca;
        }
        for (int i = 0; i < b; i++) {
            res += cb;
        }
        return res;
    }
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            if (b) {
                res += cb;
                res = cb + res;
                b -= 2;
            } else if (a) {
                res += ca;
                res = ca + res;
                a -= 2;
            } else {
                return res;
            }
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else if (a && b) {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            res += ca;
            return get(res, a - 1, b, ca, cb);
        } else {
            if (a > 1) {
                res += cb;
                res = ca + res;
                return get(res, a - 1, b - 1, ca, cb);
            } else {
                res += ca;
                for (int i = 0; i < b; i++) {
                    res += cb;
                }
                return res;
            }
        }
    }
    return res;
}

string fast(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            string sub = get("", a, b, ca, cb);
            ans += sub;
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
    return ans;
}

string str = "";
int maxc = 0;

void solve(string pre, vector<ch> num, int n) {
    if (pre.size() == n) {
        if (maxc < cnt(pre)) {
            maxc = cnt(pre);
            str = pre;
        }
        return;
    }
    for (int i = 0; i < 26; i++) {
        if (num[i].num > 0) {
            vector<ch> nnum = num;
            nnum[i].num--;
            solve(pre + num[i].c, nnum, n);
        }
    }
}

string slow(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    solve("", num, n);
    return str;
}

void check(int nt) {
    mt19937 gen((int)time(0));
    for (int it = 0; it < nt; ++it) {
        string r = "";
        for (int i = 0; i < 6; i++) {
            r += char('a' + uniform_int_distribution<int>(0, 25)(gen));
        }
        str = "";
        maxc = 0;
        string sl = slow(r, 6);
        string ft = fast(r, 6);
        int csl = cnt(sl);
        int cft = cnt(ft);
        if (csl != cft) {
            cout << "fail : " << r << ' ' << sl << ' ' << ft << ' ' << csl << ' ' << cft << endl;
        } else {
//            cout << "pass\n";
        }
    }
}

int main(){
//    check(10000);

    int n;
    string s;
    cin >> n;
    cin >> s;
    cout << fast(s, n);

//    string s;
//    cin >> s;
//    cout << cnt(fast(s, 6)) << ' '<< cnt(s) << ' ' << fast(s, 6);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>
#include <random>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            if (b) {
                res += cb;
                res = cb + res;
                b -= 2;
            } else if (a) {
                res += ca;
                res = ca + res;
                a -= 2;
            } else {
                return res;
            }
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else if (a && b) {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            res += ca;
            return get(res, a - 1, b, ca, cb);
        } else {
            res += cb;
            res = ca + res;
            return get(res, a - 1, b - 1, ca, cb);
        }
    }
    return res;
}

string fast(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            string sub = get("", a, b, ca, cb);
            ans += sub;
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
    return ans;
}

int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    cout << fast(s, n);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>
#include <random>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            if (b) {
                res += cb;
                res = cb + res;
                b -= 2;
            } else if (a) {
                res += ca;
                res = ca + res;
                a -= 2;
            } else {
                return res;
            }
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else if (a && b) {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            res += ca;
            return get(res, a - 1, b, ca, cb);
        } else {
            if (a > 1) {
                res += cb;
                res = ca + res;
                return get(res, a - 1, b - 1, ca, cb);
            } else {
                res += ca;
                for (int i = 0; i < b; i++) {
                    res += cb;
                }
                return res;
            }
        }
    }
    return res;
}

string fast(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            string sub = get("", a, b, ca, cb);
            ans += sub;
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
    return ans;
}

string str = "";
int maxc = 0;

void solve(string pre, vector<ch> num, int n) {
    if (pre.size() == n) {
        if (maxc < cnt(pre)) {
            maxc = cnt(pre);
            str = pre;
        }
        return;
    }
    for (int i = 0; i < 26; i++) {
        if (num[i].num > 0) {
            vector<ch> nnum = num;
            nnum[i].num--;
            solve(pre + num[i].c, nnum, n);
        }
    }
}

string slow(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    solve("", num, n);
    return str;
}

void check(int nt) {
    mt19937 gen((int)time(0));
    for (int it = 0; it < nt; ++it) {
        string r = "";
        for (int i = 0; i < 10 ; i++) {
            r += char('a' + uniform_int_distribution<int>(0, 25)(gen));
        }
        str = "";
        maxc = 0;
        string sl = slow(r, 10);
        string ft = fast(r, 10);
        int csl = cnt(sl);
        int cft = cnt(ft);
        if (csl != cft) {
            cout << "fail : " << r << ' ' << sl << ' ' << ft << ' ' << csl << ' ' << cft << endl;
        } else {
            cout << "pass\n";
        }
    }
}

int main(){
//    check(10);

    int n;
    string s;
    cin >> n;
    cin >> s;
    cout << fast(s, n);

//    string s;
//    cin >> s;
//    cout << fast(s, 10);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string &a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            if (b) {
                res += cb;
                res = cb + res;
                b -= 2;
            } else if (a) {
                res += ca;
                res = ca + res;
                a -= 2;
            } else {
                return res;
            }
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else if (a && b) {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            string s = "";
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            res += ca;
            return get(res, a - 1, b, ca, cb);
        } else {
            string s = "";
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    }
    return res;
}

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            string sub = get("", a, b, ca, cb);
            ans += sub;
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
//    cout << cnt(ans) << endl;
    cout << ans << endl;
//    string s;
//    cin >> s;
//    cout << cnt(s);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string &a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            res += cb;
            res = cb + res;
            b -= 2;
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            string s = "";
            s += cb;
            return get(s, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            string s = "";
            s += ca;
            return get(s, a - 1, b, ca, cb);
        } else {
            string s = "";
            s += cb;
            return get(s, a, b - 1, ca, cb);
        }
    }
    return res;
}

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            string sub = get("", a, b, ca, cb);
            ans += sub;
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
//    cout << cnt(ans) << endl;
    cout << ans;
//    string s;
//    cin >> s;
//    cout << cnt(s);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string &a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            res += cb;
            res = cb + res;
            b -= 2;
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            string s = "";
            s += cb;
            return get(s, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            string s = "";
            s += ca;
            return get(s, a - 1, b, ca, cb);
        } else {
            string s = "";
            s += cb;
            return get(s, a, b - 1, ca, cb);
        }
    }
    return res;
}

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            string sub = get("", a, b, ca, cb);
            ans += sub;
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
//    cout << cnt(ans) << endl;
    cout << ans;
//    string s;
//    cin >> s;
//    cout << cnt(s);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>
#include <random>
#include <ctime>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            if (b) {
                res += cb;
                res = cb + res;
                b -= 2;
            } else if (a) {
                res += ca;
                res = ca + res;
                a -= 2;
            } else {
                return res;
            }
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else if (a && b) {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            res += ca;
            return get(res, a - 1, b, ca, cb);
        } else {
            if (a > 1) {
                res += cb;
                res = ca + res;
                return get(res, a - 1, b - 1, ca, cb);
            } else {
                res += ca;
                for (int i = 0; i < b; i++) {
                    res += cb;
                }
                return res;
            }
        }
    }
    return res;
}

string fast(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            if (a != b) {
                string sub = get("", a, b, ca, cb);
                ans += sub;
            } else {
                if (a == b) {
                    for (int i = 0; i < a; i++) {
                        ans += ca;
                    }
                    for (int i = 0; i < b; i++) {
                        ans += cb;
                    }

                }
            }
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
    return ans;
}

string str = "";
int maxc = 0;

void solve(string pre, vector<ch> num, int n) {
    if (pre.size() == n) {
        if (maxc < cnt(pre)) {
            maxc = cnt(pre);
            str = pre;
        }
        return;
    }
    for (int i = 0; i < 26; i++) {
        if (num[i].num > 0) {
            vector<ch> nnum = num;
            nnum[i].num--;
            solve(pre + num[i].c, nnum, n);
        }
    }
}

string slow(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    solve("", num, n);
    return str;
}

void check(int nt) {
    mt19937 gen((int)time(0));
    for (int it = 0; it < nt; ++it) {
        string r = "";
        for (int i = 0; i < 6; i++) {
            r += char('a' + uniform_int_distribution<int>(0, 25)(gen));
        }
        str = "";
        maxc = 0;
        string sl = slow(r, 6);
        string ft = fast(r, 6);
        int csl = cnt(sl);
        int cft = cnt(ft);
        if (csl != cft) {
            cout << "fail : " << r << ' ' << sl << ' ' << ft << ' ' << csl << ' ' << cft << endl;
        } else {
//            cout << "pass\n";
        }
    }
}

int main(){
//    check(10000);

    int n;
    string s;
    cin >> n;
    cin >> s;
    cout << fast(s, n);

//    string s;
//    cin >> s;
//    cout << cnt(fast(s, 6)) << ' '<< cnt(s) << ' ' << fast(s, 6);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>
#include <random>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            if (b) {
                res += cb;
                res = cb + res;
                b -= 2;
            } else if (a) {
                res += ca;
                res = ca + res;
                a -= 2;
            } else {
                return res;
            }
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else if (a && b) {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            res += ca;
            return get(res, a - 1, b, ca, cb);
        } else {
            res += ca;
            res = cb + res;
            return get(res, a - 1, b - 1, ca, cb);
        }
    }
    return res;
}

string fast(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            string sub = get("", a, b, ca, cb);
            ans += sub;
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
    return ans;
}

int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    cout << fast(s, n);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>
#include <random>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            if (b) {
                res += cb;
                res = cb + res;
                b -= 2;
            } else if (a) {
                res += ca;
                res = ca + res;
                a -= 2;
            } else {
                return res;
            }
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else if (a && b) {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            res += ca;
            return get(res, a - 1, b, ca, cb);
        } else {
            if (a > 1) {
                res += cb;
                res = ca + res;
                return get(res, a - 1, b - 1, ca, cb);
            } else {
                res += ca;
                for (int i = 0; i < b; i++) {
                    res += cb;
                }
                return res;
            }
        }
    }
    return res;
}

string fast(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            string sub = get("", a, b, ca, cb);
            ans += sub;
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
    return ans;
}

string str = "";
int maxc = 0;

void solve(string pre, vector<ch> num, int n) {
    if (pre.size() == n) {
        if (maxc < cnt(pre)) {
            maxc = cnt(pre);
            str = pre;
        }
        return;
    }
    for (int i = 0; i < 26; i++) {
        if (num[i].num > 0) {
            vector<ch> nnum = num;
            nnum[i].num--;
            solve(pre + num[i].c, nnum, n);
        }
    }
}

string slow(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    solve("", num, n);
    return str;
}

void check(int nt) {
    mt19937 gen((int)time(0));
    for (int it = 0; it < nt; ++it) {
        string r = "";
        for (int i = 0; i < 10 ; i++) {
            r += char('a' + uniform_int_distribution<int>(0, 25)(gen));
        }
        str = "";
        maxc = 0;
        string sl = slow(r, 10);
        string ft = fast(r, 10);
        int csl = cnt(sl);
        int cft = cnt(ft);
        if (csl != cft) {
            cout << "fail : " << r << ' ' << sl << ' ' << ft << ' ' << csl << ' ' << cft << endl;
        } else {
            cout << "pass\n";
        }
    }
}

int main(){
//    check(10);

    int n;
    string s;
    cin >> n;
    cin >> s;
    cout << fast(s, n);

    string s;
    cin >> s;
    cout << fast(s, 10);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>
#include <random>
#include <ctime>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            if (b) {
                res += cb;
                res = cb + res;
                b -= 2;
            } else if (a) {
                res += ca;
                res = ca + res;
                a -= 2;
            } else {
                return res;
            }
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else if (a && b) {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            res += ca;
            return get(res, a - 1, b, ca, cb);
        } else {
            if (a > 1) {
                res += cb;
                res = ca + res;
                return get(res, a - 1, b - 1, ca, cb);
            } else {
                res += ca;
                for (int i = 0; i < b; i++) {
                    res += cb;
                }
                return res;
            }
        }
    }
    return res;
}

string fast(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    sort(num.begin(), num.end(), [](ch left, ch right){
        return left.num < right.num;
    });
    string ans = "";
    int i = 0;
    while (!num[i].num) {
        i++;
    }
    for (; i < 26; i += 2) {
        if (!num[i].num) {
            continue;
        }
        if (i + 1 < 26) {
            int a = num[i].num;
            int b = num[i + 1].num;
            int ca = num[i].c;
            int cb = num[i + 1].c;
            string sub = get("", a, b, ca, cb);
            ans += sub;
        } else {
            for (int j = 0; j < num[i].num; ++j) {
                ans += num[i].c;
            }
        }
    }
    return ans;
}

string str = "";
int maxc = 0;

void solve(string pre, vector<ch> num, int n) {
    if (pre.size() == n) {
        if (maxc < cnt(pre)) {
            maxc = cnt(pre);
            str = pre;
        }
        return;
    }
    for (int i = 0; i < 26; i++) {
        if (num[i].num > 0) {
            vector<ch> nnum = num;
            nnum[i].num--;
            solve(pre + num[i].c, nnum, n);
        }
    }
}

string slow(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    solve("", num, n);
    return str;
}

void check(int nt) {
    mt19937 gen((int)time(0));
    for (int it = 0; it < nt; ++it) {
        string r = "";
        for (int i = 0; i < 10 ; i++) {
            r += char('a' + uniform_int_distribution<int>(0, 25)(gen));
        }
        str = "";
        maxc = 0;
        string sl = slow(r, 10);
        string ft = fast(r, 10);
        int csl = cnt(sl);
        int cft = cnt(ft);
        if (csl != cft) {
            cout << "fail : " << r << ' ' << sl << ' ' << ft << ' ' << csl << ' ' << cft << endl;
        } else {
            cout << "pass\n";
        }
    }
}

int main(){
//    check(10);

    int n;
    string s;
    cin >> n;
    cin >> s;
    cout << fast(s, n);

//    string s;
//    cin >> s;
//    cout << fast(s, 10);
    return 0;
}


/*
 */
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define cboost ios::sync_with_stdio(0); cin.tie(0);

#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <algorithm>
#include <random>
#include <ctime>

using namespace std;

struct ch {
    int num;
    char c;
};

bool is_pal(string &a, int l, int r) {
    while (l < r) {
        if (a[l] != a[r]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int cnt(string a) {
    int res = 0;
    for (int l = 0; l < (int)a.size(); ++l) {
        for (int r = l; r < (int)a.size(); ++r) {
            res += is_pal(a, l, r);
        }
    }
    return res;
}

string get(string pre, int a, int b, char ca, char cb) {
    string res = pre;
    if (a % 2 == 0) {
        if (b % 2 == 0) {
            int k = 1;
            if (pre.size() > 1 || (pre.size() == 1 && pre[0] == cb)) {
                k = -1;
            }
            if (b) {
                res += cb;
                res = cb + res;
                b -= 2;
            } else if (a) {
                res += ca;
                res = ca + res;
                a -= 2;
            } else {
                return res;
            }
            while (a || b) {
                if (!a) {
                    res = cb + res + cb;
                    b -= 2;
                } else if (!b) {
                    res = ca + res + ca;
                    a -= 2;
                } else if (a && b) {
                    if (k == 1) {
                        res = ca + res + ca;
                        a -= 2;
                        k *= -1;
                    } else {
                        res = cb + res + cb;
                        b -= 2;
                        k *= -1;
                    }
                }
            }
        } else {
            res += cb;
            return get(res, a, b - 1, ca, cb);
        }
    } else {
        if (b % 2 == 0) {
            res += ca;
            return get(res, a - 1, b, ca, cb);
        } else {
            if (a > 1) {
                res += cb;
                res = ca + res;
                return get(res, a - 1, b - 1, ca, cb);
            } else {
                res += ca;
                for (int i = 0; i < b; i++) {
                    res += cb;
                }
                return res;
            }
        }
    }
    return res;
}

string fast(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    string ans = "";
    for (int i = 0; i < 26; i++) {
        if (num[i].num) {
            for (int j = 0; j < num[i].num; j++) {
                ans += num[i].c;
            }
        }
    }
//    sort(num.begin(), num.end(), [](ch left, ch right){
//        return left.num < right.num;
//    });
//    string ans = "";
//    int i = 0;
//    while (!num[i].num) {
//        i++;
//    }
//    for (; i < 26; i += 2) {
//        if (!num[i].num) {
//            continue;
//        }
//        if (i + 1 < 26) {
//            int a = num[i].num;
//            int b = num[i + 1].num;
//            int ca = num[i].c;
//            int cb = num[i + 1].c;
//            if (a != b) {
//                string sub = get("", a, b, ca, cb);
//                ans += sub;
//            } else {
//                if (a == b) {
//                    for (int i = 0; i < a; i++) {
//                        ans += ca;
//                    }
//                    for (int i = 0; i < b; i++) {
//                        ans += cb;
//                    }
//
//                }
//            }
//        } else {
//            for (int j = 0; j < num[i].num; ++j) {
//                ans += num[i].c;
//            }
//        }
//    }
    return ans;
}

string str = "";
int maxc = 0;

void solve(string pre, vector<ch> num, int n) {
    if (pre.size() == n) {
        if (maxc < cnt(pre)) {
            maxc = cnt(pre);
            str = pre;
        }
        return;
    }
    for (int i = 0; i < 26; i++) {
        if (num[i].num > 0) {
            vector<ch> nnum = num;
            nnum[i].num--;
            solve(pre + num[i].c, nnum, n);
        }
    }
}

string slow(string s, int n) {
    vector<ch> num(26);
    for (int i = 0; i < 26; ++i) {
        num[i] = {0, char(i + (int)'a')};
    }
    for (int i = 0; i < n; ++i) {
        ++num[s[i] - 'a'].num;
    }
    solve("", num, n);
    return str;
}

void check(int nt) {
    mt19937 gen((int)time(0));
    for (int it = 0; it < nt; ++it) {
        string r = "";
        for (int i = 0; i < 6; i++) {
            r += char('a' + uniform_int_distribution<int>(0, 25)(gen));
        }
        str = "";
        maxc = 0;
        string sl = slow(r, 6);
        string ft = fast(r, 6);
        int csl = cnt(sl);
        int cft = cnt(ft);
        if (csl != cft) {
            cout << "fail : " << r << ' ' << sl << ' ' << ft << ' ' << csl << ' ' << cft << endl;
        } else {
//            cout << "pass\n";
        }
    }
}

int main(){
//    check(10000);

    int n;
    string s;
    cin >> n;
    cin >> s;
    cout << fast(s, n);

//    string s;
//    cin >> s;
//    cout << cnt(fast(s, 6)) << ' '<< cnt(s) << ' ' << fast(s, 6);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
const int N=1e6+5,MOD=1e9+7,MAX=1e5,offset=100;

int n;

string str;
int cc[26];
int  main()
{
           #ifndef ONLINE_JUDGE
     freopen("test.txt","r",stdin);
   #endif

     cin>>n>>str;

     for(int i=0;i<n;i++){

            cc[str[i]-'a']++;
     }

    for(int i=0;i<26;i++){
         while(cc[i]){

            cout<<char('a'+i);
            cc[i]--;
         }

    }

 return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt" ,"w", stdout);
	#endif
	char str[100005],ans[100005],n;
	cin>>n;
	ll a[30]={0},b[30]={0},count=0,flag=0,p,q,j,k=1,l;
	ll i;
	scanf("%s",str);
	//cout<<str<<"\n";
	for(i=0;i<strlen(str);i++)
	{
		a[(ll)str[i]-96]++;
	}
	for(i=1;i<=26;i++)
	{
		p=a[i]%2;
		if(flag==0)
		{
			count=count+1;b[i]++;flag=1;
		}
		q=a[i]-a[i]%2;
		if(q>=2)
			{b[i]=b[i]+q;count=count+q;}
	}
	l=count;
	for(i=1;i<=26;i++)
	{
		if(b[i]==0)
				continue;
		p=b[i];
		if(p%2==0)
		{
			q=p/2;
			for(j=k;j<=k+p/2-1;j++)
			{
				ans[j]=(char)(i + 96);
			}
			k=j;
			for(j=l;j>=l-q+1;j--)
			{
				ans[j]=(char)(i + 96);
			}
			l=j;
		}
		if(p%2==1)
		{
			q=p/2;
			ans[count/2+1]=(char)(i + 96);
			for(j=k;j<=k+p/2-1;j++)
			{
				ans[j]=(char)(i + 96);
			}
			k=j;
			for(j=l;j>=l-q+1;j--)
			{
				ans[j]=(char)(i + 96);
			}
			l=j;
		}
	}
	for(i=1;i<=count;i++)
		cout<<ans[i];
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <utility>
#include <deque>
#include <list>
#include <sstream>
#include <fstream>
#include <complex>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <iostream>
#include <utility>
#include <iterator>
#include <numeric>
#include <climits>
#include <iomanip>

using namespace std;

#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)

#define ll long long
#define ld double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ll n;
    cin >> n;
    string s;
    cin >> s;
    int c[26]={0};
    for(ll i=0; i<n; i++)
    {
    	int x = s[i]-'a';
    	c[x]++;
    }
    string ans;
    int x = 0;
    int y = 1;
    ll i = 0;
    while(i<n)
    {
    	while((c[x]==0 || x==y) && x<=26)
    	{
    		x++;
    	}
    	while((c[y]==0 || y==x) && y<=26)
    		y++;
    	if(c[x]<=c[y] && c[x]!=c[y]-1)
    	{
    		if(x<26)
	    	{
	    		ans += 'a' + x;
	    		i++;
	    		c[x]--;
	    	}
	    	if(y<26)
	    	{
	    		ans += 'a' + y;
	    		c[y]--;
	    		i++;
	    	}
    	}
    	else
    	{
    		if(y<26)
	    	{
	    		ans += 'a' + y;
	    		c[y]--;
	    		i++;
	    	}
	    	if(x<26)
	    	{
	    		ans+='a' + x;
	    		c[x]--;
	    		i++;
	    	}
    	}

    }
    cout << ans << endl;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <utility>
#include <deque>
#include <list>
#include <sstream>
#include <fstream>
#include <complex>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <iostream>
#include <utility>
#include <iterator>
#include <numeric>
#include <climits>
#include <iomanip>

using namespace std;

#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)

#define ll long long
#define ld double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ll n;
    cin >> n;
    string s;
    cin >> s;
    int c[26]={0};
    for(ll i=0; i<n; i++)
    {
    	int x = s[i]-'a';
    	c[x]++;
    }
    char ans[n];
    int x = 0;
    int y = 1;
    ll i = 0;
    while(i<n)
    {
    	while((c[x]==0 || x==y) && x<=26)
    	{
    		x++;
    	}
    	while((c[y]==0 || y==x) && y<=26)
    		y++;
    	if(c[x]<=c[y] && c[x]!=c[y]-1)
    	{
    		if(x<26)
	    	{
	    		ans[i] = 'a' + x;
	    		i++;
	    		c[x]--;
	    	}
	    	if(y<26)
	    	{
	    		ans[i] = 'a' + y;
	    		c[y]--;
	    		i++;
	    	}
    	}
    	else
    	{
    		if(y<26)
	    	{
	    		ans[i] = 'a' + y;
	    		c[y]--;
	    		i++;
	    	}
	    	if(x<26)
	    	{
	    		ans[i] = 'a' + x;
	    		c[x]--;
	    		i++;
	    	}
    	}

    }
    cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt" ,"w", stdout);
	#endif
	char str[100005],ans[100005],n;
	cin>>n;
	ll a[30]={0},b[30]={0},count=0,flag=0,p,q,j,k=1,l;
	ll i;
	scanf(" %s",str);
	//cout<<str<<"\n";
	for(i=0;i<n;i++)
	{
		a[(ll)str[i]-96]++;
	}

	for(i=1;i<=26;i++)
	{
		p=a[i]%2;
		if(flag==0 && p==1)
		{
			count=count+1;b[i]++;flag=1;
		}
		q=a[i]-a[i]%2;
		if(q>=2)
			{b[i]=b[i]+q;count=count+q;}
	}
	l=count;
	for(i=1;i<=26;i++)
	{
		if(b[i]==0)
				continue;
		p=b[i];
		if(p%2==0)
		{
			q=p/2;
			for(j=k;j<=k+p/2-1;j++)
			{
				ans[j]=(char)(i+96);
			}
			k=j;
			for(j=l;j>=l-q+1;j--)
			{
				ans[j]=(char)(i+96);
			}
			l=j;
		}
		if(p%2==1)
		{
			q=p/2;
			ans[count/2+1]=(char)(i+96);
			for(j=k;j<=k+p/2-1;j++)
			{
				ans[j]=(char)(i+96);
			}
			k=j;
			for(j=l;j>=l-q+1;j--)
			{
				ans[j]=(char)(i+96);
			}
			l=j;
		}
	}
	for(i=1;i<=count;i++)
		cout<<ans[i];
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define vi vector<int>
#define ll	long long
#define pb push_back
#define pp pop_back
#define F first
#define S second
#define f(i,a,n) for(ll i=a;i<n;i++)
#define mod 998244353
#define MEM(a,n) memset(a,n,sizeof a)
struct let
{	int v;
	int i;
};
bool cmp(let a,let b)
{	return a.v>b.v;
}
int main()
{	int n;
	cin>>n;
	string s;
	let a[26];
	for(int i=0;i<26;i++)
	{	a[i].v=0;
		a[i].i=i;
	}
	cin>>s;
	f(i,0,n)
	{	a[s[i]-'a'].v++;
	}
	sort(a,a+26,cmp);
	string ans="";
	for(int i=0;i<25;i+=2)
	{	if(a[i].v>0 && a[i+1].v>0){
		int f=a[i].v;
		char c1=a[i].i+'a';
		//cout<<c1<<" "<<f<<endl;
		int g=a[i+1].v;
		char c2=a[i+1].i+'a';
		//cout<<c2<<" "<<endl;
		if((f+g)%2==1 || (f%2==1 && g%2==1))
		{	int j=0;
			bool next=false;
			while(j<f+g && f && g)
			{
				if(next && g)
				{	ans+=c2;
					g--;
					next=false;
				}
				else if(f)
				{ ans+=c1;
					next=true;
					f--;
				}
				j++;
			}
			if(f)
			{	for(int j=0;j<f;j++)
					ans+=c1;

			}
			else if(g)
			{	for(int j=0;j<f;j++)
					ans+=c2;
			}
		}
		else
		{	string ans1="";
			for(int j=0;j<g;j++)
				ans1+=c2;
			string temp="";
			for(int j=0;j<f/2;j++)
				temp+=c1;
			ans1+=temp;
			ans=ans+temp+ans1;
		}
		}

		else
		{	if(a[i].v>0)
			{	for(int j=0;j<a[i].v;j++)
				{	ans+=(char)(a[i].i+'a');
				}
			}
			break;
		}
	}
	cout<<ans.c_str()<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define vi vector<int>
#define ll	long long
#define pb push_back
#define pp pop_back
#define F first
#define S second
#define f(i,a,n) for(ll i=a;i<n;i++)
#define mod 998244353
#define MEM(a,n) memset(a,n,sizeof a)
struct let
{	int v;
	int i;
};
bool cmp(let a,let b)
{	return a.v>b.v;
}
int main()
{	int n;
	cin>>n;
	string s;
	let a[26];
	for(int i=0;i<26;i++)
	{	a[i].v=0;
		a[i].i=i;
	}
	cin>>s;
	f(i,0,n)
	{	a[s[i]-'a'].v++;
	}
	sort(a,a+26,cmp);
	string ans="";
	for(int i=0;i<25;i+=2)
	{	if(a[i].v>0 && a[i+1].v>0){
		int f=a[i].v;
		char c1=a[i].i+'a';
		//cout<<c1<<" "<<f<<endl;
		int g=a[i+1].v;
		char c2=a[i+1].i+'a';
		int tot=f+g;
		//cout<<c2<<" "<<endl;
		if((f+g)%2==1 || (f%2==1 && g%2==1))
		{	int j=0;
			bool next=false;
			while(j<tot && (f || g))
			{
				if(next && g)
				{	ans+=c2;
					g--;
					next=false;
				}
				else if(f)
				{ ans+=c1;
					next=true;
					f--;
				}
				//cout<<f<<" "<<g<<endl;
				j++;
			}
			if(f)
			{	for(int j=0;j<f;j++)
					ans+=c1;

			}
			else if(g)
			{	for(int j=0;j<g;j++)
					ans+=c2;
			}
		}
		else
		{	string ans1="";
			for(int j=0;j<g;j++)
				ans1+=c2;
			string temp="";
			for(int j=0;j<f/2;j++)
				temp+=c1;
			ans1+=temp;
			ans=ans+temp+ans1;
		}
		}

		else
		{	if(a[i].v>0)
			{	for(int j=0;j<a[i].v;j++)
				{	ans+=(char)(a[i].i+'a');
				}
			}
			break;
		}
	}
	cout<<ans.c_str()<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define vi vector<int>
#define ll	long long
#define pb push_back
#define pp pop_back
#define F first
#define S second
#define f(i,a,n) for(ll i=a;i<n;i++)
#define mod 998244353
#define MEM(a,n) memset(a,n,sizeof a)
struct let
{	int v;
	int i;
};
bool cmp(let a,let b)
{	return a.v>b.v;
}
int main()
{	int n;
	cin>>n;
	string s;
	let a[26];
	for(int i=0;i<26;i++)
	{	a[i].v=0;
		a[i].i=i;
	}
	cin>>s;
	f(i,0,n)
	{	a[s[i]-'a'].v++;
	}
	sort(a,a+26,cmp);
	string ans="";
	for(int i=0;i<25;i+=2)
	{	if(a[i].v>0 && a[i+1].v>0){
		int f=a[i].v;
		char c1=a[i].i+'a';
		//cout<<c1<<" "<<f<<endl;
		int g=a[i+1].v;
		char c2=a[i+1].i+'a';
		int tot=f+g;
		//cout<<c2<<" "<<endl;
		if((f+g)%2==1 || (f%2==1 && g%2==1))
		{	int j=0;
			bool next=false;
			while(j<tot && (f && g))
			{
				if(next && g)
				{	ans+=c2;
					g--;
					next=false;
				}
				else if(f)
				{ ans+=c1;
					next=true;
					f--;
				}
				//cout<<f<<" "<<g<<endl;
				j++;
			}
			if(f)
			{	for(int j=0;j<f;j++)
					ans+=c1;

			}
			else if(g)
			{	for(int j=0;j<g;j++)
					ans+=c2;
			}
		}
		else
		{	string ans1="";
			for(int j=0;j<g;j++)
				ans1+=c2;
			string temp="";
			for(int j=0;j<f/2;j++)
				temp+=c1;
			ans1+=temp;
			ans=ans+temp+ans1;
		}
		}

		else
		{	if(a[i].v>0)
			{	for(int j=0;j<a[i].v;j++)
				{	ans+=(char)(a[i].i+'a');
				}
			}
			break;
		}
	}
	cout<<ans.c_str()<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define vi vector<int>
#define ll	long long
#define pb push_back
#define pp pop_back
#define F first
#define S second
#define f(i,a,n) for(ll i=a;i<n;i++)
#define mod 998244353
#define MEM(a,n) memset(a,n,sizeof a)
struct let
{	int v;
	int i;
};
bool cmp(let a,let b)
{	return a.v>b.v;
}
int main()
{	int n;
	cin>>n;
	string s;
	let a[26];
	for(int i=0;i<26;i++)
	{	a[i].v=0;
		a[i].i=i;
	}
	cin>>s;
	f(i,0,n)
	{	a[s[i]-'a'].v++;
	}
	sort(a,a+26,cmp);
	string ans="";
	for(int i=0;i<25;i+=2)
	{	if(a[i].v>0 && a[i+1].v>0){
		int f=a[i].v;
		char c1=a[i].i+'a';
		//cout<<c1<<" "<<f<<endl;
		int g=a[i+1].v;
		char c2=a[i+1].i+'a';
		//cout<<c2<<" "<<endl;
		if((f+g)%2==1)
		{	int j=0;
			bool next=false;
			while(j<f+g)
			{
				if(next)
				{	ans+=c2;
					next=false;
				}
				else
				{ ans+=c1;
				next=true;
				}
				j++;
			}
			}
		else
		{	string ans1="";
			for(int j=0;j<g;j++)
				ans1+=c2;
			string temp="";
			for(int j=0;j<f/2;j++)
				temp+=c1;
			ans1+=temp;
			ans=ans+temp+ans1;
		}
		}
		else
		{	if(a[i].v>0)
			{	for(int j=0;j<a[i].v;j++)
				{	ans+=(char)(a[i].i+'a');
				}
			}
		}
	}
	cout<<ans.c_str()<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define vi vector<int>
#define ll	long long
#define pb push_back
#define pp pop_back
#define F first
#define S second
#define f(i,a,n) for(ll i=a;i<n;i++)
#define mod 998244353
#define MEM(a,n) memset(a,n,sizeof a)
struct let
{	int v;
	int i;
};
bool cmp(let a,let b)
{	return a.v>b.v;
}
int main()
{	int n;
	cin>>n;
	string s;
	let a[26];
	for(int i=0;i<26;i++)
	{	a[i].v=0;
		a[i].i=i;
	}
	cin>>s;
	f(i,0,n)
	{	a[s[i]-'a'].v++;
	}
	sort(a,a+26,cmp);
	string ans="";
	for(int i=0;i<25;i+=2)
	{	if(a[i].v>0 && a[i+1].v>0){
		int f=a[i].v;
		char c1=a[i].i+'a';
		//cout<<c1<<" "<<f<<endl;
		int g=a[i+1].v;
		char c2=a[i+1].i+'a';
		//cout<<c2<<" "<<endl;
		if((f+g)%2==1 || (f%2==1 && g%2==1))
		{	int j=0;
			bool next=false;
			while(j<f+g)
			{
				if(next)
				{	ans+=c2;
					next=false;
				}
				else
				{ ans+=c1;
				next=true;
				}
				j++;
			}
			}
		else
		{	string ans1="";
			for(int j=0;j<g;j++)
				ans1+=c2;
			string temp="";
			for(int j=0;j<f/2;j++)
				temp+=c1;
			ans1+=temp;
			ans=ans+temp+ans1;
		}
		}
		else
		{	if(a[i].v>0)
			{	for(int j=0;j<a[i].v;j++)
				{	ans+=(char)(a[i].i+'a');
				}
			}
		}
	}
	cout<<ans.c_str()<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define vi vector<int>
#define ll	long long
#define pb push_back
#define pp pop_back
#define F first
#define S second
#define f(i,a,n) for(ll i=a;i<n;i++)
#define mod 998244353
#define MEM(a,n) memset(a,n,sizeof a)
struct let
{	int v;
	int i;
};
bool cmp(let a,let b)
{	return a.v>b.v;
}
int main()
{	int n;
	cin>>n;
	string s;
	let a[26];
	for(int i=0;i<26;i++)
	{	a[i].v=0;
		a[i].i=i;
	}
	cin>>s;
	f(i,0,n)
	{	a[s[i]-'a'].v++;
	}
	sort(a,a+26,cmp);
	string ans="";
	for(int i=0;i<25;i+=2)
	{	if(a[i].v>0 && a[i+1].v>0){
		int f=a[i].v;
		char c1=a[i].i+'a';
		//cout<<c1<<" "<<f<<endl;
		int g=a[i+1].v;
		char c2=a[i+1].i+'a';
		int tot=f+g;
		//cout<<c2<<" "<<endl;
		/*if((f+g)%2==1 || (f%2==1 && g%2==1))
		{	int j=0;
			bool next=false;
			while(j<tot && (f && g))
			{
				if(next && g)
				{	ans+=c2;
					g--;
					next=false;
				}
				else if(f)
				{ ans+=c1;
					next=true;
					f--;
				}
				//cout<<f<<" "<<g<<endl;
				j++;
			}
			if(f)
			{	for(int j=0;j<f;j++)
					ans+=c1;

			}
			else if(g)
			{	for(int j=0;j<g;j++)
					ans+=c2;
			}
		}
		else
		{
		*/if(f%2==1)
			{	swap(f,g);
			}
			string ans1="";
			for(int j=0;j<g;j++)
				ans1+=c2;
			string temp="";
			for(int j=0;j<f/2;j++)
				temp+=c1;

			ans1+=temp;
			if(f%2)
				ans1+=c1;
			ans=ans+temp+ans1;
		//}
		}

		else
		{	if(a[i].v>0)
			{	for(int j=0;j<a[i].v;j++)
				{	ans+=(char)(a[i].i+'a');
				}
			}
			break;
		}
	}
	cout<<ans.c_str()<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define vi vector<int>
#define ll	long long
#define pb push_back
#define pp pop_back
#define F first
#define S second
#define f(i,a,n) for(ll i=a;i<n;i++)
#define mod 998244353
#define MEM(a,n) memset(a,n,sizeof a)
int main()
{	int n;
	cin>>n;
	string s;
	cin>>s;
	sort(s.begin(),s.end());
	cout<<s<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
const int maxn = 1e5 + 10;
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    for(int i = n - 1; i >= 0; i--)
        cout << s[i];
    cout << endl;
    return 0;

}


#include <bits/stdc++.h>
#define ll long long
const int maxn = 1e5 + 10;
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    cout << s << endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
const int maxn = 1e5 + 10;
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = n - 1; i >= 0; i--)
        cout << s[i];
    cout << endl;
    return 0;

}


///////////////////////////
//         INFO          //
//                       //
//    Handle -> Scayre   //
//                       //
//   Template vers. 1.1  //
//                       //
//   It'll be accepted   //
//                       //
///////////////////////////

//████╗████████╗██╗███████╗══███╗═══███╗████████╗════//
//═██╔╝═══██╔══╝╚█║██╔════╝══████╗═████║██╔═════╝═══//
//═██║════██║════╚╝███████╗══██╔████╔██║█████╗══════//
//═██║════██║══════╚════██║══██║╚██╔╝██║██╔══╝══════//
//████╗═══██║══════███████║══██║═╚═╝═██║███████╗═════//

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <complex>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>

#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);

#define f first
#define s second

#define inf (int)1e9 + 7

#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define mp(x,y) make_pair(x,y)

#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)

#define pb push_back
#define ppb pop_back

#define bitcoin __builtin_popcount

#define endl "\n"

#define in(x) insert(x)

#define sz(x) (int)x.size()

#define all(x) x.begin(),x.end()

#define pw2(x) (1<<x) //2^x

#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)

#define sqr(x) ((x) * 1ll * (x))

#define UpdateRandom srand (time(NULL));

using namespace std;

const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;

int n,m;

string s;

int a[N];

int main(){

	#ifdef IOI2019
		freopen ("in.txt", "r", stdin);
	#endif

	NFS

	cin >> n;

	cin >> s;

	sort(all(s));

	cout << s << endl;

	#ifdef IOI2019
		cout << "\nTime Elapsed : " << clock () * 1.0 / CLOCKS_PER_SEC << endl;
	#endif

	ioi
}


///////////////////////////
//         INFO          //
//                       //
//    Handle -> Scayre   //
//                       //
//   Template vers. 1.1  //
//                       //
//   It'll be accepted   //
//                       //
///////////////////////////

//████╗████████╗██╗███████╗══███╗═══███╗████████╗════//
//═██╔╝═══██╔══╝╚█║██╔════╝══████╗═████║██╔═════╝═══//
//═██║════██║════╚╝███████╗══██╔████╔██║█████╗══════//
//═██║════██║══════╚════██║══██║╚██╔╝██║██╔══╝══════//
//████╗═══██║══════███████║══██║═╚═╝═██║███████╗═════//

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <complex>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>

#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);

#define f first
#define s second

#define inf (int)1e9 + 7

#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define mp(x,y) make_pair(x,y)

#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)

#define pb push_back
#define ppb pop_back

#define bitcoin __builtin_popcount

#define endl "\n"

#define sz(x) (int)x.size()

#define all(x) x.begin(),x.end()

#define pw2(x) (1<<x) //2^x

#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)

#define sqr(x) ((x) * 1ll * (x))

using namespace std;

const int N = (int)3e3 + 7, MOD = (int)1e9 + 7;

unordered_map<char,int> cnt;

vector<char> v;

string s;

int n;

int x,y,cx,cy,px,py,a,b;

vector<pair<int,char>> m;

int dx[]={-1,0,1,0},dy[]={0,1,0,-1};

char c;

int main(){

	#ifdef IOI2019
		freopen ("in.txt", "r", stdin);
	#endif

	NFS

	cin >> n;

	cin >> s;

	for(int i=0;i<sz(s);i++){
		v.pb(s[i]);
	}

	for(char i='a';i<='z';i++){
		for(int j=0;j<sz(v);j++){
				if(v[j]==i){
					cnt[i]++;
				}
		}
		if(cnt[i]!=0){
			m.pb({cnt[i],i});
		}
	}

	sort(all(m));

	for(int i=sz(m)-1;i>=0;i-=2){
		if(i==0){
			for(int j=0;j<m[i].f;j++){
				cout << m[i].s;
			}
		}
		else{
			string st="";
			st+=m[i].s;
			st+=m[i-1].s;
			for(int j=0;j<min(m[i].f,m[i-1].f);j++){
				cout << st;
			}
			for(int j=0;j<m[i].f-m[i-1].f;j++){
				cout << m[i].s;
			}
		}
	}

	cout << endl;

	#ifdef IOI2019
		cout << "\nTime Elapsed : " << clock () * 1.0 / CLOCKS_PER_SEC << endl;
	#endif

	ioi
}


///////////////////////////
//         INFO          //
//                       //
//    Handle -> Scayre   //
//                       //
//   Template vers. 1.1  //
//                       //
//   It'll be accepted   //
//                       //
///////////////////////////

//████╗████████╗██╗███████╗══███╗═══███╗████████╗════//
//═██╔╝═══██╔══╝╚█║██╔════╝══████╗═████║██╔═════╝═══//
//═██║════██║════╚╝███████╗══██╔████╔██║█████╗══════//
//═██║════██║══════╚════██║══██║╚██╔╝██║██╔══╝══════//
//████╗═══██║══════███████║══██║═╚═╝═██║███████╗═════//

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <complex>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>

#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);

#define f first
#define s second

#define inf (int)1e9 + 7

#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define mp(x,y) make_pair(x,y)

#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)

#define pb push_back
#define ppb pop_back

#define bitcoin __builtin_popcount

#define endl "\n"

#define sz(x) (int)x.size()

#define all(x) x.begin(),x.end()

#define pw2(x) (1<<x) //2^x

#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)

#define sqr(x) ((x) * 1ll * (x))

using namespace std;

const int N = (int)3e3 + 7, MOD = (int)1e9 + 7;

unordered_map<char,int> cnt;

vector<char> v;

string s;

int n;

int x,y,cx,cy,px,py,a,b;

vector<pair<int,char>> m;

int dx[]={-1,0,1,0},dy[]={0,1,0,-1};

char c;

int main(){

	#ifdef IOI2019
		freopen ("in.txt", "r", stdin);
	#endif

	NFS

	cin >> n;

	cin >> s;

	for(int i=0;i<sz(s);i++){
		v.pb(s[i]);
	}

	for(char i='a';i<='z';i++){
		for(int j=0;j<sz(v);j++){
				if(v[j]==i){
					cnt[i]++;
				}
		}
		if(cnt[i]!=0){
			m.pb({cnt[i],i});
		}
	}

	sort(all(m));

	for(int i=sz(m)-1;i>=0;i-=2){
		sort(all(m));
		if(i==0){
			for(int j=0;j<m[i].f;j++){
				cout << m[i].s;
			}
		}
		else{
			string st="";
			st+=m[i].s;
			st+=m[i-1].s;
			for(int j=0;j<min(m[i].f,m[i-1].f);j++){
				cout << st;
			}
			for(int j=0;j<m[i].f-m[i-1].f;j++){
				cout << m[i].s;
			}
		}
	}

	cout << endl;

	#ifdef IOI2019
		cout << "\nTime Elapsed : " << clock () * 1.0 / CLOCKS_PER_SEC << endl;
	#endif

	ioi
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
using namespace std;

ll n,ans[3000000],dist='z'-'a'+1;
string s;
pair<ll,ll> f[30];
set<ll> pos;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> s;
    for(ll i=0; i<n; i++) f[s[i]-'a'].fi--,f[s[i]-'a'].se=s[i]-'a';
    sort(f,f+'z'-'a');
    for(ll i=0; i<3000000; i++) ans[i]=-1,pos.insert(i);

    for(ll i=0; i<'z'-'a'+1; i++){
        if(f[i].fi==0) continue;
       // cout << f[i].se << " " << f[i].fi << " " << *pos.begin() << endl;
        f[i].fi*=-1;
        ll ini=*pos.begin();
        for(ll j=0; j<f[i].fi; j++){
            ans[ini+dist*j]=f[i].se;
            pos.erase(ini+dist*j);
        }
    }

    for(ll i=0; i<3000000; i++){
        if(ans[i]==-1) continue;
        cout << char(ans[i]+'a');
    }

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
using namespace std;

ll n,ans[3000000],dist='z'-'a'+1;
string s;
pair<ll,ll> f[30];
set<ll> pos;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> s;
    sort(s.begin(),s.end());
    cout << s;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
using namespace std;

queue<ll> l1;
stack<ll> l2;
ll n,f[30];
string s;
char special='#';

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> s;
    for(ll i=0; i<n; i++) f[s[i]-'a']++;

    bool band=true;
    while(band){
        band=false;
        for(ll i=0; i<='z'-'a'; i++){
            if(f[i]==0) continue;
            if(f[i]>0) band=true;
            if(f[i]==1){
                if(special=='#'){
                    special=(char)(i+'a');
                    f[i]--;
                    continue;
                }
                cout << (char)(i+'a');
                f[i]--;
                continue;
            }
            l1.push(i);
            l2.push(i);
            f[i]-=2;
        }
    }

    while(!l1.empty()){
        cout << (char)(l1.front()+'a');
        l1.pop();
    }
    if(special!='#') cout << special;
    while(!l2.empty()){
        cout << (char)(l2.top()+'a');
        l2.pop();
    }

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
using namespace std;

ll n,ans[400000];
string s;
pair<ll,ll> f[30];
set<ll> pos;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> s;
    for(ll i=0; i<n; i++) f[s[i]-'a'].fi--,f[s[i]-'a'].se=s[i]-'a';
    sort(f,f+'z'-'a');
    for(ll i=0; i<400000; i++) ans[i]=-1,pos.insert(i);

    for(ll i=0; i<'z'-'a'+1; i++){
        if(f[i].fi==0) continue;
       // cout << f[i].se << " " << f[i].fi << " " << *pos.begin() << endl;
        f[i].fi*=-1;
        ll ini=*pos.begin();
        for(ll j=0; j<f[i].fi; j++){
            ans[ini+2*j]=f[i].se;
            pos.erase(ini+2*j);
        }
    }

    for(ll i=0; i<400000; i++){
        if(ans[i]==-1) continue;
        cout << char(ans[i]+'a');
    }

    return 0;
}