The process of mammoth's genome decoding in Berland comes to its end!

One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a string consisting of letters 'A', 'C', 'G', 'T' and characters '?'.

It is known that the number of nucleotides of each of the four types in the decoded genome of mammoth in Berland should be equal.

Your task is to decode the genome and replace each unrecognized nucleotide with one of the four types so that the number of nucleotides of each of the four types becomes equal.


-----Input-----

The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome.

The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.


-----Output-----

If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).


-----Examples-----
Input
8
AG?C??CT

Output
AGACGTCT

Input
4
AGCT

Output
AGCT

Input
6
????G?

Output
===

Input
4
AA??

Output
===



-----Note-----

In the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.

In the second example the genome is already decoded correctly and each nucleotide is exactly once in it.

In the third and the fourth examples it is impossible to decode the genom.

Difficulty: EASY

Solutions:
def main():
	n = int(input().strip())
	st = input().strip()
	if n % 4:
		print('===')
		return
	li = [0] * 5
	t = n // 4
	for i in st:
		if i == '?':
			li[0] += 1
		elif i == 'A':
			li[1] += 1
		elif i == 'C':
			li[2] += 1
		elif i == 'G':
			li[3] += 1
		else:
			li[4] += 1
	for i in li[1:]:
		if i > t:
			print('===')
			return
	string = ''
	for i in st:
		d = i
		if d == '?':
			for p in range(1, 5):
				if li[p] < t:
					li[p] += 1
					if p == 1:
						d = 'A'
					elif p == 2:
						d = 'C'
					elif p == 3:
						d = 'G'
					else:
						d = 'T'
					break
		string += d
	print(string)
main()


n = int(input())
s = input()
A = s.count('A')
C = s.count('C')
G = s.count('G')
T = s.count('T')
Max = n / 4
if n % 4 == 0 and max(A, C, G, T) <= Max:
	if '?' not in s:
		print(s)
	else:
		s = list(s)
		for i in range(n):
			if s[i] == '?':
				if A < Max:
					s[i] = 'A'
					A += 1
				elif C < Max:
					s[i] = 'C'
					C += 1
				elif G < Max:
					s[i] = 'G'
					G += 1
				elif T < Max:
					s[i] = 'T'
					T += 1
				else:
					break
		print(''.join(s))
else:
	print('===')


n = int(input())
st = input()
if n % 4 != 0:
	print('===')
else:
	(ca, cb, cc, cd) = (0, 0, 0, 0)
	av = n // 4
	for i in range(len(st)):
		if st[i] == 'A':
			ca += 1
		elif st[i] == 'C':
			cb += 1
		elif st[i] == 'G':
			cc += 1
		elif st[i] == 'T':
			cd += 1
	if ca > av or cb > av or cc > av or (cd > av):
		print('===')
	else:
		(aa, ab, ac, ad) = (av - ca, av - cb, av - cc, av - cd)
		ss = aa * 'A' + ab * 'C' + ac * 'G' + ad * 'T'
		cnt = 0
		for i in range(len(st)):
			if st[i] == '?':
				print(ss[cnt], end='')
				cnt += 1
			else:
				print(st[i], end='')


n = int(input())
s = input()
if n % 4 != 0:
	print('===')
else:
	bkv = []
	bkv.append(s.count('A'))
	bkv.append(s.count('C'))
	bkv.append(s.count('G'))
	bkv.append(s.count('T'))
	mx = max(bkv)
	if mx > n / 4:
		print('===')
	else:
		ma = n // 4
		A = bkv[0]
		C = bkv[1]
		G = bkv[2]
		T = bkv[3]
		nom = 0
		st = ''
		for i in s:
			if i == '?':
				if A < ma:
					A += 1
					st += 'A'
				elif C < ma:
					C += 1
					st += 'C'
				elif G < ma:
					G += 1
					st += 'G'
				elif T < ma:
					T += 1
					st += 'T'
			else:
				st += i
		print(st)


n = int(input())
s = input()
acgt = [0 for i in range(4)]
vopros = 0
if n % 4 == 0:
	for nukl in s:
		if nukl == 'A':
			acgt[0] += 1
		elif nukl == 'C':
			acgt[1] += 1
		elif nukl == 'G':
			acgt[2] += 1
		elif nukl == 'T':
			acgt[3] += 1
		else:
			vopros += 1
	for i in range(n // 4 - acgt[0]):
		s = s.replace('?', 'A', 1)
		vopros -= 1
	for i in range(n // 4 - acgt[1]):
		s = s.replace('?', 'C', 1)
		vopros -= 1
	for i in range(n // 4 - acgt[2]):
		s = s.replace('?', 'G', 1)
		vopros -= 1
	for i in range(n // 4 - acgt[3]):
		s = s.replace('?', 'T', 1)
		vopros -= 1
	if vopros == 0:
		print(s)
	else:
		print('===')
else:
	print('===')


n = int(input())
s = input()
s = list(s)
(a, c, g, t) = (0, 0, 0, 0)
div = n / 4
for i in range(0, n, 1):
	if s[i] == 'A':
		a += 1
	elif s[i] == 'C':
		c += 1
	elif s[i] == 'G':
		g += 1
	elif s[i] == 'T':
		t += 1
if n % 4 == 0 and a <= div and (c <= div) and (g <= div) and (t <= div):
	for j in range(0, len(s), 1):
		if s[j] != '?':
			continue
		if a < div:
			s[j] = 'A'
			a += 1
			continue
		if c < div:
			s[j] = 'C'
			c += 1
			continue
		if g < div:
			s[j] = 'G'
			g += 1
			continue
		if t < div:
			s[j] = 'T'
			t += 1
			continue
if a == div and c == div and (g == div) and (t == div):
	print(''.join(s))
else:
	print('===')


n = int(input())
s = input()

def F(n, s):
	if n % 4 > 0:
		return '==='
	for c in 'ACGT':
		if 4 * s.count(c) > n:
			return '==='
	r = ''
	for c in 'ACGT':
		r += c * (n // 4 - s.count(c))
	j = 0
	res = ''
	for c in s:
		if c == '?':
			res += r[j]
			j += 1
		else:
			res += c
	return res
print(F(n, s))


n = input('')
Gene = list(input(''))
l = len(Gene) / 4
for i in range(len(Gene)):
	if Gene[i] == '?':
		if Gene.count('A') != l:
			Gene[i] = 'A'
		elif Gene.count('C') != l:
			Gene[i] = 'C'
		elif Gene.count('G') != l:
			Gene[i] = 'G'
		elif Gene.count('T') != l:
			Gene[i] = 'T'
if Gene.count('A') == Gene.count('G') and Gene.count('A') == Gene.count('T') and (Gene.count('A') == Gene.count('C')) and (Gene.count('G') == Gene.count('T')) and (Gene.count('G') == Gene.count('C')) and (Gene.count('T') == Gene.count('C')):
	for i in Gene:
		print(i, end='')
else:
	print('===')


def solve():
	_ = input()
	genom = list(input().strip())
	cntr = {'A': 0, 'C': 0, 'G': 0, 'T': 0, '?': 0}
	for g in genom:
		cntr[g] += 1
	q = cntr['?']
	del cntr['?']
	maxval = max(cntr.values())
	needed = sum((maxval - val for val in cntr.values()))
	if needed > q:
		return '==='
	if (q - needed) % 4 != 0:
		return '==='
	maxval += (q - needed) // 4
	acgt = ('A', 'C', 'G', 'T')
	for i in range(len(genom)):
		if genom[i] == '?':
			for g in acgt:
				if cntr[g] < maxval:
					genom[i] = g
					cntr[g] += 1
					break
	return ''.join(genom)
print(solve())


import sys
n = int(input())
genome = input()
if n % 4 != 0:
	print('===')
elif n % 4 == 0:
	for letter in 'ACGT':
		x = 0
		x = genome.count(letter)
		if x > n / 4:
			print('===')
			sys.exit()
		elif x == n / 4:
			pass
		elif x < n / 4:
			y = int(n / 4 - x)
			genome = genome.replace('?', letter, y)
	print(genome)


c = lambda s, i: s.count(i)
z = lambda : int(input())
x = lambda : input()
f = lambda : map(int, input().split())
n = z()
s = x()
l = [c(s, 'A'), c(s, 'C'), c(s, 'G'), c(s, 'T')]
if any((i > n // 4 for i in l)) or n % 4 != 0:
	exit(print('==='))
s = s.replace('?', 'A', n // 4 - l[0])
s = s.replace('?', 'C', n // 4 - l[1])
s = s.replace('?', 'G', n // 4 - l[2])
s = s.replace('?', 'T', n // 4 - l[3])
print(s)


n = int(input())
ch = input()
if n % 4 != 0:
	print('===')
else:
	a = g = c = t = 0
	for x in ch:
		if x == 'A':
			a = a + 1
		if x == 'C':
			c = c + 1
		if x == 'G':
			g = g + 1
		if x == 'T':
			t = t + 1
	if a > n // 4 or g > n // 4 or c > n // 4 or (t > n // 4):
		print('===')
	else:
		for i in range(n):
			if ch[i] != '?':
				print(ch[i], end='')
			elif a < n // 4:
				print('A', end='')
				a = a + 1
			elif c < n // 4:
				print('C', end='')
				c = c + 1
			elif g < n // 4:
				print('G', end='')
				g = g + 1
			else:
				print('T', end='')


entrada = int(input())
line1 = str(input())
line2 = []
if entrada % 4 != 0:
	print('===')
	exit(0)
maxi = entrada / 4
a = 0
c = 0
g = 0
t = 0
for it in line1:
	line2.append(it)
	if it == 'A':
		a = a + 1
	elif it == 'C':
		c = c + 1
	elif it == 'G':
		g = g + 1
	elif it == 'T':
		t = t + 1
if a > maxi or c > maxi or g > maxi or (t > maxi):
	print('===')
	exit(0)
con = 0
for i in line2:
	if i == '?' and a < maxi:
		line2[con] = 'A'
		a = a + 1
	elif i == '?' and c < maxi:
		line2[con] = 'C'
		c = c + 1
	elif i == '?' and g < maxi:
		line2[con] = 'G'
		g = g + 1
	elif i == '?' and t < maxi:
		line2[con] = 'T'
		t = t + 1
	con = con + 1
print(''.join(line2))


n = int(input())
code = list(input())
A = code.count('A')
C = code.count('C')
G = code.count('G')
T = code.count('T')
if n % 4 == 0:
	m = n / 4
	if A <= m and C <= m and (G <= m) and (T <= m):
		for i in range(n):
			if code[i] == '?':
				if A < m:
					code[i] = 'A'
					A = A + 1
				elif C < m:
					code[i] = 'C'
					C = C + 1
				elif G < m:
					code[i] = 'G'
					G = G + 1
				elif T < m:
					code[i] = 'T'
					T = T + 1
		print(''.join(map(str, code)))
	else:
		print('===')
else:
	print('===')


n = int(input())
s = str(input())
b1 = s.count('A')
b2 = s.count('C')
b3 = s.count('G')
b4 = s.count('T')
l = len(s)
t = len(s) // 4
l1 = []
for i in s:
	l1.append(i)
if len(s) % 4 != 0:
	print('===')
else:
	for i in range(l):
		if l1[i] == '?':
			if b1 < t:
				l1[i] = 'A'
				b1 += 1
			elif b2 < t:
				l1[i] = 'C'
				b2 += 1
			elif b3 < t:
				l1[i] = 'G'
				b3 += 1
			elif b4 < t:
				l1[i] = 'T'
				b4 += 1
	if b1 == b2 and b1 == b3 and (b1 == b4):
		for i in range(l):
			print(l1[i], end='')
	else:
		print('===')


n = int(input())
s = input()
sp = s
ds = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
k = n // 4
if n % 4 != 0:
	sp = '==='
else:
	for i in s:
		if i != '?':
			ds.update({i: ds.get(i) + 1})
	for j in ds:
		if ds.get(j) > k:
			sp = '==='
	if sp != '===':
		for i in s:
			if i == '?':
				for j in ds:
					if ds.get(j) < k:
						ds.update({j: ds.get(j) + 1})
						sp = sp.replace('?', j, 1)
						break
print(sp)


n = int(input())
s = input()
a = c = g = t = 0
if n % 4 != 0:
	print('===')
else:
	m = n // 4
	for i in range(len(s)):
		if s[i] == 'A':
			a += 1
		elif s[i] == 'C':
			c += 1
		elif s[i] == 'G':
			g += 1
		elif s[i] == 'T':
			t += 1
	s = s.replace('?', 'A', m - a)
	s = s.replace('?', 'C', m - c)
	s = s.replace('?', 'G', m - g)
	s = s.replace('?', 'T', m - t)
	if s.count('A') == s.count('C') == s.count('G') == s.count('T'):
		print(s)
	else:
		print('===')


n = int(input())
s = input()
ca = 0
cg = 0
cc = 0
ct = 0
ques = 0
for i in s:
	if i == 'A':
		ca += 1
	elif i == 'G':
		cg += 1
	elif i == 'C':
		cc += 1
	elif i == 'T':
		ct += 1
	else:
		ques += 1
if len(s) % 4 == 0:
	x = len(s) // 4
	if max(ca, cg, cc, ct) <= x:
		t = ''
		for i in s:
			if i != '?':
				t += i
			elif ca < x:
				ca += 1
				t += 'A'
			elif cc < x:
				cc += 1
				t += 'C'
			elif cg < x:
				cg += 1
				t += 'G'
			else:
				ct += 1
				t += 'T'
		print(t)
	else:
		print('===')
else:
	print('===')


def solve():
	n = int(input())
	if n % 4 != 0:
		print('===')
		return
	want = n // 4
	s = list(input())
	d = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
	for c in s:
		if c in d:
			d[c] += 1
	for i in range(n):
		if s[i] == '?':
			for key in d:
				if d[key] < want:
					d[key] += 1
					s[i] = key
					break
	for key in d:
		if d[key] != want:
			print('===')
			return
	print(''.join(s))
solve()


import sys
n = int(input())
str = input()
cnt = n / 4
a = str.count('A')
c = str.count('C')
g = str.count('G')
t = str.count('T')
ques = str.count('?')
if n % 4 == 0:
	if a > cnt or c > cnt or g > cnt or (t > cnt):
		print('===')
	else:
		for i in range(len(str)):
			if str[i] == '?' and a < cnt:
				str = str[:i] + 'A' + str[i + 1:]
				a += 1
				ques -= 1
			elif str[i] == '?' and c < cnt:
				str = str[:i] + 'C' + str[i + 1:]
				c += 1
				ques -= 1
			elif str[i] == '?' and g < cnt:
				str = str[:i] + 'G' + str[i + 1:]
				g += 1
				ques -= 1
			elif str[i] == '?' and t < cnt:
				str = str[:i] + 'T' + str[i + 1:]
				t += 1
				ques -= 1
		print(str)
else:
	print('===')


def main():
	n = int(input())
	if n % 4 != 0:
		return 0
	s = input()
	d = dict()
	d['A'] = 0
	d['C'] = 0
	d['G'] = 0
	d['T'] = 0
	for i in s:
		if i in 'ACGT':
			d[i] += 1
	app = ''
	for i in list(d.items()):
		if i[1] <= n // 4:
			app += i[0] * (n // 4 - i[1])
		else:
			return 0
	print(s.replace('?', '{}').format(*list(app)))
	return 1
if not main():
	print('===')


n = int(input())
expr = input()
new = list(expr)
arr = [0, 0, 0, 0]
flag = False
if n % 4 is 0:
	for i in expr:
		if i is 'A':
			arr[0] += 1
		elif i is 'C':
			arr[1] += 1
		elif i is 'G':
			arr[2] += 1
		elif i is 'T':
			arr[3] += 1
	limit = n // 4
	for i in range(0, 4):
		if arr[i] > limit:
			flag = False
	p = 0
	for i in expr:
		if i is '?':
			if arr[0] != limit:
				new[p] = 'A'
				arr[0] += 1
				p += 1
				continue
			if arr[1] != limit:
				arr[1] += 1
				new[p] = 'C'
				p += 1
				continue
			if arr[2] != limit:
				arr[2] += 1
				new[p] = 'G'
				p += 1
				continue
			if arr[3] != limit:
				arr[3] += 1
				new[p] = 'T'
				p += 1
				continue
		p += 1
	set = set([])
	for i in new:
		set.add(i)
	if len(set) is 4:
		flag = True
	str = ''
	for i in new:
		str += i
	if flag is False:
		print('===')
	if flag is True:
		print(str)
else:
	print('===')


def solve(n, gene):
	if n % 4 != 0:
		return '==='
	chars = 'ACGT'
	counts = [n // 4 - gene.count(c) for c in chars]
	try:
		next((i for i in range(4) if counts[i] < 0))
		return '==='
	except StopIteration:
		pass
	index = -1
	while index < n - 1:
		try:
			index = next((i for i in range(index + 1, n) if gene[i] == '?'))
			char_index = next((i for i in range(4) if counts[i] > 0))
			gene[index] = chars[char_index]
			counts[char_index] -= 1
		except StopIteration:
			index = n - 1
	return ''.join(gene)

def main():
	n = int(input())
	gene = input()
	print(solve(n, [c for c in gene]))
main()


n = int(input())
s = input()
lst = list(s)
if len(lst) % 4 != 0:
	print('===')
	exit()
tA = tC = tG = tT = int(n / 4)
A = C = G = T = 0
for i in range(n):
	if lst[i] == 'A':
		A += 1
	elif lst[i] == 'C':
		C += 1
	elif lst[i] == 'G':
		G += 1
	elif lst[i] == 'T':
		T += 1
for j in range(n):
	if lst[j] == '?':
		if A != tA:
			lst[j] = 'A'
			A += 1
		elif C != tC:
			lst[j] = 'C'
			C += 1
		elif G != tG:
			lst[j] = 'G'
			G += 1
		elif T != tT:
			lst[j] = 'T'
			T += 1
if A != tA or C != tC or G != tG or (T != tT):
	print('===')
else:
	print(''.join(lst))


a = int(input())
gen = input()
c = a // 4
genoms = ['A', 'C', 'G', 'T']
if a % 4 != 0:
	print('===')
else:
	counter = []
	for i in genoms:
		counter.append(gen.count(i))
		if counter[-1] > c:
			print('===')
			exit()
	for i in range(4):
		for j in range(counter[i], c):
			gen = gen.replace('?', genoms[i], 1)
	print(''.join(gen))


n = int(input())
s = input()
ac = 0
cc = 0
gc = 0
tc = 0
c = 0
temp = len(s) // 4
if n % 4 != 0:
	print('===')
else:
	for i in range(n):
		if s[i] == 'A':
			ac += 1
		elif s[i] == 'C':
			cc += 1
		elif s[i] == 'G':
			gc += 1
		elif s[i] == 'T':
			tc += 1
		else:
			c += 1
	if ac <= temp and cc <= temp and (gc <= temp) and (tc <= temp):
		ac = abs(ac - temp)
		cc = abs(cc - temp)
		gc = abs(gc - temp)
		tc = abs(tc - temp)
		for i in range(len(s)):
			if s[i] == '?':
				if ac:
					print('A', end='')
					ac -= 1
				elif cc:
					print('C', end='')
					cc -= 1
				elif gc:
					print('G', end='')
					gc -= 1
				elif tc:
					print('T', end='')
					tc -= 1
			else:
				print(s[i], end='')
	else:
		print('===')


n = int(input())
g = input()
lista = list(g)
dict = {'A': 0, 'C': 0, 'G': 0, 'T': 0, '?': 0}
arr = []
for i in range(0, n):
	dict[g[i]] = dict[g[i]] + 1
	if g[i] == '?':
		arr.append(i)
if dict['A'] != 0 and dict['A'] == dict['C'] and (dict['A'] == dict['G']) and (dict['A'] == dict['T']) and (dict['A'] + dict['C'] + dict['G'] + dict['T'] == n):
	print(g)
elif n % 4 != 0:
	print('===')
else:
	var = False
	maxi = n // 4
	if var == False and dict['A'] < maxi:
		for i in range(1, maxi - dict['A'] + 1):
			if not arr:
				print('===')
				var = True
				break
			lista[arr[0]] = 'A'
			arr[0:1] = []
	if var == False and dict['C'] < maxi:
		for i in range(1, maxi - dict['C'] + 1):
			if not arr:
				print('===')
				var = True
				break
			lista[arr[0]] = 'C'
			arr[0:1] = []
	if var == False and dict['G'] < maxi:
		for i in range(1, maxi - dict['G'] + 1):
			if not arr:
				print('===')
				var = True
				break
			lista[arr[0]] = 'G'
			arr[0:1] = []
	if var == False and dict['T'] < maxi:
		for i in range(1, maxi - dict['T'] + 1):
			if not arr:
				print('===')
				var = True
				break
			lista[arr[0]] = 'T'
			arr[0:1] = []
	if var == False and (not arr):
		print(''.join(lista))


n = int(input())
s = str(input())
c1 = s.count('A')
c2 = s.count('C')
c3 = s.count('G')
c4 = s.count('T')
l = len(s)
t = len(s) // 4
l1 = []
for i in s:
	l1.append(i)
if len(s) % 4 != 0:
	print('===')
else:
	for i in range(l):
		if l1[i] == '?':
			if c1 < t:
				l1[i] = 'A'
				c1 += 1
			elif c2 < t:
				l1[i] = 'C'
				c2 += 1
			elif c3 < t:
				l1[i] = 'G'
				c3 += 1
			elif c4 < t:
				l1[i] = 'T'
				c4 += 1
	if c1 == c2 and c1 == c3 and (c1 == c4):
		for i in range(l):
			print(l1[i], end='')
	else:
		print('===')


n = int(input())
s = input()
a = 0
c = 0
g = 0
t = 0
question = 0
for i in range(len(s)):
	cha = s[i]
	if cha == 'A':
		a += 1
	elif cha == 'C':
		c += 1
	elif cha == 'G':
		g += 1
	elif cha == 'T':
		t += 1
	elif cha == '?':
		question += 1
maximum = max(a, c, g, t)
needl = maximum * 4 - (a + c + g + t)
if needl > question:
	print('===')
else:
	left = question - needl
	s = list(s)
	if left % 4 == 0:
		need = left / 4
		aneed = maximum - a + need
		cneed = maximum - c + need
		gneed = maximum - g + need
		tneed = maximum - t + need
		for i in range(len(s)):
			if s[i] == '?':
				if aneed:
					s[i] = 'A'
					aneed -= 1
				elif cneed:
					s[i] = 'C'
					cneed -= 1
				elif gneed:
					s[i] = 'G'
					gneed -= 1
				elif tneed:
					s[i] = 'T'
					tneed -= 1
		print(''.join(s))
	else:
		print('===')


n = int(input())
s = input()
k = n // 4
(aa, cc, gg, tt, t, ss) = (0, 0, 0, 0, 0, '')
a = sorted(s)
for i in range(0, n):
	if a[i] == '?':
		t += 1
	elif a[i] == 'A':
		aa += 1
	elif a[i] == 'C':
		cc += 1
	elif a[i] == 'G':
		gg += 1
	elif a[i] == 'T':
		tt += 1
if n % 4 != 0 or aa > k or cc > k or (gg > k) or (tt > k):
	print('===')
else:
	for i in range(0, n):
		if s[i] != '?':
			ss += s[i]
		elif aa < k:
			ss += 'A'
			aa += 1
		elif cc < k:
			ss += 'C'
			cc += 1
		elif gg < k:
			ss += 'G'
			gg += 1
		elif tt < k:
			ss += 'T'
			tt += 1
	print(ss)


l = int(input())
s = input()
if l % 4 == 0:
	sum = 0
	freq = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
	for i in s:
		if i in freq:
			freq[i] += 1
		else:
			sum += 1
	x = max(freq.values())
	a = freq['A']
	c = freq['C']
	g = freq['G']
	t = freq['T']
	z = l // 4
	if z - a < 0 or z - c < 0 or z - g < 0 or (z - t < 0):
		print('===')
	else:
		l = 'A' * (z - a) + 'C' * (z - c) + 'G' * (z - g) + 'T' * (z - t)
		for i in l:
			s = s.replace('?', i, 1)
		print(s)
else:
	print('===')


def fun(n, s):
	if n % 4 != 0:
		print('===')
		return
	else:
		letters = {'A': s.count('A'), 'C': s.count('C'), 'G': s.count('G'), 'T': s.count('T')}
		for key in letters:
			if letters[key] > n / 4:
				print('===')
				return
		question_marks = [i for (i, x) in enumerate(s) if x == '?']
		for question_mark in question_marks:
			for key in letters:
				if letters[key] < n / 4:
					s = s[:question_mark + 1].replace('?', key) + s[question_mark + 1:]
					letters[key] += 1
					break
		print(s)
	return
n = int(input())
s = input()
fun(n, s)


n = int(input())
if n % 4 != 0:
	print('===')
else:
	letters = ['A', 'C', 'G', 'T']
	s = input()
	cnt = [s.count('A'), s.count('C'), s.count('G'), s.count('T')]
	if max(cnt) > n // 4:
		print('===')
	else:
		counts = [n // 4 - i for i in cnt]
		if s.count('?') == 0:
			print(s)
		else:
			for i in range(n):
				if s[i] == '?':
					for j in range(4):
						if counts[j] > 0:
							news = s[:i] + letters[j] + s[i + 1:]
							s = news
							counts[j] -= 1
							break
			print(s)


n = int(input())
from collections import Counter
avg = n // 4
let = ['A', 'C', 'G', 'T']
s = input()
cnt = Counter(s)
if n % 4 > 0 or any((cnt.get(l, 0) > avg for l in let)):
	print('===')
	exit()
rep = ''
for l in let:
	rep += (avg - cnt.get(l, 0)) * l
ans = list(s)
cur = 0
for i in range(n):
	if ans[i] == '?':
		ans[i] = rep[cur]
		cur += 1
print(''.join(ans))


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : list(input())
n = ii()
s = ip()
d = defaultdict(int)
for i in s:
	d[i] += 1
mx = 0
st = ''
for i in d.keys():
	if i != '?':
		if d[i] > mx:
			mx = max(mx, d[i])
			st = i
k = 0
for i in ['A', 'C', 'T', 'G']:
	k += mx - d[i]
f = 0
if d['?'] < k:
	f = 1
else:
	d['?'] -= k
	if d['?'] % 4 != 0:
		f = 1
	else:
		mx += d['?'] // 4
if f:
	print('===')
else:
	for i in range(n):
		if s[i] == '?':
			if d['A'] < mx:
				d['A'] += 1
				s[i] = 'A'
			elif d['C'] < mx:
				d['C'] += 1
				s[i] = 'C'
			elif d['G'] < mx:
				d['G'] += 1
				s[i] = 'G'
			else:
				d['T'] += 1
				s[i] = 'T'
	print(''.join(s))


n = int(input())
s = input()
s = s.strip()
a = s.count('A')
c = s.count('C')
g = s.count('G')
t = s.count('T')
x = n // 4
if len(s) % 4 != 0 or a > x or c > x or (g > x) or (t > x):
	print('===')
else:
	s = s.replace('?', 'A', x - a)
	s = s.replace('?', 'C', x - c)
	s = s.replace('?', 'G', x - g)
	s = s.replace('?', 'T', x - t)
	print(s)


n = int(input())
gen = input()
A = gen.count('A')
C = gen.count('C')
G = gen.count('G')
T = gen.count('T')
if n % 4 == 0:
	m = n // 4
	if A <= m and C <= m and (G <= m) and (T <= m):
		gen = gen.replace('?', 'A', m - A)
		gen = gen.replace('?', 'C', m - C)
		gen = gen.replace('?', 'G', m - G)
		gen = gen.replace('?', 'T', m - T)
		print(gen)
	else:
		print('===')
else:
	print('===')


n = int(input())
s = list(input())
counts = n // 4
(a, c, g, t) = (counts - s.count('A'), counts - s.count('C'), counts - s.count('G'), counts - s.count('T'))
if n % 4 != 0 or a < 0 or c < 0 or (g < 0) or (t < 0):
	print('===')
else:
	for i in range(n):
		if a != 0 and s[i] == '?':
			s[i] = 'A'
			a -= 1
		if c != 0 and s[i] == '?':
			s[i] = 'C'
			c -= 1
		if g != 0 and s[i] == '?':
			s[i] = 'G'
			g -= 1
		if t != 0 and s[i] == '?':
			s[i] = 'T'
			t -= 1
	print(''.join(s))


n = int(input())
s = str(input())
if n % 4 == 0:
	m = [0, 0, 0, 0]
	l = ['A', 'C', 'G', 'T']
	for i in s:
		if i == 'A':
			m[0] += 1
		elif i == 'C':
			m[1] += 1
		elif i == 'G':
			m[2] += 1
		elif i == 'T':
			m[3] += 1
	x = True
	for i in range(0, 4):
		if m[i] > n / 4:
			print('===')
			x = False
			break
		a = m[i]
		m[i] = n / 4 - a
	if x:
		newStr = ''
		pos = 0
		z = True
		for i in s:
			if i == '?':
				y = False
				for j in range(0, 4):
					if m[j] > 0:
						y = True
						m[j] -= 1
						newStr += l[j]
						break
				if not y:
					print('===')
					z = False
					break
			else:
				newStr += i
		if z:
			print(newStr)
else:
	print('===')


def solve(n, s):
	a = {'A': 0, 'G': 0, 'C': 0, 'T': 0, '?': 0}
	if n % 4:
		return 0
	ave = n / 4
	for i in range(len(s)):
		a[s[i]] += 1
	t = 'ACGT'
	for i in t:
		if a[i] > ave:
			return 0
	for i in range(len(s)):
		if s[i] == '?':
			for j in t:
				if a[j] < ave:
					a[j] += 1
					print(j, end='')
					break
		else:
			print(s[i], end='')
	return 1
n = int(input())
s = input()
if solve(n, s):
	pass
else:
	print('=' * 3)


(n, s, g, c, r) = (int(input()), input(), 'ACGT', [], '===')
if n % 4 != 0:
	exit(print(r))
for i in g:
	c.append(s.count(i))
	if c[-1] > n // 4:
		exit(print(r))
for i in range(4):
	for j in range(c[i], n // 4):
		s = s.replace('?', g[i], 1)
print(s)


def test(s):
	t = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
	w = 0
	r = []
	for i in range(len(s)):
		if s[i] not in t:
			t[s[i]] = 0
		t[s[i]] = t[s[i]] + 1
	if '?' in s:
		x = t['?']
		t.pop('?')
	else:
		x = 0
	k = max(t, key=t.get)
	e = t[k]
	f = t['A']
	for (i, j) in t.items():
		w = w + (e - j)
	if x >= w:
		q = x - w
	else:
		q = x
	for (i, j) in t.items():
		t[i] = e - j + int(q / 4)
	g = t['A'] + f
	if q % 4 == 0 and g * 4 == n:
		for i in range(n):
			if s[i] == '?':
				if t['A'] > 0:
					r.append('A')
					t['A'] -= 1
				elif t['C'] > 0:
					r.append('C')
					t['C'] -= 1
				elif t['G'] > 0:
					r.append('G')
					t['G'] -= 1
				elif t['T'] > 0:
					r.append('T')
					t['T'] -= 1
			else:
				r.append(s[i])
		print(''.join(r))
	else:
		print('===')
n = int(input())
s = input()
if n < 4:
	print('===')
else:
	test(s)


n = int(input())
s = str(input())
p1 = s.count('A')
p2 = s.count('C')
p3 = s.count('G')
p4 = s.count('T')
l = len(s)
t = len(s) // 4
l1 = []
for i in s:
	l1.append(i)
if len(s) % 4 != 0:
	print('===')
else:
	for i in range(l):
		if l1[i] == '?':
			if p1 < t:
				l1[i] = 'A'
				p1 += 1
			elif p2 < t:
				l1[i] = 'C'
				p2 += 1
			elif p3 < t:
				l1[i] = 'G'
				p3 += 1
			elif p4 < t:
				l1[i] = 'T'
				p4 += 1
	if p1 == p2 and p1 == p3 and (p1 == p4):
		for i in range(l):
			print(l1[i], end='')
	else:
		print('===')


n = int(input())
s = input()
s1 = [x for x in s]
cond = True
numA = s.count('A')
numG = s.count('G')
numC = s.count('C')
numT = s.count('T')
numQ = s.count('?')
maxi = [numA, numC, numG, numT]
if numA > 1 and numT == 0 and (numG == 0) and (numC == 0):
	print('===')
elif numT > 1 and numA == 0 and (numG == 0) and (numC == 0):
	print('===')
elif numG > 1 and numT == 0 and (numA == 0) and (numC == 0):
	print('===')
elif numC > 1 and numT == 0 and (numG == 0) and (numA == 0):
	print('===')
elif numC == 1 and numT == 0 and (numG == 0) and (numA == 0) and (len(s) % 4 != 0):
	print('===')
elif numT == 1 and numC == 0 and (numG == 0) and (numA == 0) and (len(s) % 4 != 0):
	print('===')
elif numG == 1 and numT == 0 and (numC == 0) and (numA == 0) and (len(s) % 4 != 0):
	print('===')
elif numA == 1 and numT == 0 and (numG == 0) and (numC == 0) and (len(s) % 4 != 0):
	print('===')
elif max(maxi) > n // 4:
	print('===')
elif numA == 0 and numT == 0 and (numG == 0) and (numC == 0) and (len(s) % 4 != 0):
	print('===')
else:
	ind = 0
	key = ['A', 'C', 'G', 'T']
	for x in range(n):
		if s1[x] == '?':
			while maxi[ind] == n // 4:
				ind += 1
				if ind == len(maxi):
					cond = False
					break
			if not cond:
				break
			s1[x] = key[ind]
			maxi[ind] += 1
	if cond:
		print(''.join(s1))
	else:
		print('===')


(n, s) = (int(input()), input())
(a, c, g, t, x) = (s.count('A'), s.count('C'), s.count('G'), s.count('T'), s.count('?'))
(m, z) = (max(a, c, g, t), n // 4)
if n % 4 != 0 or z - a < 0 or z - c < 0 or (z - g < 0) or (z - t < 0):
	print('===')
	exit()
l = 'A' * (z - a) + 'C' * (z - c) + 'G' * (z - g) + 'T' * (z - t)
for i in l:
	s = s.replace('?', i, 1)
print(s)


n = int(input())
s = input()
m = 'ACGT'
a = []
for i in range(4):
	a.append(s.count(m[i]))
b = max(a)
if b * 4 <= n and n % 4 == 0:
	res = ''
	for i in range(4):
		res += m[i] * ((n >> 2) - a[i])
	j = 0
	for i in s:
		if i == '?':
			print(res[j], end='')
			j += 1
		else:
			print(i, end='')
else:
	print('===')


import sys
import math
import itertools
import collections

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ''.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base=3):
	newnumber = ''
	while number > 0:
		newnumber = str(number % base) + newnumber
		number //= base
	return newnumber
n = ii()
g = list(input())
t = n // 4
d = collections.Counter(g)
if n % 4 != 0 or d['A'] > t or d['C'] > t or (d['G'] > t) or (d['T'] > t):
	print('===')
else:
	add = 'A' * (t - d['A']) + 'C' * (t - d['C']) + 'G' * (t - d['G']) + 'T' * (t - d['T'])
	j = 0
	for i in range(n):
		if g[i] == '?':
			g[i] = add[j]
			j += 1
	print(wr(g))


N = int(input())
if N % 4 != 0:
	print('===')
	exit()
S = list(input())
(a, c, g, t) = (0, 0, 0, 0)
q = 0
for i in range(N):
	if S[i] == 'A':
		a += 1
	elif S[i] == 'C':
		c += 1
	elif S[i] == 'G':
		g += 1
	elif S[i] == 'T':
		t += 1
	else:
		q += 1
M = N // 4
if max([a, c, g, t]) > M:
	print('===')
	exit()
for i in range(N):
	if S[i] == '?':
		if a < M:
			S[i] = 'A'
			a += 1
		elif c < M:
			S[i] = 'C'
			c += 1
		elif g < M:
			S[i] = 'G'
			g += 1
		else:
			S[i] = 'T'
			t += 1
print(''.join(S))


n = int(input())
s = input()
if n % 4 != 0:
	print('===')
else:
	A = s.count('A')
	C = s.count('C')
	G = s.count('G')
	T = s.count('T')
	Q = s.count('?')
	if max((A, C, G, T)) <= n // 4:
		ns = ''
		for i in range(n):
			if s[i] == '?':
				if n // 4 - A > 0:
					ns += 'A'
					A += 1
				elif n // 4 - C > 0:
					ns += 'C'
					C += 1
				elif n // 4 - G > 0:
					ns += 'G'
					G += 1
				elif n // 4 - T > 0:
					ns += 'T'
					T += 1
			else:
				ns += s[i]
		if '?' in ns:
			print('===')
		else:
			print(ns)
	else:
		print('===')


(n, s) = (int(input()), list(input()))
a = [s.count(x) for x in 'ACGT']
index = 0
if n % 4 or max(a) > n // 4:
	print('===')
else:
	for x in range(n):
		if s[x] == '?':
			while a[index] == n // 4:
				index += 1
			s[x] = 'ACGT'[index]
			a[index] += 1
	print(''.join(s))


n = int(input())
string = [x for x in input()]
count = list(map(lambda a: string.count(a), 'ACGT'))
if n % 4 != 0:
	exit(print('==='))
elif max(count) > n / 4:
	exit(print('==='))
remaining = []
for i in range(4):
	if count[i] < n / 4:
		x = n / 4 - count[i]
		while x != 0:
			string[string.index('?')] = 'ACGT'[i]
			x -= 1
print(''.join(string))


x = int(input())
if x % 4 != 0:
	print('===')
	quit()
ct = x // 4
s = input()
aa = s.count('A') - ct
cc = s.count('C') - ct
gg = s.count('G') - ct
tt = s.count('T') - ct
aa = -aa
cc = -cc
gg = -gg
tt = -tt
if min([aa, cc, gg, tt]) < 0:
	print('===')
	quit()
s = list(s)
for i in range(len(s)):
	if s[i] == '?':
		if aa > 0:
			s[i] = 'A'
			aa -= 1
		elif cc > 0:
			s[i] = 'C'
			cc -= 1
		elif gg > 0:
			s[i] = 'G'
			gg -= 1
		else:
			s[i] = 'T'
			tt -= 1
print(''.join(s))


genome_size = int(input())
genome = list(input())
nucleotides = 'ACGT'
replaced = 'A' * (genome_size // 4 - genome.count('A')) + 'C' * (genome_size // 4 - genome.count('C')) + 'G' * (genome_size // 4 - genome.count('G')) + 'T' * (genome_size // 4 - genome.count('T'))
if genome_size % 4 != 0 or len([i for i in nucleotides if genome.count(i) > genome_size / 4]) >= 1:
	print('===')
else:
	ind = 0
	for i in range(genome_size):
		if genome[i] == '?':
			genome[i] = replaced[ind]
			ind += 1
	print(''.join(genome))


n = int(input())
s = input()
r = s.count('?')
a = s.count('A')
c = s.count('C')
g = s.count('G')
t = s.count('T')
l = len(s)
i = 0
if l % 4 == 0 and a <= l // 4 and (c <= l // 4) and (g <= l // 4) and (t <= l // 4):
	while a < l // 4:
		if s[i] == '?':
			s = s[0:i] + 'A' + s[i + 1:l]
			a = a + 1
		i = i + 1
	while c < l // 4:
		if s[i] == '?':
			s = s[0:i] + 'C' + s[i + 1:l]
			c = c + 1
		i = i + 1
	while g < l // 4:
		if s[i] == '?':
			s = s[0:i] + 'G' + s[i + 1:l]
			g = g + 1
		i = i + 1
	while t < l // 4 and i < n:
		if s[i] == '?':
			s = s[0:i] + 'T' + s[i + 1:l]
			t = t + 1
		i = i + 1
	print(s)
else:
	print('===')


import sys
input = sys.stdin.readline
n = int(input())
if n % 4:
	print('===')
else:
	t = input().strip()
	a = [n // 4] * 4
	for i in t:
		if i == 'A':
			a[0] -= 1
		elif i == 'C':
			a[1] -= 1
		elif i == 'G':
			a[2] -= 1
		elif i == 'T':
			a[3] -= 1
	if min(a) < 0:
		print('===')
	else:
		out = []
		for i in t:
			if i == '?':
				if a[0]:
					out.append('A')
					a[0] -= 1
				elif a[1]:
					out.append('C')
					a[1] -= 1
				elif a[2]:
					out.append('G')
					a[2] -= 1
				elif a[3]:
					out.append('T')
					a[3] -= 1
			else:
				out.append(i)
		print(''.join(out))


n = int(input())
t = 'ACGT'
a = [*input()]
b = [n // 4 - a.count(x) for x in t]
i = j = 0
for j in range(4):
	while b[j]:
		if '?' not in a:
			break
		a[a.index('?')] = t[j]
		b[j] -= 1
	else:
		continue
	break
print([''.join(a), '===']['?' in a or b != [0] * 4])


n = int(input())
genom = input()
A = n // 4 - genom.count('A')
С = n // 4 - genom.count('C')
G = n // 4 - genom.count('G')
T = n // 4 - genom.count('T')
if len(genom) % 4 != 0:
	print('===')
elif A < 0 or С < 0 or G < 0 or (T < 0):
	print('===')
else:
	for i in genom:
		if i != '?':
			print(i, end='')
		elif A > 0:
			print('A', end='')
			A -= 1
		elif С > 0:
			print('C', end='')
			С -= 1
		elif G > 0:
			print('G', end='')
			G -= 1
		elif T > 0:
			print('T', end='')
			T -= 1


n = int(input())
if n % 4 != 0:
	print('===')
	exit()
c = n // 4
ls = ['A', 'C', 'G', 'T']
s = list(input())
needs = [c - s.count(letter) for letter in ls]
if any([v < 0 for v in needs]):
	print('===')
	exit()
buf = ls[0] * needs[0] + ls[1] * needs[1] + ls[2] * needs[2] + ls[3] * needs[3]
bufI = 0
for i in range(len(s)):
	if s[i] in ls:
		print(s[i], end='')
	else:
		print(buf[bufI], end='')
		bufI += 1


n = int(input())
s = list(input())
w = list('ACGT')
c = dict(zip(w, map(s.count, w)))
u = s.count('?')
for (i, a) in enumerate(s):
	if a == '?':
		for j in w:
			if c[j] < n // 4:
				s[i] = j
				c[j] += 1
				break
for j in w:
	if '?' in s or c[j] != n // 4:
		print('===')
		break
	else:
		continue
else:
	print(''.join(s))


import collections
n = int(input())
a = input()
c = collections.Counter(a)
if n % 4 != 0:
	print('===')
elif c['?'] == len(a):
	t = n // 4
	a = list(a)
	d = ['A', 'C', 'G', 'T']
	j = 0
	c = 0
	i = 0
	while i < len(a):
		if c < t:
			a[i] = d[j]
			c += 1
		else:
			c = 0
			j += 1
			continue
		i += 1
	print(*a, sep='')
else:
	flag = 0
	t = n // 4
	c = collections.Counter(a)
	d = []
	if a.find('A') != -1:
		if c['A'] > t:
			flag = 1
		elif c['A'] < t:
			d.append('A')
	else:
		d.append('A')
	if a.find('C') != -1:
		if c['C'] > t:
			flag = 1
		elif c['C'] < t:
			d.append('C')
	else:
		d.append('C')
	if a.find('G') != -1:
		if c['G'] > t:
			flag = 1
		elif c['G'] < t:
			d.append('G')
	else:
		d.append('G')
	if a.find('T') != -1:
		if c['T'] > t:
			flag = 1
		elif c['T'] < t:
			d.append('T')
	else:
		d.append('T')
	if flag == 1:
		print('===')
	else:
		a = list(a)
		j = 0
		e = 0
		for i in range(0, len(a)):
			if j == len(d):
				break
			if a[i] == '?':
				a[i] = d[j]
				e += 1
				if e == t - c[d[j]]:
					j += 1
					e = 0
		print(*a, sep='')


n = int(input())
s = input()
a = s.count('A')
c = s.count('C')
g = s.count('G')
t = s.count('T')
m = max(a, c, g, t)
if n % 4 == 0:
	if a > n // 4 or c > n // 4 or g > n // 4 or (t > n // 4):
		print('===')
	else:
		s1 = ''
		for i in s:
			if i != '?':
				s1 += i
			else:
				if a < n // 4:
					s1 += 'A'
					a = a + 1
					continue
				if c < n // 4:
					s1 += 'C'
					c = c + 1
					continue
				if g < n // 4:
					s1 += 'G'
					g = g + 1
					continue
				if t < n // 4:
					s1 += 'T'
					t = t + 1
					continue
		print(s1)
else:
	print('===')


n = int(input())
x = list(input())
a = [n // 4 - x.count('A'), n // 4 - x.count('C'), n // 4 - x.count('G'), n // 4 - x.count('T')]
d = {0: 'A', 1: 'C', 2: 'G', 3: 'T'}
ans = 0
if n % 4 != 0 or min(a) < 0:
	print('===')
else:
	for i in range(n):
		if x[i] == '?':
			for j in range(4):
				if a[j] != 0:
					x[i] = d[j]
					a[j] -= 1
					break
	print(*x, sep='')


n = int(input())
s = input()
d = {'A': s.count('A'), 'C': s.count('C'), 'G': s.count('G'), 'T': s.count('T')}
if max(d.values()) * 4 > n or n % 4 != 0:
	print('===')
else:
	m = n // 4
	s1 = ''
	for y in s:
		if y not in d.keys():
			for z in d.keys():
				if d[z] < m:
					s1 += z
					d[z] += 1
					break
		else:
			s1 += y
	print(s1)


import math

def solve(n, s):
	X = [s.count(c) for c in 'ACGT']
	Q = s.count('?')
	if 4 * max(X) > n or n % 4:
		return None
	for i in range(4):
		X[i] -= n // 4
	res = list(s)
	(s1, k) = ('ACGT', 0)
	for (i, c) in enumerate(s):
		if c == '?':
			while X[k] == 0:
				k += 1
			res[i] = s1[k]
			X[k] += 1
	return ''.join(res)
n = int(input())
s = input().rstrip()
res = solve(n, s)
print('===' if res is None else res)


n = int(input())
s = input()
a = 0
c = 0
g = 0
t = 0
for i in s:
	if i == 'A':
		a += 1
	elif i == 'C':
		c += 1
	elif i == 'G':
		g += 1
	elif i == 'T':
		t += 1
q = n - (a + c + g + t)
m = max(a, c, g, t)
z = n - 4 * m
if z >= 0 and z % 4 == 0:
	z //= 4
	a = m + z - a
	c = m + z - c
	g = m + z - g
	t = m + z - t
	for i in s:
		if i == '?':
			if a > 0:
				print('A', end='')
				a -= 1
			elif c > 0:
				print('C', end='')
				c -= 1
			elif g > 0:
				print('G', end='')
				g -= 1
			else:
				print('T', end='')
				t -= 1
		else:
			print(i, end='')
	print()
else:
	print('===')


length = int(input())
string = input()

def main(length, string):
	if length % 4 != 0:
		print('===')
		return
	should_have = length // 4
	code = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
	undefined = 0
	answer = ''
	for letter in string:
		if letter == '?':
			undefined += 1
		else:
			code[letter] += 1
			if code[letter] > should_have:
				print('===')
				return
	for letter in string:
		if letter == '?':
			for (missing, cont) in code.items():
				if cont < should_have:
					answer += missing
					code[missing] += 1
					break
		else:
			answer += letter
	print(answer)
main(length, string)


N = int(input())
if N % 4 != 0:
	print('===')
	exit()
(X, Genomes) = (input(), {'A': 0, 'C': 0, 'G': 0, 'T': 0})
for i in X:
	if i != '?':
		Genomes[i] += 1
for i in Genomes.values():
	if i > N // 4:
		print('===')
		exit()
for i in X:
	if i == '?':
		for j in Genomes.keys():
			if Genomes[j] != N // 4:
				Genomes[j] += 1
				print(j, end='')
				break
	else:
		print(i, end='')


def searchneuro(n, seq):
	pair = {'A': 0, 'C': 0, 'G': 0, 'T': 0, '?': 0}
	arr = []
	if n % 4 != 0:
		print('===')
		return 0
	else:
		for i in seq:
			pair[i] += 1
		for key in pair:
			if key != '?':
				if pair[key] > n / 4:
					print('===')
					return 0
				for i in range(int(n / 4) - pair[key]):
					arr.append(key)
		if len(arr) != pair['?']:
			print(len(arr), pair['?'], n)
			print('===')
			return 0
		else:
			count = 0
			for i in range(len(seq)):
				if count >= len(arr):
					break
				if seq[i] == '?':
					seq[i] = arr[count]
					count += 1
	print(''.join(seq))
	return 0
n = int(input())
seq = list(input())
searchneuro(n, seq)


from sys import *
n = int(input())
s = input()
d = dict()
d['A'] = 0
d['C'] = 0
d['G'] = 0
d['T'] = 0
d['?'] = 0
for i in s:
	d[i] += 1
if n % 4:
	print('===')
else:
	n //= 4
	ans = ''
	j = 0
	for i in ['A', 'C', 'G', 'T']:
		if d[i] > n:
			print('===')
			exit(0)
		while d[i] < n:
			if j == len(s):
				print('===')
				exit(0)
			if s[j] == '?':
				ans += i
				d[i] += 1
			else:
				ans += s[j]
			j += 1
	while j < len(s):
		ans += s[j]
		j += 1
	print(ans)


n = int(input())
inp = input()
exp = list(inp)
freq = [0, 0, 0, 0]
if n % 4 is not 0:
	print('===')
else:
	lim = n // 4
	for i in exp:
		if i is 'A':
			freq[0] += 1
		elif i is 'C':
			freq[1] += 1
		elif i is 'G':
			freq[2] += 1
		elif i is 'T':
			freq[3] += 1
	flag = False
	for i in range(0, 4):
		if freq[i] > lim:
			print('===')
			flag = True
			break
	if flag is False:
		crazyindxr = 0
		while True:
			if freq[crazyindxr] < lim:
				if '?' in exp:
					for i in range(0, len(exp), 1):
						if exp[i] is '?':
							if crazyindxr is 0:
								exp[i] = 'A'
								freq[crazyindxr] += 1
								break
							elif crazyindxr is 1:
								exp[i] = 'C'
								freq[crazyindxr] += 1
								break
							elif crazyindxr is 2:
								exp[i] = 'G'
								freq[crazyindxr] += 1
								break
							elif crazyindxr is 3:
								exp[i] = 'T'
								freq[crazyindxr] += 1
								break
				else:
					print('===')
					break
			elif crazyindxr < len(freq) - 1:
				crazyindxr += 1
			elif crazyindxr == len(freq) - 1:
				if '?' in exp:
					print('===')
					break
				else:
					res = ''
					for i in exp:
						res += i
					print(res)
					break


Input = lambda : map(int, input().split())
c = lambda i, x: i.count(x)
n = int(input())
s = input()
if n % 4 != 0:
	print('===')
	exit()
ans = [c(s, 'A'), c(s, 'C'), c(s, 'G'), c(s, 'T')]
m = n // 4
if max(ans) > m:
	print('===')
	exit()
s = s.replace('?', 'A', m - ans[0])
s = s.replace('?', 'C', m - ans[1])
s = s.replace('?', 'G', m - ans[2])
s = s.replace('?', 'T', m - ans[3])
print(s)


import sys
length = int(input())
nucleotides = list(input())
letters = 'ACGT'
cont = [0, 0, 0, 0]
cont = [nucleotides.count(b) for b in 'ACGT']
max_nuc = max(cont)
aux = 0
if max_nuc > length // 4 or length % len(cont):
	print('===')
	exit()
for i in range(0, length):
	if nucleotides[i] == '?':
		while cont[aux] == length // len(cont):
			aux += 1
		cont[aux] += 1
		nucleotides[i] = 'ACGT'[aux]
print(''.join(nucleotides))


def solve(n, s):
	if n % 4 > 0:
		return '==='
	for i in 'ACGT':
		if 4 * s.count(i) > n:
			return '==='
	r = ''
	for i in 'ACGT':
		r += i * (n // 4 - s.count(i))
	j = 0
	res = ''
	for i in s:
		if i == '?':
			res += r[j]
			j += 1
		else:
			res += i
	return res
n = int(input())
s = input()
print(solve(n, s))


input()
s = input()
a = [0, 0, 0, 0]
k = 0
for i in s:
	if i == 'A':
		a[0] += 1
	elif i == 'C':
		a[1] += 1
	elif i == 'G':
		a[2] += 1
	elif i == 'T':
		a[3] += 1
	else:
		k += 1
m = max(a)
b = [m - i for i in a]
k -= sum(b)
if k < 0 or k % 4:
	print('===')
else:
	k //= 4
	c = 'A' * (b[0] + k) + 'C' * (b[1] + k) + 'G' * (b[2] + k) + 'T' * (b[3] + k)
	j = iter(c)
	for i in s:
		if i != '?':
			print(i, end='')
		else:
			print(next(j), end='')


n = int(input())
s = str(input())
k1 = s.count('A')
k2 = s.count('C')
k3 = s.count('G')
k4 = s.count('T')
l = len(s)
t = len(s) // 4
l1 = []
for i in s:
	l1.append(i)
if len(s) % 4 != 0:
	print('===')
else:
	for i in range(l):
		if l1[i] == '?':
			if k1 < t:
				l1[i] = 'A'
				k1 += 1
			elif k2 < t:
				l1[i] = 'C'
				k2 += 1
			elif k3 < t:
				l1[i] = 'G'
				k3 += 1
			elif k4 < t:
				l1[i] = 'T'
				k4 += 1
	if k1 == k2 and k1 == k3 and (k1 == k4):
		for i in range(l):
			print(l1[i], end='')
	else:
		print('===')


n = int(input())
s = input()
if n % 4 != 0:
	print('===')
	exit()
n = n // 4
A = s.count('A')
C = s.count('C')
G = s.count('G')
T = s.count('T')
if A <= n and G <= n and (C <= n) and (T <= n):
	A = n - A
	T = n - T
	G = n - G
	C = n - C
	for i in range(len(s)):
		if s[i] == '?':
			if A != 0:
				print('A', end='')
				A = A - 1
			elif C != 0:
				print('C', end='')
				C = C - 1
			elif G != 0:
				print('G', end='')
				G = G - 1
			elif T != 0:
				print('T', end='')
				T = T - 1
		else:
			print(s[i], end='')
else:
	print('===')


n = int(input())
s = list(input())
(a, c, g, t) = (0, 0, 0, 0)
if n % 4 != 0:
	print('===')
	exit()
for el in range(n):
	if s[el] == 'A':
		a += 1
	elif s[el] == 'C':
		c += 1
	elif s[el] == 'G':
		g += 1
	elif s[el] == 'T':
		t += 1
if a > n // 4 or c > n // 4 or g > n // 4 or (t > n // 4):
	print('===')
	exit()
for el in range(n):
	if s[el] == '?':
		if a < n // 4:
			s[el] = 'A'
			a += 1
		elif c < n // 4:
			s[el] = 'C'
			c += 1
		elif g < n // 4:
			s[el] = 'G'
			g += 1
		elif t < n // 4:
			s[el] = 'T'
			t += 1
	continue
print(''.join(s))


(n, s) = (int(input()), input())
(n, m) = divmod(n, 4)
if m:
	print('===')
else:
	for ch in 'ACGT':
		k = s.count(ch)
		if k > n:
			print('===')
			break
		s = s.replace('?', ch, n - k)
	else:
		print(s)


n = int(input())
genome = input()
neucleotideList = list(genome)
dict = {'A': 0, 'C': 0, 'G': 0, 'T': 0, '?': 0}
unknownInd = []
for i in range(0, n):
	dict[genome[i]] = dict[genome[i]] + 1
	if genome[i] == '?':
		unknownInd.append(i)
if dict['A'] != 0 and dict['A'] == dict['C'] and (dict['A'] == dict['G']) and (dict['A'] == dict['T']) and (dict['A'] + dict['C'] + dict['G'] + dict['T'] == n):
	print(genome)
elif n % 4 != 0:
	print('===')
else:
	impossible = False
	maxi = n // 4
	if impossible == False and dict['A'] < maxi:
		for i in range(1, maxi - dict['A'] + 1):
			if not unknownInd:
				print('===')
				impossible = True
				break
			neucleotideList[unknownInd[0]] = 'A'
			unknownInd[0:1] = []
	if impossible == False and dict['C'] < maxi:
		for i in range(1, maxi - dict['C'] + 1):
			if not unknownInd:
				print('===')
				impossible = True
				break
			neucleotideList[unknownInd[0]] = 'C'
			unknownInd[0:1] = []
	if impossible == False and dict['G'] < maxi:
		for i in range(1, maxi - dict['G'] + 1):
			if not unknownInd:
				print('===')
				impossible = True
				break
			neucleotideList[unknownInd[0]] = 'G'
			unknownInd[0:1] = []
	if impossible == False and dict['T'] < maxi:
		for i in range(1, maxi - dict['T'] + 1):
			if not unknownInd:
				print('===')
				impossible = True
				break
			neucleotideList[unknownInd[0]] = 'T'
			unknownInd[0:1] = []
	if impossible == False and (not unknownInd):
		print(''.join(neucleotideList))


n = int(input())
s = input()
result = ''
if n % 4 != 0:
	print('===')
else:
	a = s.count('A')
	b = s.count('C')
	c = s.count('G')
	d = s.count('T')
	if a > n // 4 or b > n // 4 or c > n // 4 or (d > n // 4):
		print('===')
	else:
		for i in range(n):
			if s[i] == '?':
				if a != n // 4:
					result += 'A'
					a += 1
				elif b != n // 4:
					result += 'C'
					b += 1
				elif c != n // 4:
					result += 'G'
					c += 1
				elif d != n // 4:
					result += 'T'
					d += 1
			else:
				result += s[i]
	print(result)


N = int(input())
s = str(input())
ct1 = s.count('A')
ct2 = s.count('C')
ct3 = s.count('G')
ct4 = s.count('T')
l = len(s)
t = len(s) // 4
l1 = []
for i in s:
	l1.append(i)
if len(s) % 4 != 0:
	print('===')
else:
	for i in range(l):
		if l1[i] == '?':
			if ct1 < t:
				l1[i] = 'A'
				ct1 += 1
			elif ct2 < t:
				l1[i] = 'C'
				ct2 += 1
			elif ct3 < t:
				l1[i] = 'G'
				ct3 += 1
			elif ct4 < t:
				l1[i] = 'T'
				ct4 += 1
	if ct1 == ct2 and ct1 == ct3 and (ct1 == ct4):
		for i in range(l):
			print(l1[i], end='')
	else:
		print('===')


input()
s = input()
a = s.count('A')
c = s.count('C')
g = s.count('G')
t = s.count('T')
n = len(s)
if n % 4 != 0:
	print('===')
	exit()
n = int(n / 4)
if a > n or c > n or g > n or (t > n):
	print('===')
	exit()
s = s.replace('?', 'A', n - a)
s = s.replace('?', 'C', n - c)
s = s.replace('?', 'G', n - g)
s = s.replace('?', 'T', n - t)
print(s)


n = int(input())
s = input()
k = 0
mydict = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
sum = 0
if n % 4 != 0:
	print('===')
	exit()
for i in s:
	if i != '?':
		mydict[i] += 1
for i in mydict.values():
	if i > n // 4:
		print('===')
		exit()
for i in range(n):
	if s[i] == '?':
		for j in mydict.keys():
			if mydict[j] != n // 4:
				mydict[j] += 1
				print(j, end='')
				break
	else:
		print(s[i], end='')


n = int(input())
s = input()
a = s.count('A')
c = s.count('C')
g = s.count('G')
t = s.count('T')
if n % 4 != 0:
	print('===')
else:
	num_needed = n // 4
	if a > num_needed or c > num_needed or g > num_needed or (t > num_needed):
		print('===')
	else:
		for i in s:
			if i != '?':
				print(i, end='')
			elif a < num_needed:
				print('A', end='')
				a += 1
			elif c < num_needed:
				print('C', end='')
				c += 1
			elif g < num_needed:
				print('G', end='')
				g += 1
			elif t < num_needed:
				print('T', end='')
				t += 1
	print()


l = int(input())
str = input()
a = c = g = q = t = 0
n = l / 4
for i in range(l):
	if str[i] == 'A':
		a += 1
	elif str[i] == 'C':
		c += 1
	elif str[i] == 'G':
		g += 1
	elif str[i] == 'T':
		t += 1
	else:
		q += 1
flag = 0
if max(max(a, g), max(c, t)) > n or l % 4 != 0:
	flag = 1
for i in range(l):
	if str[i] == '?':
		if a < n:
			str = str[:i] + 'A' + str[i + 1:]
			a += 1
		elif c < n:
			str = str[:i] + 'C' + str[i + 1:]
			c += 1
		elif g < n:
			str = str[:i] + 'G' + str[i + 1:]
			g += 1
		elif t < n:
			str = str[:i] + 'T' + str[i + 1:]
			t += 1
if flag:
	print('===')
else:
	print(str)


line = input()
a = []
for x in line.split():
	a.append(int(x))
line = input()
num = [0, 0, 0, 0, 0]
nn = [0, 0, 0, 0, 0]
ch = ['A', 'C', 'G', 'T', '?']
for i in line:
	if i == ch[0]:
		num[0] += 1
	elif i == ch[1]:
		num[1] += 1
	elif i == ch[2]:
		num[2] += 1
	elif i == ch[3]:
		num[3] += 1
	elif i == ch[4]:
		num[4] += 1
for i in range(4):
	nn[i] = num[i]
ave = a[0] // 4
ans = ''
flag = 1
for i in range(0, 4):
	if nn[i] < ave:
		num[4] -= ave - nn[i]
		nn[i] += ave - nn[i]
for i in range(0, 4):
	if nn[i] != ave:
		flag = 0
if num[4] != 0:
	flag = 0
if flag == 0:
	print('===')
else:
	for i in range(0, a[0]):
		if line[i] == '?':
			for j in range(0, 4):
				if num[j] < ave:
					num[j] += 1
					ans += ch[j]
					break
		else:
			ans += line[i]
	print(ans)


s = int(input())
lst = list(input())
(A, C, G, T) = (s // 4 - lst.count('A'), s // 4 - lst.count('C'), s // 4 - lst.count('G'), s // 4 - lst.count('T'))
if A < 0 or C < 0 or G < 0 or (T < 0):
	print('===')
	exit()
for i in range(s):
	if lst[i] == '?':
		if A > 0:
			lst[i] = 'A'
			A -= 1
		elif C > 0:
			lst[i] = 'C'
			C -= 1
		elif G > 0:
			lst[i] = 'G'
			G -= 1
		elif T > 0:
			lst[i] = 'T'
			T -= 1
ans = ''.join(lst)
if '?' in ans:
	print('===')
else:
	print(ans)


n = int(input())
genomes = list(input())
if n % 4 != 0 or any([genomes.count(x) > n // 4 for x in 'ACGT']):
	print('===')
else:
	cnt = {}
	for x in 'ACGT':
		cnt[x] = n // 4 - genomes.count(x)
	for i in range(n):
		if genomes[i] == '?':
			for x in 'ACGT':
				if cnt[x] > 0:
					genomes[i] = x
					cnt[x] -= 1
					break
	print(''.join(genomes))


l = int(input())
a = input()
if l % 4 != 0:
	print('===')
else:
	z = a.count('A')
	x = a.count('C')
	c = a.count('G')
	v = a.count('T')
	t = l // 4
	if max(z, x, c, v) > t:
		print('===')
	else:
		while z < t:
			a = a[:a.index('?')] + 'A' + a[a.index('?') + 1:]
			z += 1
		while x < t:
			a = a[:a.index('?')] + 'C' + a[a.index('?') + 1:]
			x += 1
		while c < t:
			a = a[:a.index('?')] + 'G' + a[a.index('?') + 1:]
			c += 1
		while v < t:
			a = a[:a.index('?')] + 'T' + a[a.index('?') + 1:]
			v += 1
		print(a)


n = int(input())
genomes = list(input())
if n % 4 != 0 or any([genomes.count(x) > n // 4 for x in 'ACGT']):
	print('===')
else:
	to_replace = []
	for x in 'ACGT':
		cnt = n // 4 - genomes.count(x)
		for _ in range(cnt):
			to_replace.append(x)
	(i, j) = (0, 0)
	while i < len(to_replace):
		if genomes[j] == '?':
			genomes[j] = to_replace[i]
			i += 1
		j += 1
	print(''.join(genomes))


def L2():
	n = int(input())
	s = input()
	if n % 4 != 0:
		print('===')
	else:
		num = n // 4
		a = s.count('A')
		c = s.count('C')
		g = s.count('G')
		t = s.count('T')
		if a > num or c > num or g > num or (t > num):
			print('===')
			return
		s = s.replace('?', 'A', num - a)
		s = s.replace('?', 'C', num - c)
		s = s.replace('?', 'G', num - g)
		s = s.replace('?', 'T', num - t)
		print(s)
L2()


import sys
input = sys.stdin.readline
number = int(input())
word = list(input().strip('\n'))
if number % 4 != 0:
	print('===')
else:
	A = word.count('A')
	C = word.count('C')
	G = word.count('G')
	T = word.count('T')
	if A > number // 4 or C > number // 4 or G > number // 4 or (T > number // 4):
		print('===')
	else:
		for k in range(number):
			if word[k] == '?':
				if A < number // 4:
					word[k] = 'A'
					A += 1
				elif C < number // 4:
					word[k] = 'C'
					C += 1
				elif G < number // 4:
					word[k] = 'G'
					G += 1
				elif T < number // 4:
					word[k] = 'T'
					T += 1
		print(''.join(word))


n = int(input())
s = input()
l = {i: n // 4 - s.count(i) for i in 'ACGT'}
if n % 4:
	print('===')
	exit(0)
for i in l.values():
	if i < 0:
		print('===')
		exit(0)
s = s.replace('?', 'A', l['A']).replace('?', 'C', l['C']).replace('?', 'G', l['G']).replace('?', 'T', l['T'])
print(''.join(s))


n = int(input())
s = input()
if n % 4 != 0:
	print('===')
else:
	sdict = dict()
	for i in 'ACGT?':
		sdict[i] = 0
	for i in s:
		sdict[i] += 1
	exitflag = False
	for i in 'ACGT':
		if sdict[i] > n / 4:
			print('===')
			exitflag = True
			break
	if not exitflag:
		news = ''
		for i in s:
			if i != '?':
				news += i
			else:
				for j in 'ACGT':
					if sdict[j] < n / 4:
						sdict[j] += 1
						inputewith = j
						break
				news += j
		print(news)


n = int(input())
s = list(input())
if n % 4 != 0:
	print('===')
else:
	a = s.count('A')
	c = s.count('C')
	g = s.count('G')
	t = s.count('T')
	if a > n // 4 or c > n // 4 or g > n // 4 or (t > n // 4):
		print('===')
	else:
		a = abs(a - n // 4)
		for i in range(n):
			if a > 0 and s[i] == '?':
				s[i] = 'A'
				a -= 1
			if a <= 0:
				break
		c = abs(c - n // 4)
		for j in range(i, n):
			if c > 0 and s[j] == '?':
				s[j] = 'C'
				c -= 1
			if c <= 0:
				break
		g = abs(g - n // 4)
		for j in range(i, n):
			if g > 0 and s[j] == '?':
				s[j] = 'G'
				g -= 1
			if g <= 0:
				break
		t = abs(t - n // 4)
		for j in range(i, n):
			if t > 0 and s[j] == '?':
				s[j] = 'T'
				t -= 1
			if t <= 0:
				break
		for i in range(n):
			print(s[i], end='')


n = int(input())
s = str(input())
a = s.count('A')
c = s.count('C')
g = s.count('G')
t = s.count('T')
q = s.count('?')
maximum = max(a, c, g, t)
need = 4 * maximum - (a + c + g + t)
b = 0
if q > need and (q - need) % 4 == 0:
	excess = (q - need) // 4
	maximum = maximum + excess
	b = 1
if need == q or b == 1:
	i = 0
	while i < len(s):
		if s[i] == '?':
			if a < maximum:
				s = s[:i] + 'A' + s[i + 1:]
				a = a + 1
			elif c < maximum:
				s = s[:i] + 'C' + s[i + 1:]
				c = c + 1
			elif g < maximum:
				s = s[:i] + 'G' + s[i + 1:]
				g = g + 1
			elif t < maximum:
				s = s[:i] + 'T' + s[i + 1:]
				t = t + 1
		i = i + 1
	print(s)
else:
	print('===')


def main():
	n = int(input())
	s = input()
	if n % 4 != 0:
		print('===')
		return
	ga = 0
	gc = 0
	gg = 0
	gt = 0
	genome = ''
	for i in s:
		if i == 'A':
			ga += 1
		elif i == 'C':
			gc += 1
		elif i == 'G':
			gg += 1
		elif i == 'T':
			gt += 1
		else:
			continue
	n = n // 4
	for i in s:
		if i == 'A':
			genome = genome + 'A'
		elif i == 'C':
			genome = genome + 'C'
		elif i == 'G':
			genome = genome + 'G'
		elif i == 'T':
			genome = genome + 'T'
		elif ga < n:
			ga += 1
			genome = genome + 'A'
		elif gc < n:
			gc += 1
			genome = genome + 'C'
		elif gg < n:
			gg += 1
			genome = genome + 'G'
		elif gt < n:
			gt += 1
			genome = genome + 'T'
		else:
			print('===')
			return
	if ga == n and gc == n and (gg == n) and (gt == n):
		print(genome)
	else:
		print('===')
		return
main()


n = int(input())
z = n // 4
s = input()
a = s.count('A')
c = s.count('C')
g = s.count('G')
t = s.count('T')
q = s.count('?')
if a > z or c > z or g > z or (t > z):
	print('===')
elif n % 4 != 0:
	print('===')
else:
	s = list(s)
	for i in range(n):
		if s[i] == '?':
			if a < z:
				s[i] = 'A'
				a += 1
			elif c < z:
				s[i] = 'C'
				c += 1
			elif g < z:
				s[i] = 'G'
				g += 1
			else:
				s[i] = 'T'
				t += 1
	print(*s, sep='')


N = int(input())
S = input()
if N % 4 != 0:
	print('===')
else:
	A = S.count('A')
	C = S.count('C')
	G = S.count('G')
	T = S.count('T')
	mean = N // 4
	if A > mean or C > mean or G > mean or (T > mean):
		print('===')
	else:
		S = list(S)
		for (i, c) in enumerate(S):
			if c == '?':
				if A < mean:
					A += 1
					S[i] = 'A'
				elif C < mean:
					C += 1
					S[i] = 'C'
				elif G < mean:
					G += 1
					S[i] = 'G'
				else:
					T += 1
					S[i] = 'T'
		print(''.join(S))


from collections import Counter

def uncypher(genom):
	need = len(genom) // 4
	counter = Counter(genom)
	a = need - counter['A']
	c = need - counter['C']
	g = need - counter['G']
	t = need - counter['T']
	if min([a, c, g, t]) < 0:
		return '==='
	else:
		ans = ''
		line = 'A' * a + 'C' * c + 'G' * g + 'T' * t
		i = 0
		for char in genom:
			to_add = char
			if char == '?':
				to_add = line[i]
				i += 1
			ans += to_add
		return ans
n = int(input())
if n % 4 != 0:
	print('===')
	exit()
genom = list(input())
print(uncypher(genom))


n = int(input())
x = list(input())
if n % 4 != 0:
	print('===')
	exit()
countA = int(n / 4)
countC = int(n / 4)
countG = int(n / 4)
countT = int(n / 4)
summaA = 0
summaC = 0
summaG = 0
summaT = 0
for i in range(n):
	if x[i] == 'A':
		summaA += 1
	elif x[i] == 'C':
		summaC += 1
	elif x[i] == 'G':
		summaG += 1
	elif x[i] == 'T':
		summaT += 1
for j in range(n):
	if x[j] == '?':
		if summaA != countA:
			x[j] = 'A'
			summaA += 1
		elif summaC != countC:
			x[j] = 'C'
			summaC += 1
		elif summaG != countG:
			x[j] = 'G'
			summaG += 1
		elif summaT != countT:
			x[j] = 'T'
			summaT += 1
if summaA != countA or summaC != countC or summaG != countG or (summaT != countT):
	print('===')
else:
	print(''.join(x))


import math
d = {'A': 0, 'C': 0, 'G': 0, 'T': 0, '?': 0}

def solve():
	mx = 0
	l = int(input().strip())
	s = input().strip()
	if l % 4 == 0:
		for x in s:
			d[x] = d[x] + 1
			if mx < d[x] and x != '?':
				mx = d[x]
		if mx <= int(l / 4):
			mx = int(l / 4)
			total = 4 * mx - d['A'] - d['C'] - d['G'] - d['T']
			if total == d['?']:
				for x in s:
					if x == '?':
						if mx - d['A'] > 0:
							print('A', end='')
							d['A'] = d['A'] + 1
						elif mx - d['C'] > 0:
							print('C', end='')
							d['C'] = d['C'] + 1
						elif mx - d['G'] > 0:
							print('G', end='')
							d['G'] = d['G'] + 1
						elif mx - d['T'] > 0:
							print('T', end='')
							d['T'] = d['T'] + 1
					else:
						print(x, end='')
			else:
				print('===')
		else:
			print('===')
	else:
		print('===')
solve()


alph = 'ACGT?'
k = [0, 0, 0, 0, 0]
n = int(input())
s = input()
ans = []
if n % 4 != 0:
	print('===')
	exit()
for i in range(0, n):
	k[alph.find(s[i])] += 1
j = 0
for i in range(0, n):
	if s[i] == '?':
		if 4 * k[j] > n:
			print('===')
			exit()
		while 4 * k[j] == n:
			j += 1
		k[j] += 1
		ans.append(alph[j])
	else:
		ans.append(s[i])
for i in range(4):
	if 4 * k[i] < n:
		print('===')
		exit()
for i in ans:
	print(i, end='')


number = int(input())
word = input()
dic = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
for letter in word.replace('?', ''):
	dic[letter] += 1
div = number / 4

def fill():
	for letter in 'ACGT':
		if dic[letter] < div:
			dic[letter] += 1
			return letter
if number % 4 == 0 and dic['A'] <= div and (dic['C'] <= div) and (dic['G'] <= div) and (dic['T'] <= div):
	new_word = ''
	for letter in word:
		if letter != '?':
			new_word += letter
		else:
			new_word += fill()
	print(new_word)
else:
	print('===')


n = int(input())
s = input()
if n % 4 != 0:
	print('===')
else:
	t = n // 4
	a = t - s.count('A')
	b = t - s.count('C')
	c = t - s.count('G')
	d = t - s.count('T')
	if a >= 0 and b >= 0 and (c >= 0) and (d >= 0):
		e = 'A' * a + 'C' * b + 'G' * c + 'T' * d
		i = 0
		f = ''
		for c in s:
			if c == '?':
				f = f + e[i]
				i = i + 1
			else:
				f = f + c
		print(f)
	else:
		print('===')


n = int(input())
s = input()
if n % 4 != 0:
	print('===')
else:
	f = n // 4
	a = f - s.count('A')
	c = f - s.count('C')
	g = f - s.count('G')
	t = f - s.count('T')
	if a >= 0 and c >= 0 and (g >= 0) and (t >= 0):
		x = 'A' * a + 'C' * c + 'G' * g + 'T' * t
		i = 0
		y = ''
		for p in s:
			if p == '?':
				y = y + x[i]
				i = i + 1
			else:
				y = y + p
		print(y)
	else:
		print('===')


n = int(input())
s = input()
cnt = len(s)
arr = 'ACGT'
if n % 4 == 0:
	r = n // 4
	res = ''
	d = {'A': 0, 'C': 0, 'G': 0, 'T': 0, '?': 0}
	for c in s:
		d[c] = d[c] + 1
	need = 0
	for c in arr:
		if d[c] <= r:
			need += r - d[c]
		else:
			res = '==='
	if res != '===' and need == d['?']:
		for i in range(n):
			if s[i] == '?':
				for sub in arr:
					if d[sub] < r:
						d[sub] += 1
						res += sub
						break
			else:
				res += s[i]
		res = str.join('', res)
	print(res)
else:
	print('===')


def func_name(input1, input2):
	input2 = list(input2)
	array = []
	dictionary = {'A': 0, 'C': 0, 'G': 0, 'T': 0, '?': 0}
	counter = 0
	if input1 % 4 != 0:
		print('===')
		return
	else:
		for i in input2:
			dictionary[i] += 1
		for temp in dictionary:
			if temp != '?':
				if dictionary[temp] > input1 / 4:
					print('===')
					return
				for temp1 in range(n // 4 - dictionary[temp]):
					array.append(temp)
		if len(array) != dictionary['?']:
			print(len(array), dictionary['?'], input1)
			print('===')
			return
		else:
			counter = 0
			for i in range(len(input2)):
				if counter >= len(array):
					break
				if input2[i] == '?':
					input2[i] = array[counter]
					counter += 1
			for i in range(len(input2)):
				print(input2[i], end='', sep='')
n = int(input())
s = input()
func_name(n, s)


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
lens = int(input())
genome = input()
counts = [genome.count(i) for i in 'ACGT']
ans = '==='
if lens % 4 == 0 and max(counts) <= lens // 4:
	ans = ''
	i = 0
	for x in genome:
		if x == '?':
			while i < 4 and counts[i] >= lens // 4:
				i += 1
			ans += 'ACGT'[i]
			counts[i] += 1
		else:
			ans += x
print(ans)


n = int(input())
s = input()
a = c = g = t = 0
if n % 4 != 0:
	print('===')
	exit()
else:
	m = n // 4
	a = s.count('A')
	c = s.count('C')
	g = s.count('G')
	t = s.count('T')
	s = s.replace('?', 'A', m - a)
	s = s.replace('?', 'C', m - c)
	s = s.replace('?', 'G', m - g)
	s = s.replace('?', 'T', m - t)
	if s.count('A') == s.count('G') == s.count('C') == s.count('T'):
		print(s)
	else:
		print('===')


def solve():
	n = int(input())
	lis = list(input())
	if len(lis) % 4 != 0:
		return '==='
	counter = [0, 0, 0, 0]
	for j in lis:
		if j == 'A':
			counter[0] += 1
		elif j == 'C':
			counter[1] += 1
		elif j == 'G':
			counter[2] += 1
		elif j == 'T':
			counter[3] += 1
	avg = len(lis) / 4
	for j in range(4):
		counter[j] -= avg
		if counter[j] > 0:
			return '==='
	for j in range(len(lis)):
		if lis[j] == '?':
			if counter[0] < 0:
				lis[j] = 'A'
				counter[0] += 1
			elif counter[1] < 0:
				lis[j] = 'C'
				counter[1] += 1
			elif counter[2] < 0:
				lis[j] = 'G'
				counter[2] += 1
			elif counter[3] < 0:
				lis[j] = 'T'
				counter[3] += 1
	return ''.join(lis)
print(solve())


n = int(input())
s = input()
a = s.count('A')
c = s.count('C')
g = s.count('G')
t = s.count('T')
temp = n // 4
if n % 4 or a > temp or c > temp or (g > temp) or (t > temp):
	print('===')
else:
	s = s.replace('?', 'A', temp - a)
	s = s.replace('?', 'C', temp - c)
	s = s.replace('?', 'G', temp - g)
	s = s.replace('?', 'T', temp - t)
	print(s)


n = int(input())
s = list(input().strip()[:n])
if n % 4 != 0:
	print('===')
else:
	qs = 0
	(a, c, g, t) = (0, 0, 0, 0)
	num = n // 4
	for x in s:
		if x == '?':
			qs += 1
		elif x == 'A':
			a += 1
		elif x == 'C':
			c += 1
		elif x == 'G':
			g += 1
		else:
			t += 1
	if num - a < 0 or num - c < 0 or num - g < 0 or (num - t < 0):
		print('===')
	else:
		l = ['A'] * (num - a) + ['C'] * (num - c) + ['G'] * (num - g) + ['T'] * (num - t)
		z = 0
		for x in range(n):
			if s[x] == '?':
				s[x] = l[z]
				z += 1
		print(''.join(s))


n = int(input())
s = input()
s = list(s)
l = [0] * 4
t = ['A', 'C', 'G', 'T']
for i in range(n):
	if s[i] != '?':
		if s[i] == 'A':
			l[0] += 1
		elif s[i] == 'C':
			l[1] += 1
		elif s[i] == 'G':
			l[2] += 1
		else:
			l[3] += 1
if n % 4 != 0:
	print('===')
elif max(l) > n // 4:
	print('===')
else:
	j = 0
	while j < 4:
		for i in range(n):
			if s[i] == '?':
				if l[j] < n // 4:
					s[i] = t[j]
					l[j] += 1
		j += 1
	for i in range(n):
		print(s[i], end='')


n = int(input().strip())
s = input().strip()
if n % 4:
	print('===')
else:
	freq = n // 4
	d = {'A': freq, 'C': freq, 'G': freq, 'T': freq}
	miss = 0
	res = ''
	missing = ''
	for c in s:
		if c in d:
			d[c] -= 1
		else:
			miss += 1
	sm = 0
	for c in d:
		if d[c] < 0:
			res = '==='
			break
		else:
			sm += d[c]
			missing += c * d[c]
	if sm != miss or res:
		res = '==='
	else:
		j = 0
		for i in range(n):
			if s[i] != '?':
				res += s[i]
			else:
				res += missing[j]
				j += 1
	print(res)


n = int(input())
s = input()
g = ['A', 'C', 'G', 'T']
g_count = {gene: s.count(gene) for gene in g}
ans = ''
if n % 4 != 0:
	ans = '==='
else:
	for g in g_count:
		if g_count[g] > n // 4:
			ans = '==='
			break
		else:
			s = s.replace('?', g, n // 4 - g_count[g])
if ans == '':
	print(s)
else:
	print(ans)


import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()

def decrypt(s, n):
	gens = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
	for gen in s:
		if gen != '?':
			gens[gen] += 1
	mx = 0
	mxGen = 'A'
	for gen in gens:
		if gens[gen] > mx:
			mx = gens[gen]
			mxGen = gen
	needGens = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
	allGens = 0
	for gen in gens:
		needGens[gen] = mx - gens[gen]
		allGens += gens[gen] + needGens[gen]
	if allGens > n:
		return '==='
	else:
		overGens = n - allGens
		if overGens % 4 != 0:
			return '==='
		else:
			addGens = overGens // 4
			for gen in needGens:
				needGens[gen] += addGens
			decryptGen = ''
			needGensArray = list(needGens)
			needGenPosition = 0
			for gen in s:
				if gen != '?':
					decryptGen = decryptGen + gen
				else:
					while needGens[needGensArray[needGenPosition]] < 1:
						needGenPosition += 1
					needGens[needGensArray[needGenPosition]] -= 1
					decryptGen = decryptGen + needGensArray[needGenPosition]
			return decryptGen
print(decrypt(s, n))


n = int(input())
s = list(input())
if n % 4 != 0:
	print('===')
else:
	a = s.count('A')
	c = s.count('C')
	g = s.count('G')
	t = s.count('T')
	x = s.count('?')
	m = max(a, c, t, g)
	main_need = 4 * m - a - c - g - t
	if x - main_need < 0 or (x - main_need) % 4 != 0:
		print('===')
	else:
		need = {'A': m - a, 'C': m - c, 'G': m - g, 'T': m - t}
		for key in need.keys():
			need[key] += (x - main_need) // 4
		for i in range(n):
			if s[i] == '?':
				for (key, value) in need.items():
					if value:
						need[key] -= 1
						s[i] = key
						break
		print(''.join(s))


n = int(input())
x = n // 4
s = input()
a = x - s.count('A')
c = x - s.count('C')
g = x - s.count('G')
t = x - s.count('T')
L = []
if n % 4 != 0:
	print('===')
elif s.count('A') > x or s.count('C') > x or s.count('G') > x or (s.count('T') > x):
	print('===')
else:
	for i in range(a):
		L.append('A')
	for i in range(c):
		L.append('C')
	for i in range(g):
		L.append('G')
	for i in range(t):
		L.append('T')
	s1 = ''
	j = 0
	for i in s:
		if i != '?':
			s1 += i
		elif i == '?':
			s1 += L[j]
			j += 1
	if s1.count('A') + s1.count('C') + s1.count('G') + s1.count('T') != n:
		print('===')
	else:
		print(s1)