#include <iostream>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <deque>
using namespace std;
#define maxN 20007
int a[maxN];
int n;
struct op
{
int curL;
int curR;
bool curAsc;
};
vector<op>allOp[20];
int cntLayer = 1;
void readData()
{
cin >> n;
for(int i = 1; i <= n; i++)
cin >> a[i];
}
void gen()
{
op temp;
temp.curL = 1;
temp.curR = n;
temp.curAsc = false;
allOp[1].push_back(temp);
if(n == 1)
return;
bool nextLayer = true;
for(int i = 2; i < 20; i++)
{
cntLayer = i;
for(int j = 0; j < allOp[i-1].size(); j++)
{
int mid = (allOp[i-1][j].curL+allOp[i-1][j].curR)/2;
temp.curL = allOp[i-1][j].curL;
temp.curR = mid;
temp.curAsc = 1-allOp[i-1][j].curAsc;
if(temp.curR-temp.curL == 0)
nextLayer = false;
allOp[i].push_back(temp);
temp.curL = mid+1;
temp.curR = allOp[i-1][j].curR;
temp.curAsc = allOp[i-1][j].curAsc;
allOp[i].push_back(temp);
if(temp.curR-temp.curL == 0)
nextLayer = false;
}
if(!nextLayer)
return;
}
}
void solve()
{
/*for(int i = 1; i < 20; i++)
{
for(int j = 0; j < allOp[i].size(); j++)
{
cout << allOp[i][j].curL << " " <<allOp[i][j].curR << " ";
if(allOp[i][j].curAsc)
cout << "ASC\n";
else cout << "DESC\n";
}
cout << "\n";
}*/
deque<int>cur;
for(int i = 1; i <= n; i++)
{
cur.push_back(a[i]);
cout << "C";
}
deque<int>curInS;
deque<int>curInQ;
op temp;
for(int i = 19; i >= 1; i--)
{
for(int j = 0; j < allOp[i].size(); j++)
{
temp = allOp[i][j];
if(temp.curL == temp.curR)
{
cout << "HC";
cur.push_back(cur.front());
cur.pop_front();
continue;
}
int mid = (temp.curL+temp.curR)/2;
for(int k = temp.curL; k <= mid; k++)
{
cout << "H";
curInS.push_back(cur.front());
cur.pop_front();
}
for(int k = mid+1; k <= temp.curR; k++)
{
curInQ.push_back(cur.front());
cur.pop_front();
}
while(!curInS.empty() || !curInQ.empty())
{
if(!curInS.empty() && curInQ.empty())
{
cout << "C";
cur.push_back(curInS.back());
curInS.pop_back();
}
else if(curInS.empty() && !curInQ.empty())
{
cout << "HC";
cur.push_back(curInQ.front());
curInQ.pop_front();
}
else
{
int addType = 0; //0 - stack, 1 - queue
if(temp.curAsc)
{
if(curInQ.front() < curInS.back())
addType = 1;
}
else if(curInQ.front() > curInS.back())
addType = 1;
if(addType == 0)
{
cout << "C";
cur.push_back(curInS.back());
curInS.pop_back();
}
else
{
cout << "HC";
cur.push_back(curInQ.front());
curInQ.pop_front();
}
}
}
}
}
for(int i = 1; i <= n; i++) cout << "H";
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
readData();
gen();
solve();
return 0;
}