import sys

global string
global lookahead

def match(char):
	global string
	global lookahead
	if lookahead != char:
		print "REJECT"
		sys.exit(0)
	else:
		string = string[1:]
		if len(string) > 0:
			lookahead = string[0]
		else:
			lookahead = "DNE"

def slurpy():
	slimp()
	slump()
	
def slimp():
	match("A")
	restSlimp()
	
def restSlimp():
	if lookahead is "H":
		match("H")
	elif lookahead is "B":
		match("B")
		slimp()
		match("C")
	else:
		slump()
		match("C")
		
def slump():
	dOrE()
	match("F")
	fString()
	end()
	
def dOrE():
	if lookahead is "D":
		match("D")
	else:
		match("E")

def fString():
	if lookahead is "F":
		match("F")
		fString()
		
def end():
	if lookahead is "G":
		match("G")
	else:
		slump()

def main():
	global string
	global lookahead
	string = raw_input("?")
	lookahead = string[0]
	slurpy()
	print "ACCEPT"


if __name__ == "__main__":
	main()

