dont-jump

Chandu and Kundu are bored of dramatic games around. As they are very good friends and scholars they decided to discover a new game.  
In total they had N number of marbles with value inscribed on each of them from 1 to N. 
Chandu being from royal family has a treasure box. He emptied the box for the game to proceed.   

The game rule involved following operations : 
- Operation C : Chandu places a marble in the box. Each different marble can move inside the box only once. 
- Operation K : Kundu removes last entered marble from the box and notes down it's value on a chart.   

They were deciding further rules when a third person Mr. Chirp comes as a spoiler of the game.
Chirp gives them a number N which is the maximum value inscribed among all marbles, and a sequence P. P can possibly be empty. In that case, in input an empty line would be there.   

Also, he added following restriction : 
- Kundu can perform operation K to take out a marble M only when all the marbles from values 1 to M-1 have went in the box before.    

Mr. Chirp kept on chirping and told Chandu and Kundu to generate the sequence of C's and K's for the chart to get filled by pattern P. 
Now, you have to help these kids before they jump out of their window in frustration.

Input Format : 
First line contains a number N. Next line contains a pattern P(possibly empty). 
Read till end of file.Note: Maximum input cases in a file doesn't exceed 2*10^4.

Output Format :
For each case output on a separate line the minimum length pattern of C's and K's. Print -1 if it's not possible to generate the pattern using the given operations.   

Constraints : 
1 ≤ N ≤ 10^5 
0 ≤ len(P) ≤ 100
1 ≤ P[i] ≤ N

SAMPLE INPUT
41
6 11 8

SAMPLE OUTPUT
CCCCCCKCCCCCKKKK

Explanation

For getting 6 on chart first we need six C Operations for 1,2,3,4,5 and 6 followed by one K operation for getting 6 out. Afterwards for 11 we perform five C operations for 7,8,9,10,11 followed by one K operation. And finally, for 8 we need four K operations for 10, 9, 8 respectively.

Source: hackerearth | Difficulty: MEDIUM
Tags: Ad-hoc


Solutions:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
import sys
while True:
	line = sys.stdin.readline()
	if not line:
		break
	marble_num = int(line.strip())
	marble_stack = []
	cont_stack = []
	for i in range(1, marble_num):
		marble_stack.append(i)
	
	line = sys.stdin.readline()
	split = line.strip().split(" ")
	if split != [""]:
		patt = [int(x) for x in split]
	else:
		patt = []
	string = []
	pssb = True
	for i in patt:
		while True:
			if not cont_stack:
				string.append("C")
				if marble_stack:
					cont_stack.append(marble_stack.pop(0))
				else:
					pssb = False
					break
			elif cont_stack[-1] < i:
				string.append("C")
				if marble_stack:
					cont_stack.append(marble_stack.pop(0))
				else:
					pssb = False
					break
			elif cont_stack[-1] > i:
				string.append("K")
				cont_stack.pop()
			else:
				string.append("K")
				cont_stack.pop()
				break
		if not pssb:
			break
	if pssb:
		print("".join(string))
	else:
		print(-1)


import sys
lines=[e.replace('\n','') for e in sys.stdin.readlines()]

def function(s,n):
	if len(s)>0:
		p=[int(e) for e in s.split(' ')]
	else:
		print('')
		return 0

	stack=[0]
	prev=0
	st=''
	for e in p:
		while stack[-1]<e:
			st+='C'
			prev+=1
			stack.append(prev)
		while stack[-1]>=e:
			i=stack.pop()
			st+='K'
		if i!=e:
			print(-1)
			return 0
	print(st)
		

i=0
while(i<len(lines)-1):
	function(lines[i+1],int(lines[i]))
	i+=2



import sys
lines=[e.replace('\n','') for e in sys.stdin.readlines()]

def function(s,n):
	if len(s)>0:
		p=[int(e) for e in s.split(' ')]
	else:
		print('')
		return 0

	stack=[0]
	prev=0
	st=''
	for e in p:
		while stack[-1]<e:
			st+='C'
			prev+=1
			stack.append(prev)
		while stack[-1]>=e:
			i=stack.pop()
			st+='K'
		if i!=e:
			print(-1)
			return 0
	print(st)
		

i=0
while(i<len(lines)-1):
	function(lines[i+1],int(lines[i]))
	i+=2


import sys
lines=[e.replace('\n','') for e in sys.stdin.readlines()]

def function(s,n):
	if len(s)>0:
		p=[int(e) for e in s.split(' ')]
	else:
		print('')
		return 0

	stack=[0]
	prev=0
	st=''
	for e in p:
		while stack[-1]<e:
			st+='C'
			prev+=1
			stack.append(prev)
		while stack[-1]>=e:
			i=stack.pop()
			st+='K'
		if i!=e:
			print(-1)
			return 0
	print(st)
		

i=0
while(i<len(lines)-1):
	function(lines[i+1],int(lines[i]))
	i+=2