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.

Source: codeforces | Difficulty: EASY
Tags: String algorithms

Implementation


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 = 0
G = 0
C = 0
T = 0
spis = []
vopr = 0
for i in range(n):
	spis = spis + [s[i]]
	if s[i] == 'A':
		A = A + 1
	elif s[i] == 'G':
		G = G + 1
	elif s[i] == 'C':
		C = C + 1
	elif s[i] == 'T':
		T = T + 1
	else:
		vopr = vopr + 1
mx = max(A, G, C, T)
ost = mx - A + (mx - G) + (mx - C) + (mx - T)
A_ost = mx - A
G_ost = mx - G
C_ost = mx - C
T_ost = mx - T
if (ost - vopr) % 4 == 0:
	A_ost = A_ost + abs(ost - vopr) / 4
	G_ost = G_ost + abs(ost - vopr) / 4
	C_ost = C_ost + abs(ost - vopr) / 4
	T_ost = T_ost + abs(ost - vopr) / 4
if ost == vopr or ((ost - vopr) % 4 == 0 and vopr > ost):
	for i in range(n):
		if spis[i] == '?':
			if A_ost > 0:
				spis[i] = 'A'
				A_ost = A_ost - 1
			elif G_ost > 0:
				spis[i] = 'G'
				G_ost = G_ost - 1
			elif C_ost > 0:
				spis[i] = 'C'
				C_ost = C_ost - 1
			elif T_ost > 0:
				spis[i] = 'T'
				T_ost = T_ost - 1
	print(''.join(spis))
else:
	print('===')


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 = str(input())
if n % 4 != 0:
	print('===')
else:
	acount = 0
	gcount = 0
	tcount = 0
	ccount = 0
	temp = 0
	z = n // 4
	for i in range(0, n):
		if s[i] == 'A':
			acount += 1
		elif s[i] == 'G':
			gcount += 1
		elif s[i] == 'T':
			tcount += 1
		elif s[i] == 'C':
			ccount += 1
		else:
			temp += 1
	if max(acount, gcount, tcount, ccount) > z:
		print('===')
	else:
		newstring = ''
		acount = z - acount
		gcount = z - gcount
		tcount = z - tcount
		ccount = z - ccount
		for i in range(0, n):
			if s[i] == '?':
				if acount > 0:
					newstring += 'A'
					acount -= 1
				elif gcount > 0:
					newstring += 'G'
					gcount -= 1
				elif tcount > 0:
					newstring += 'T'
					tcount -= 1
				else:
					newstring += 'C'
			else:
				newstring += s[i]
		print(newstring)


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


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('===')


input()
s = input()
a = 0
c = 0
t = 0
g = 0
q = 0
for i in s:
	if i == 'A':
		a += 1
	if i == 'G':
		g += 1
	if i == '?':
		q += 1
	if i == 'C':
		c += 1
	if i == 'T':
		t += 1
n = max([a, c, t, g])
d = n - a + n - c + n - t + n - g
if q < d:
	print('===')
	exit()
if (q - d) % 4 != 0:
	print('===')
	exit()
s2 = ''
num_all = (q - d) // 4 + n
for i in s:
	if i == '?':
		if a < num_all:
			s2 += 'A'
			a += 1
		elif t < num_all:
			s2 += 'T'
			t += 1
		elif g < num_all:
			s2 += 'G'
			g += 1
		elif c < num_all:
			s2 += 'C'
			c += 1
	else:
		s2 += i
print(s2)


def zamena(k, b):
	global s
	k1 = 0
	while k1 != k:
		gde = s.find('?')
		s = s[0:gde] + b + s[gde + 1:]
		k1 += 1
	return k1
n = int(input())
s = input()
kol_a = s.count('A')
kol_c = s.count('C')
kol_g = s.count('G')
kol_t = s.count('T')
kol_ploxo = s.count('?')
buk = ['A', 'C', 'G', 'T']
if n % 4 != 0:
	print('===')
elif '?' not in s and kol_a == kol_c == kol_g == kol_t:
	print(s)
elif kol_ploxo == n:
	if n % 4 != 0:
		print('===')
	else:
		g = n // 4
		print('A' * g + 'T' * g + 'G' * g + 'C' * g)
else:
	gp = n // 4
	raz_a = gp - kol_a
	raz_c = gp - kol_c
	raz_g = gp - kol_g
	raz_t = gp - kol_t
	if kol_ploxo != raz_a + raz_c + raz_g + raz_t or raz_a < 0 or raz_c < 0 or (raz_g < 0) or (raz_t < 0):
		print('===')
	else:
		a = zamena(raz_a, 'A')
		c = zamena(raz_c, 'C')
		g = zamena(raz_g, 'G')
		t = zamena(raz_t, 'T')
		print(s)


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))


def main(n, DNA):
	uk = DNA.count('?')
	if n % 4 != 0:
		return '==='
	A = DNA.count('A')
	C = DNA.count('C')
	G = DNA.count('G')
	T = DNA.count('T')
	required = max(A, C, G, T, 1)
	missing = required - A + (required - G) + (required - C) + (required - T)
	fill = 0
	if missing == 0 and uk == 0:
		return DNA
	if missing > uk:
		return '==='
	for i in range(len(DNA)):
		if DNA[i] == '?':
			if A < required:
				insert_this = 'A'
				A += 1
			elif C < required:
				insert_this = 'C'
				C += 1
			elif G < required:
				insert_this = 'G'
				G += 1
			elif T < required:
				insert_this = 'T'
				T += 1
			else:
				gen = ['A', 'C', 'G', 'T']
				insert_this = gen[fill]
				fill += 1
				if fill > 3:
					fill = 0
			DNA = DNA[:i] + insert_this + DNA[i + 1:]
	return DNA
n = eval(input())
DNA = input()
print(main(n, DNA))


import sys
input = sys.stdin.readline
n = int(input())
s = list(input().strip())
A = s.count('A')
G = s.count('G')
C = s.count('C')
T = s.count('T')
Q = s.count('?')
ra = n // 4 - A
rg = n // 4 - G
rc = n // 4 - C
rt = n // 4 - T
rlist = [ra, rg, rc, rt]
if n % 4 != 0:
	print('===')
	sys.exit()
for i in range(len(rlist)):
	if rlist[i] < 0:
		print('===')
		sys.exit()
if sum(rlist) == Q:
	pass
elif Q - sum(rlist) < 0:
	print('===')
	sys.exit()
elif Q - sum(rlist) > 0:
	if (Q - sum(rlist)) % 4 != 0:
		print('===')
		sys.exit()
for i in range(ra):
	s[s.index('?')] = 'A'
for i in range(rg):
	s[s.index('?')] = 'G'
for i in range(rc):
	s[s.index('?')] = 'C'
for i in range(rt):
	s[s.index('?')] = 'T'
print(''.join(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())
s = input()
if n % 4 != 0:
	print('===')
else:
	l = ''
	a = c = g = 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
	h = max(a, c, g, t)
	if h > n // 4:
		print('===')
	else:
		c = n // 4 - c
		a = n // 4 - a
		g = n // 4 - g
		t = n // 4 - t
		for i in s:
			if i != '?':
				l += i
			elif c != 0:
				c = c - 1
				l += 'C'
			elif g != 0:
				g = g - 1
				l += 'G'
			elif t != 0:
				t = t - 1
				l += 'T'
			elif a != 0:
				a = a - 1
				l += 'A'
		print(l)


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())
s = list(input())
nNum = [0, 0, 0, 0, 0]
nEl = ['A', 'G', 'C', 'T', '?']
nA = 0
nG = 0
nC = 0
nT = 0
nQQ = 0
pos = []
done = []
for i in range(n):
	if s[i] == '?':
		pos.append(i)
		nNum[4] += 1
	else:
		for j in range(4):
			if s[i] == nEl[j]:
				nNum[j] += 1
if n % 4 != 0 or nNum[0] > n / 4 or nNum[1] > n / 4 or (nNum[2] > n / 4) or (nNum[3] > n / 4):
	print('===')
else:
	for j in range(4):
		for i in range(int(n / 4) - nNum[j]):
			if pos != []:
				s[pos[0]] = nEl[j]
				pos.pop(0)
	s = ''.join(s)
	print(s)


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('===')


from collections import Counter
from collections import deque

def uncypher(genom):
	exact_each_letter_nr = len(genom) // 4
	counter = Counter(genom)
	as_needed_nr = exact_each_letter_nr - counter['A']
	cs_needed_nr = exact_each_letter_nr - counter['C']
	gs_needed_nr = exact_each_letter_nr - counter['G']
	ts_needed_nr = exact_each_letter_nr - counter['T']
	if min([as_needed_nr, cs_needed_nr, gs_needed_nr, ts_needed_nr]) < 0:
		return '==='
	else:
		ans = ''
		line_to_add = deque('A' * as_needed_nr + 'C' * cs_needed_nr + 'G' * gs_needed_nr + 'T' * ts_needed_nr)
		for char in genom:
			to_add = char
			if char == '?':
				to_add = line_to_add.pop()
			ans += to_add
		return ans
n = int(input())
if n % 4 != 0:
	print('===')
	exit()
genom = list(input())
print(uncypher(genom))


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('===')


n = int(input())
word = input()
questionMarks = 0
index = 0
dictionary = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
originalDictionary = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
maximum = 0
while index < len(word):
	c = word[index]
	if c != '?':
		dictionary[c] = dictionary[c] + 1
		originalDictionary[c] = originalDictionary[c] + 1
		if dictionary[c] > maximum:
			maximum = dictionary[c]
	else:
		questionMarks += 1
	index += 1
letters = sorted(dictionary, key=dictionary.__getitem__)
maxIndex = 3
while maxIndex >= 0 and dictionary[letters[maxIndex]] == maximum:
	maxIndex -= 1
maxIndex += 1
index = 0
while questionMarks != 0 and index < maxIndex:
	diff = maximum - dictionary[letters[index]]
	if diff <= questionMarks:
		dictionary[letters[index]] = maximum
		questionMarks -= diff
		index += 1
	else:
		break
if index != maxIndex:
	print('===')
elif questionMarks % 4 != 0:
	print('===')
else:
	surplus = int(questionMarks / 4)
	for c in letters:
		dictionary[c] = maximum + surplus
		originalDictionary[c] = dictionary[c] - originalDictionary[c]
	wordArr = list(word)
	wordIndex = 0
	letterIndex = 0
	for c in wordArr:
		if c == '?':
			letter = letters[letterIndex]
			while originalDictionary[letter] == 0:
				letterIndex += 1
				letter = letters[letterIndex]
			wordArr[wordIndex] = letter
			originalDictionary[letter] -= 1
		wordIndex += 1
	print(''.join(wordArr))


def mamutGenome():
	n = int(input())
	genomeCode = list(input())
	letters = [[], [], [], [], []]
	if n % 4 == 0:
		for i in range(0, n):
			if genomeCode[i] == 'A':
				letters[0].append(i)
			elif genomeCode[i] == 'C':
				letters[1].append(i)
			elif genomeCode[i] == 'G':
				letters[2].append(i)
			elif genomeCode[i] == 'T':
				letters[3].append(i)
			elif genomeCode[i] == '?':
				letters[4].append(i)
		maxLetters = n // 4
		if len(letters[0]) > maxLetters or len(letters[1]) > maxLetters or len(letters[2]) > maxLetters or (len(letters[3]) > maxLetters):
			print('===')
			return
		elif len(letters[4]) == 0:
			print(''.join(genomeCode))
			return
		if len(letters[0]) == 0 and len(letters[1]) == 0 and (len(letters[2]) == 0) and (len(letters[3]) == 0):
			k = 0
			for i in range(0, n):
				if k == 0:
					currentLetter = 'A'
				elif k == 1:
					currentLetter = 'C'
				elif k == 2:
					currentLetter = 'G'
				elif k == 3:
					currentLetter = 'T'
				genomeCode[i] = currentLetter
				k += 1
				k %= 4
			print(''.join(genomeCode))
			return
		for i in range(0, 4):
			if i == 0:
				currentLetter = 'A'
			elif i == 1:
				currentLetter = 'C'
			elif i == 2:
				currentLetter = 'G'
			elif i == 3:
				currentLetter = 'T'
			while len(letters[i]) < maxLetters and len(letters[4]) > 0:
				genomeCode[letters[4][0]] = currentLetter
				letters[i].append(letters[4][0])
				del letters[4][0]
		print(''.join(genomeCode))
	else:
		print('===')
mamutGenome()


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))


from collections import Counter as C
(n, s) = (input(), input())
c = C(s)
q = c['?']
del c['?']
try:
	m = c.most_common(1)[0][1]
except IndexError:
	m = q // 4
t = 0
for e in 'ACGT':
	b = m - c[e]
	t += b
if (q - t) % 4 != 0 or q < t:
	print('===')
	exit()
r = (q - t) // 4
a = []
for e in 'ACGT':
	b = m - c[e]
	a += (b + r) * e
print(''.join((l if l != '?' else a.pop() for l in s)))


n = int(input())
s = input()
cq = s.count('?')
acgt = ['A', 'C', 'G', 'T']
c_all = [s.count('A'), s.count('C'), s.count('G'), s.count('T')]
if cq == 0:
	if c_all[0] == c_all[1] == c_all[2] == c_all[3]:
		print(s)
	else:
		print('===')
elif cq == n and n % 4 == 0:
	if n > 0:
		print('ACGT' * (n // 4))
	else:
		print('===')
elif n % 4 != 0:
	print('===')
else:
	gt = max(c_all)
	to_uncode = gt * 4 - sum(c_all)
	if cq % 4 != to_uncode % 4 or gt * 4 > n:
		print('===')
	else:
		eo_size = n // 4
		for i in range(len(acgt)):
			s = s.replace('?', acgt[i], eo_size - c_all[i])
		print(s)


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())
a = 0
c = 0
g = 0
t = 0
q = 0
maxim = 0
order = []
for l in s:
	if l == 'A':
		a += 1
	elif l == 'C':
		c += 1
	elif l == 'T':
		t += 1
	elif l == 'G':
		g += 1
	else:
		q += 1
	maxim = max(a, c, t, g)
a = maxim - a
c = maxim - c
t = maxim - t
g = maxim - g
need = a + c + t + g
aux = 0
word = ''
if need == 0:
	a = q / 4
	c = q / 4
	t = q / 4
	g = q / 4
	need = q
if n % 4:
	print('===')
elif need == q or q > need:
	for l in s:
		letter = l
		if letter == '?':
			if max(a, c, t, g) == 0:
				a = q / 4
				c = q / 4
				t = q / 4
				g = q / 4
			if a > 0:
				letter = 'A'
				a -= 1
				q -= 1
			elif c > 0:
				letter = 'C'
				c -= 1
				q -= 1
			elif t > 0:
				letter = 'T'
				t -= 1
				q -= 1
			elif g > 0:
				letter = 'G'
				g -= 1
				q -= 1
		word += letter
	print(word)
else:
	print('===')


b = int(input())
a = input()
if b % 4 != 0:
	print('===')
else:
	r = [b // 4] * 4
	C = a.count('C')
	A = a.count('A')
	G = a.count('G')
	T = a.count('T')
	r[0] -= C
	r[1] -= A
	r[2] -= G
	r[3] -= T
	s = ''
	for i in range(b):
		if a[i] == '?':
			if r[0] > 0:
				s += 'C'
				r[0] -= 1
			elif r[1] > 0:
				s += 'A'
				r[1] -= 1
			elif r[2] > 0:
				s += 'G'
				r[2] -= 1
			elif r[3] > 0:
				s += 'T'
				r[3] -= 1
		else:
			s += a[i]
	e = max(s.count('A'), s.count('C'), s.count('G'), s.count('T'))
	if e > b // 4:
		print('===')
	else:
		print(s)


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


n = int(input())
s = str(input())
if n % 4 != 0:
	print('===')
	exit()
div = n // 4
(a, g, c, t) = (0, 0, 0, 0)
for i in range(n):
	cur = s[i]
	if cur == 'A':
		a += 1
	elif cur == 'G':
		g += 1
	elif cur == 'C':
		c += 1
	elif cur == 'T':
		t += 1
	if any([a > div, g > div, c > div, t > div]):
		print('===')
		exit()
ss = ''
for i in range(n):
	if s[i] == '?':
		if a < div:
			ss += 'A'
			a += 1
		elif g < div:
			ss += 'G'
			g += 1
		elif c < div:
			ss += 'C'
			c += 1
		else:
			ss += 'T'
			t += 1
	else:
		ss += s[i]
print(ss)


def main():
	n = int(input())
	if n % 4 != 0:
		print('===')
		return
	s = input()
	A = n // 4 - s.count('A')
	C = n // 4 - s.count('C')
	T = n // 4 - s.count('T')
	G = n // 4 - s.count('G')
	if A < 0 or C < 0 or T < 0 or (G < 0):
		print('===')
		return
	s = list(s)
	for i in range(n):
		if s[i] == '?':
			if A > 0:
				s[i] = 'A'
				A -= 1
			elif C > 0:
				s[i] = 'C'
				C -= 1
			elif T > 0:
				s[i] = 'T'
				T -= 1
			else:
				s[i] = 'G'
				G -= 1
	print(''.join(s))
main()


n = int(input())
s = input()
d = dict()
d['A'] = 0
d['C'] = 0
d['G'] = 0
d['T'] = 0
d['?'] = 0
for i in range(n):
	d[s[i]] += 1
mx = max(d['A'], d['C'], d['G'], d['T'])
r = mx * 4 - (d['A'] + d['C'] + d['G'] + d['T'])
if r > d['?'] or (d['?'] - r) % 4:
	print('===')
else:
	ans = [0] * n
	ans = list(s)
	i = 0
	while mx - d['A']:
		if s[i] == '?':
			ans[i] = 'A'
			d['A'] += 1
		i += 1
	while mx - d['C']:
		if s[i] == '?':
			ans[i] = 'C'
			d['C'] += 1
		i += 1
	while mx - d['G']:
		if s[i] == '?':
			ans[i] = 'G'
			d['G'] += 1
		i += 1
	while mx - d['T']:
		if s[i] == '?':
			ans[i] = 'T'
			d['T'] += 1
		i += 1
	s1 = 'ACGT'
	j = 0
	while i < n:
		if s[i] == '?':
			ans[i] = s1[j]
			j = (j + 1) % 4
		i += 1
	print(''.join(map(str, ans)))


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


input()
s = input()
foo = {'A': 0, 'G': 0, 'C': 0, 'T': 0}
qu = 0
for c in s:
	if c == '?':
		qu += 1
	elif c not in foo.keys():
		foo[c] = 1
	else:
		foo[c] += 1
m = max(foo.values())
for (k, v) in foo.items():
	foo[k] = m - foo[k]
su = sum(foo.values())
a = abs(su - qu) // 4
for (k, v) in foo.items():
	foo[k] += a
if su <= qu and (su - qu) % 4 == 0:
	out = []
	for c in s:
		if c == '?':
			for (k, v) in foo.items():
				if v > 0:
					out.append(k)
					foo[k] -= 1
					break
		else:
			out.append(c)
	print(''.join(out))
else:
	print('===')


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


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()
arr = []
for i in range(0, len(s)):
	arr.append(s[i])
a = 0
g = 0
c = 0
t = 0
q = 0
index = []
for i in range(0, len(s)):
	if s[i] == 'A':
		a += 1
	elif s[i] == 'G':
		g += 1
	elif s[i] == 'C':
		c += 1
	elif s[i] == 'T':
		t = t + 1
	else:
		q += 1
		index.append(i)
ans = 0
maxi = max(a, g, c, t)
if 4 * max(a, g, c, t) - a - g - c - t <= q:
	if (q - 4 * max(a, g, c, t) + a + g + c + t) % 4 == 0 and q - 4 * max(a, g, c, t) + a + g + c + t >= 0:
		i = 0
		while maxi - a > 0:
			arr[index[i]] = 'A'
			i = i + 1
			a = a + 1
		while maxi - g > 0:
			arr[index[i]] = 'G'
			i = i + 1
			g = g + 1
		while maxi - c > 0:
			arr[index[i]] = 'C'
			i = i + 1
			c = c + 1
		while maxi - t > 0:
			arr[index[i]] = 'T'
			i = i + 1
			t = t + 1
		while i < q:
			arr[index[i]] = 'A'
			i = i + 1
			arr[index[i]] = 'G'
			i = i + 1
			arr[index[i]] = 'C'
			i = i + 1
			arr[index[i]] = 'T'
			i = i + 1
		for i in range(0, len(arr)):
			print(arr[i], end='')
	else:
		print('===')
else:
	print('===')


n = int(input().strip())
s = input().strip()
from collections import Counter
c = Counter(s)
if n % 4 != 0:
	print('===')
	exit()
correct = n // 4
inputs = ['A'] * (correct - c['A']) + ['G'] * (correct - c['G']) + ['C'] * (correct - c['C']) + ['T'] * (correct - c['T'])
s = list(s)
for (ind, i) in enumerate(s):
	if i == '?':
		s[ind] = inputs.pop()
if len(inputs) > 0:
	print('===')
else:
	print(''.join(s))


from collections import Counter
n = int(input())
string = input()
cnt = Counter()
for c in string:
	cnt[c] += 1
mx = max(cnt['A'], cnt['T'], cnt['G'], cnt['C'])
tosub = 4 * mx - cnt['A'] - cnt['T'] - cnt['G'] - cnt['C']
unk = string.count('?')
if unk < tosub or (unk - tosub) % 4 != 0:
	print('===')
else:
	replacement = list()
	replacement.extend((mx - cnt['A'] + (unk - tosub) // 4) * 'A')
	replacement.extend((mx - cnt['T'] + (unk - tosub) // 4) * 'T')
	replacement.extend((mx - cnt['G'] + (unk - tosub) // 4) * 'G')
	replacement.extend((mx - cnt['C'] + (unk - tosub) // 4) * 'C')
	ans = list()
	idx = 0
	for c in string:
		if c == '?':
			ans.append(replacement[idx])
			idx += 1
		else:
			ans.append(c)
	print(''.join(ans))


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)


d = {'A': 0, 'G': 0, 'C': 0, 'T': 0}
n = int(input())
a = input()
c1 = 0
a = list(a)
if n % 4 == 0:
	for i in a:
		if i == '?':
			c1 += 1
		else:
			d[i] += 1
	k = n // 4
	ra = k - d['A']
	rg = k - d['G']
	rc = k - d['C']
	rt = k - d['T']
	for i in range(n):
		if a[i] == '?':
			if ra != 0:
				a[i] = 'A'
				ra -= 1
			elif rg != 0:
				a[i] = 'G'
				rg -= 1
			elif rc != 0:
				a[i] = 'C'
				rc -= 1
			elif rt != 'T':
				a[i] = 'T'
				rt -= 1
	if a.count('A') == k and a.count('G') == k and (a.count('C') == k) and (a.count('T') == k):
		print(*a, sep='')
	else:
		print('===')
else:
	print('===')


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

def yolo():
	if n % 4:
		print('===')
		return
	A = s.count('A')
	C = s.count('C')
	T = s.count('T')
	G = s.count('G')
	if max(A, C, T, G) > n / 4:
		print('===')
		return
	filled = ''
	for i in s:
		if i != '?':
			filled += i
		elif A < n / 4:
			filled += 'A'
			A += 1
		elif G < n / 4:
			filled += 'G'
			G += 1
		elif C < n / 4:
			filled += 'C'
			C += 1
		elif T < n / 4:
			filled += 'T'
			T += 1
	print(filled)
	return
yolo()


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('===')


n = int(input())
s = str(input())
x1 = s.count('A')
x2 = s.count('C')
x3 = s.count('G')
x4 = s.count('T')
l = len(s)
t = len(s) // 4
l1 = []
for x in s:
	l1.append(x)
if len(s) % 4 != 0:
	print('===')
else:
	for x in range(l):
		if l1[x] == '?':
			if x1 < t:
				l1[x] = 'A'
				x1 += 1
			elif x2 < t:
				l1[x] = 'C'
				x2 += 1
			elif x3 < t:
				l1[x] = 'G'
				x3 += 1
			elif x4 < t:
				l1[x] = 'T'
				x4 += 1
	if x1 == x2 and x1 == x3 and (x1 == x4):
		for x in range(l):
			print(l1[x], end='')
	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())
a = list(input())
l = [0, 0, 0, 0, 0]
for i in a:
	if i == 'A':
		l[0] += 1
	elif i == 'C':
		l[1] += 1
	elif i == 'G':
		l[2] += 1
	elif i == 'T':
		l[3] += 1
	else:
		l[4] += 1
max1 = max(l[:-1])
req = 0
for i in l[:-1]:
	req = req + (max1 - i)
if (req != l[-1] and l[-1] != n) and ((l[-1] - req) % 4 != 0 or l[-1] < req) or (l[-1] == n and n % 4 != 0):
	print('===')
elif l[-1] == n:
	print('ACGT' * (l[-1] // 4))
else:
	i = 1
	j = 0
	while i <= max1 - l[0]:
		if a[j] == '?':
			a[j] = 'A'
			i = i + 1
		j = j + 1
	i = 1
	while i <= max1 - l[1]:
		if a[j] == '?':
			a[j] = 'C'
			i = i + 1
		j = j + 1
	i = 1
	while i <= max1 - l[2]:
		if a[j] == '?':
			a[j] = 'G'
			i = i + 1
		j = j + 1
	i = 1
	while i <= max1 - l[3]:
		if a[j] == '?':
			a[j] = 'T'
			i = i + 1
		j = j + 1
	if l[-1] - req > 0:
		i = 0
		while i < (l[-1] - req) // 4:
			if a[j] == '?':
				a[j] = 'A'
				i = i + 1
			j = j + 1
		i = 0
		while i < (l[-1] - req) // 4:
			if a[j] == '?':
				a[j] = 'C'
				i = i + 1
			j = j + 1
		i = 0
		while i < (l[-1] - req) // 4:
			if a[j] == '?':
				a[j] = 'G'
				i = i + 1
			j = j + 1
		i = 0
		while i < (l[-1] - req) // 4:
			if a[j] == '?':
				a[j] = 'T'
				i = i + 1
			j = j + 1
	for i in a:
		print(i, end='')


(n, s) = (int(input()), list(input()))
(c, ci) = ([s.count(b) for b in 'ACGT'], 0)
if n % 4 or max(c) > n // 4:
	print('===')
	exit()
for i in range(n):
	if s[i] == '?':
		while c[ci] == n // 4:
			ci += 1
		s[i] = 'ACGT'[ci]
		c[ci] += 1
print(''.join(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, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	s = S()
	if n % 4 != 0:
		return '==='
	a = g = c = t = n // 4
	for x in s:
		if x == 'A':
			a -= 1
		elif x == 'G':
			g -= 1
		elif x == 'C':
			c -= 1
		elif x == 'T':
			t -= 1
	if a < 0 or g < 0 or c < 0 or (t < 0):
		return '==='
	s = list(s)
	for i in range(n):
		if s[i] == '?':
			if a > 0:
				a -= 1
				s[i] = 'A'
			elif g > 0:
				g -= 1
				s[i] = 'G'
			elif c > 0:
				c -= 1
				s[i] = 'C'
			elif t > 0:
				t -= 1
				s[i] = 'T'
	return ''.join(s)
print(main())


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))


lenght = int(input())
strng = input()
A = 0
G = 0
C = 0
T = 0
ans = ''
flag = 0
for i in strng:
	if i == '?':
		continue
	elif i == 'A':
		A += 1
	elif i == 'G':
		G += 1
	elif i == 'T':
		T += 1
	elif i == 'C':
		C += 1
if A > lenght // 4 or G > lenght // 4 or C > lenght // 4 or (T > lenght // 4) or (lenght % 4 != 0):
	flag = 1
if flag == 0:
	for i in range(len(strng)):
		if strng[i] != '?':
			ans += strng[i]
		elif A < lenght // 4:
			A += 1
			ans += 'A'
		elif G < lenght // 4:
			G += 1
			ans += 'G'
		elif C < lenght // 4:
			C += 1
			ans += 'C'
		elif T < lenght // 4:
			T += 1
			ans += 'T'
print(ans) if flag == 0 else print('===')


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))


import operator

def decodeGeonma(s, n):
	genomes = {}
	genomes['A'] = 0
	genomes['G'] = 0
	genomes['C'] = 0
	genomes['T'] = 0
	incognitos = 0
	pos_incognitos = []
	for genome in s:
		if genome != '?':
			genomes[genome] += 1
		else:
			incognitos += 1
	MAX = max(genomes.items(), key=operator.itemgetter(1))[0]
	max_value = genomes[MAX] if genomes[MAX] > 0 else 1
	for k in genomes.keys():
		if genomes[k] < max_value:
			while genomes[k] < max_value:
				incognitos -= 1
				genomes[k] += 1
				pos_incognitos.append(k)
	if incognitos < 0:
		return '==='
	if incognitos > 0 and incognitos % 4 != 0:
		return '==='
	elif incognitos != 0:
		rest = incognitos // 4
		for i in range(rest):
			pos_incognitos.append('A')
			pos_incognitos.append('C')
			pos_incognitos.append('T')
			pos_incognitos.append('G')
	res = ''
	for i in s:
		if i == '?':
			res += pos_incognitos.pop(0)
		else:
			res += i
	return res
n = int(input())
s = input()
print(decodeGeonma(s, n))


n = int(input())
s = input()
alph = 'AGCT'
ai = [s.count(alph[i]) for i in range(4)]
ans = [max(ai) - ai[i] for i in range(4)]
if sum(ans) > s.count('?') or (s.count('?') - sum(ans)) % 4 != 0:
	print('===')
else:
	temp = (s.count('?') - sum(ans)) // 4
	for i in range(4):
		s = s.replace('?', alph[i], ans[i] + temp)
	print(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('===')


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

def problem4(n, s):
	dicti = {}
	if len(s) < 4:
		print('===')
		return
	else:
		cont = 0
		pos = []
		(dicti['A'], dicti['G'], dicti['C'], dicti['T']) = (0, 0, 0, 0)
		for i in s:
			if i in dicti:
				dicti[i] += 1
			if i == '?':
				pos.append(cont)
			cont += 1
		for i in pos:
			letra = min(dicti, key=dicti.get)
			s = s[:i] + letra + s[i + 1:]
			dicti[letra] += 1
		if dicti['A'] == dicti['G'] == dicti['C'] == dicti['T']:
			print(s)
		else:
			print('===')
problem4(n, s)


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)


n = int(input())
x = input()
y = [i for i in x]
n = len(x)
if n % 4 != 0:
	print('===')
else:
	a = x.count('A')
	t = x.count('T')
	c = x.count('C')
	g = x.count('G')
	q = x.count('?')
	s = [[a, 'A'], [t, 'T'], [g, 'G'], [c, 'C']]
	s.sort()
	if s[3][0] - s[2][0] + s[3][0] - s[1][0] + s[3][0] - s[0][0] > q:
		print('===')
	else:
		for i in range(3):
			for j in range(s[3][0] - s[i][0]):
				y[y.index('?')] = s[i][1]
		a = y.count('A')
		t = y.count('T')
		c = y.count('C')
		g = y.count('G')
		q = y.count('?')
		if q == 0:
			print(''.join(y))
		elif q % 4 != 0:
			print('===')
		else:
			for i in range(q):
				y[y.index('?')] = s[i % 4][1]
			x = ''.join(y)
			print(x)


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 = input()
line = [0, 0, 0, 0]
if n % 4 != 0:
	print('===')
else:
	for i in range(len(s)):
		if s[i] == 'A':
			line[0] += 1
		if s[i] == 'C':
			line[1] += 1
		if s[i] == 'T':
			line[2] += 1
		if s[i] == 'G':
			line[3] += 1
	if max(line) > n // 4:
		print('===')
	else:
		ss = ''
		for i in range(len(s)):
			if s[i] != '?':
				ss += s[i]
			elif line[0] < n // 4:
				ss += 'A'
				line[0] += 1
			elif line[1] < n // 4:
				ss += 'C'
				line[1] += 1
			elif line[2] < n // 4:
				ss += 'T'
				line[2] += 1
			elif line[3] < n // 4:
				ss += 'G'
				line[3] += 1
		print(ss)


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)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
n = get_int()
s = list(get_string())
if n % 4 == 0:
	d = {'A': n // 4, 'G': n // 4, 'C': n // 4, 'T': n // 4}
	flag = True
	for (i, v) in d.items():
		if v < s.count(i):
			flag = False
			break
	if flag:
		for ele in s:
			if ele != '?':
				d[ele] -= 1
		res = ''
		for (i, v) in d.items():
			res += i * d[i]
		i = 0
		for j in range(n):
			if s[j] == '?':
				s[j] = res[i]
				i += 1
		print(''.join(s))
	else:
		print('===')
else:
	print('===')


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('===')


from collections import Counter, defaultdict
input()
s = input()
counts = Counter(s)
counts_ = defaultdict(int)
for (x, y) in counts.items():
	counts_[x] = y
counts = counts_
free_symbols = counts['?']
del counts['?']
for x in ('C', 'A', 'G', 'T'):
	if x not in counts:
		counts[x] = 0
maximum_count = max(counts.values())
needed_to_reach_max = sum((maximum_count - x for x in counts.values()))
if needed_to_reach_max != 0 and needed_to_reach_max > free_symbols:
	print('===')
	exit(0)
if (free_symbols - needed_to_reach_max) % 4 != 0:
	print('===')
	exit(0)
for x in counts:
	counts[x] = maximum_count - counts[x]
	if free_symbols - needed_to_reach_max > 0:
		counts[x] += (free_symbols - needed_to_reach_max) // 4

def impute(symbol):
	if symbol != '?':
		return symbol
	for x in ('C', 'A', 'G', 'T'):
		if counts[x] != 0:
			counts[x] -= 1
			return x
print(''.join(map(impute, s)))


n = int(input())
input_string = input()
if n % 4 != 0:
	print('===')
else:
	map = {}
	map['A'] = []
	map['G'] = []
	map['C'] = []
	map['T'] = []
	map['?'] = []
	for i in range(0, len(input_string)):
		map[input_string[i]].append(i)
	fault = False
	for key in map.keys():
		value = map[key]
		if key != '?' and len(value) > int(n / 4):
			fault = True
			break
	if fault == True:
		print('===')
	else:
		for key in map.keys():
			if key != '?':
				value = map[key]
				if len(value) < int(n / 4):
					for i in range(0, int(n / 4) - len(value)):
						index = map['?'].pop()
						input_string = input_string[:index] + key + input_string[index + 1:]
		print(input_string)


n = int(input())
s = input().rstrip()
x = list(s)
L = [0] * 4
Q = []
W = []
S = []
D = []
ques = 0
for i in range(0, len(x)):
	if x[i] == 'A':
		L[0] += 1
	elif x[i] == 'G':
		L[1] += 1
	elif x[i] == 'C':
		L[2] += 1
	elif x[i] == 'T':
		L[3] += 1
	else:
		ques += 1
T = max(L)
ans = 0
for i in range(0, len(L)):
	ans += T - L[i]
if ans > ques:
	print('===')
elif ans == ques:
	for i in range(0, len(x)):
		if x[i] == '?':
			if L[0] != T:
				print('A', end='')
				L[0] += 1
			elif L[1] != T:
				print('G', end='')
				L[1] += 1
			elif L[2] != T:
				print('C', end='')
				L[2] += 1
			elif L[3] != T:
				print('T', end='')
				L[3] += 1
		else:
			print(x[i], end='')
else:
	W = ques - ans
	if W % 4 != 0:
		print('===')
	else:
		R = 0
		for i in range(0, len(x)):
			if x[i] == '?':
				if L[0] != T:
					print('A', end='')
					L[0] += 1
				elif L[1] != T:
					print('G', end='')
					L[1] += 1
				elif L[2] != T:
					print('C', end='')
					L[2] += 1
				elif L[3] != T:
					print('T', end='')
					L[3] += 1
				elif R == 0:
					print('A', end='')
					R = 1
				elif R == 1:
					print('G', end='')
					R = 2
				elif R == 2:
					print('C', end='')
					R = 3
				elif R == 3:
					print('T', end='')
					R = 0
			else:
				print(x[i], end='')


glength = int(input())
string = list(input())
if glength % 4 != 0:
	print('===')
	exit()
else:
	aux = glength / 4
	marks = string.count('?')
	if string.count('A') > aux or string.count('C') > aux or string.count('G') > aux or (string.count('T') > aux):
		print('===')
	else:
		while marks > 0:
			if string.count('A') < aux:
				string[string.index('?')] = 'A'
				marks = marks - 1
			if string.count('C') < aux:
				string[string.index('?')] = 'C'
				marks = marks - 1
			if string.count('G') < aux:
				string[string.index('?')] = 'G'
				marks = marks - 1
			if string.count('T') < aux:
				string[string.index('?')] = 'T'
				marks = marks - 1
		result = ''.join(string)
		print(result)


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())
s = input()
a = s.count('A')
g = s.count('G')
c = s.count('C')
t = s.count('T')
qm = s.count('?')
if n % 4 != 0:
	print('===')
elif max(a, g, c, t) > n // 4:
	print('===')
else:
	q = []
	q.extend(['A'] * (n // 4 - a))
	q.extend(['G'] * (n // 4 - g))
	q.extend(['C'] * (n // 4 - c))
	q.extend(['T'] * (n // 4 - t))
	for i in range(n):
		if s[i] == '?':
			print(q.pop(), end='')
		else:
			print(s[i], end='')


size = int(input())
genome = input()

def check(string):
	listA = []
	listG = []
	listC = []
	listT = []
	for i in string:
		if i == 'A':
			listA.append('A')
		elif i == 'G':
			listG.append('G')
		elif i == 'C':
			listC.append('C')
		elif i == 'T':
			listT.append('T')
		pass
	n = size / 4
	if len(listA) > n:
		print('===')
	elif len(listG) > n:
		print('===')
	elif len(listC) > n:
		print('===')
	elif len(listT) > n:
		print('===')
	else:
		listPut = []
		new = ''
		listPut.append(n - len(listA))
		listPut.append(n - len(listG))
		listPut.append(n - len(listC))
		listPut.append(n - len(listT))
		for i in string:
			if i == '?':
				if listPut[0] > 0:
					new += 'A'
					listPut[0] -= 1
				elif listPut[1] > 0:
					new += 'G'
					listPut[1] -= 1
				elif listPut[2] > 0:
					new += 'C'
					listPut[2] -= 1
				elif listPut[3] > 0:
					new += 'T'
					listPut[3] -= 1
			else:
				new += i
		pass
		print(new)
if len(genome) % 4 == 0:
	check(genome)
else:
	print('===')


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

def gen(s, n):
	a = s.count('A')
	g = s.count('G')
	c = s.count('C')
	t = s.count('T')
	i = s.count('?')
	if n % 4 != 0:
		return '==='
	if a > n / 4:
		return '==='
	if c > n / 4:
		return '==='
	if g > n / 4:
		return '==='
	if t > n / 4:
		return '==='
	s = list(s)
	for x in range(n):
		if i == 0:
			return ''.join(s)
		if s[x] == '?':
			if a < n / 4:
				s[x] = 'A'
				a += 1
				i -= 1
				continue
			if g < n / 4:
				s[x] = 'G'
				g += 1
				i -= 1
				continue
			if c < n / 4:
				s[x] = 'C'
				c += 1
				i -= 1
				continue
			if t < n / 4:
				s[x] = 'T'
				t += 1
				i -= 1
				continue
	return ''.join(s)
print(gen(s, n))


n = int(input())
str1 = input()
list1 = list(str1)
countA = list1.count('A')
countG = list1.count('G')
countC = list1.count('C')
countT = list1.count('T')
countSymb = list1.count('?')
countList = [countA, countG, countC, countT]
if countA == countG and countA == countC and (countA == countT) and (countSymb == 0):
	print(str1)
elif countSymb == len(list1):
	if countSymb % 4 == 0:
		noOfA = countSymb // 4
		noOfG = countSymb // 4
		noOfC = countSymb // 4
		noOfT = countSymb // 4
		strA = noOfA * 'A'
		strG = noOfG * 'G'
		strC = noOfC * 'C'
		strT = noOfT * 'T'
		print(strA + strG + strC + strT)
	else:
		print('===')
else:
	maxCount = max(countList)
	index = countList.index(max(countList))
	if index == 0:
		remG = maxCount - countG
		remC = maxCount - countC
		remT = maxCount - countT
		temp = remG + remC + remT
		countSymb -= temp
		if countSymb >= 0:
			for _ in range(remG):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'G'
						break
			for _ in range(remC):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'C'
						break
			for _ in range(remT):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'T'
						break
			countSymb2 = list1.count('?')
			if countSymb2 % 4 == 0:
				noOfA = countSymb // 4
				noOfG = countSymb // 4
				noOfC = countSymb // 4
				noOfT = countSymb // 4
				for _ in range(noOfA):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'A'
							break
				for _ in range(noOfG):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'G'
							break
				for _ in range(noOfC):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'C'
							break
				for _ in range(noOfT):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'T'
							break
			if list1.count('?') == 0:
				print(''.join(list1))
			else:
				print('===')
		else:
			print('===')
	elif index == 1:
		remA = maxCount - countA
		remC = maxCount - countC
		remT = maxCount - countT
		temp = remA + remC + remT
		countSymb -= temp
		if countSymb >= 0:
			for _ in range(remA):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'A'
						break
			for _ in range(remC):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'C'
						break
			for _ in range(remT):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'T'
						break
			countSymb2 = list1.count('?')
			if countSymb2 % 4 == 0:
				noOfA = countSymb // 4
				noOfG = countSymb // 4
				noOfC = countSymb // 4
				noOfT = countSymb // 4
				for _ in range(noOfA):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'A'
							break
				for _ in range(noOfG):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'G'
							break
				for _ in range(noOfC):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'C'
							break
				for _ in range(noOfT):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'T'
							break
			if list1.count('?') == 0:
				print(''.join(list1))
			else:
				print('===')
		else:
			print('===')
	elif index == 2:
		remG = maxCount - countG
		remA = maxCount - countA
		remT = maxCount - countT
		temp = remG + remA + remT
		countSymb -= temp
		if countSymb >= 0:
			for _ in range(remG):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'G'
						break
			for _ in range(remA):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'A'
						break
			for _ in range(remT):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'T'
						break
			countSymb2 = list1.count('?')
			if countSymb2 % 4 == 0:
				noOfA = countSymb // 4
				noOfG = countSymb // 4
				noOfC = countSymb // 4
				noOfT = countSymb // 4
				for _ in range(noOfA):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'A'
							break
				for _ in range(noOfG):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'G'
							break
				for _ in range(noOfC):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'C'
							break
				for _ in range(noOfT):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'T'
							break
			if list1.count('?') == 0:
				print(''.join(list1))
			else:
				print('===')
		else:
			print('===')
	elif index == 3:
		remG = maxCount - countG
		remC = maxCount - countC
		remA = maxCount - countA
		temp = remG + remC + remA
		countSymb -= temp
		if countSymb >= 0:
			for _ in range(remG):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'G'
						break
			for _ in range(remA):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'A'
						break
			for _ in range(remC):
				for i in range(len(list1)):
					if list1[i] == '?':
						list1[i] = 'C'
						break
			countSymb2 = list1.count('?')
			if countSymb2 % 4 == 0:
				noOfA = countSymb // 4
				noOfG = countSymb // 4
				noOfC = countSymb // 4
				noOfT = countSymb // 4
				for _ in range(noOfA):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'A'
							break
				for _ in range(noOfG):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'G'
							break
				for _ in range(noOfC):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'C'
							break
				for _ in range(noOfT):
					for i in range(len(list1)):
						if list1[i] == '?':
							list1[i] = 'T'
							break
			if list1.count('?') == 0:
				print(''.join(list1))
			else:
				print('===')
		else:
			print('===')


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())
a = input()
d = {x: 0 for x in 'ACGT?'}
for i in a:
	d[i] += 1
k = 0
for i in d:
	if i != '?':
		k = max(k, d[i])
b = 4 * k - n + d['?']
if b <= d['?'] and (b - d['?']) % 4 == 0:
	l = b
	b = []
	for i in d:
		if i != '?':
			for j in range(k - d[i]):
				b.append(i)
	l = ['A', 'G', 'T', 'C'] * ((-l + d['?']) // 4)
	b.extend(l)
	for i in a:
		if i == '?':
			print(b.pop(), end='')
		else:
			print(i, end='')
else:
	print('===')


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())
gene = input()
dict = {'A': int(n / 4) - gene.count('A'), 'G': int(n / 4) - gene.count('G'), 'C': int(n / 4) - gene.count('C'), 'T': int(n / 4) - gene.count('T'), '?': gene.count('?')}
if n % 4 != 0:
	print('===')
else:
	dict.pop('?')
	for a in dict:
		if dict[a] < 0:
			gene = '==='
			break
		while dict[a] > 0:
			gene = gene.replace('?', a, 1)
			dict[a] -= 1
	print(gene)


lectura = int(input())
texto = input()
lista = list(texto)
a = lista.count('A')
t = lista.count('T')
g = lista.count('G')
c = lista.count('C')
des = lista.count('?')
maxima = lectura // 4
if a > maxima or t > maxima or c > maxima or (c > maxima):
	print('===')
else:
	listo = True
	for i in range(0, lectura):
		if lista[i] == '?':
			if a < maxima:
				lista[i] = 'A'
				a += 1
			elif t < maxima:
				lista[i] = 'T'
				t += 1
			elif c < maxima:
				lista[i] = 'C'
				c += 1
			elif g < maxima:
				lista[i] = 'G'
				g += 1
			else:
				print('===')
				listo = False
				break
	if listo == True and a == g == t == c:
		print(''.join(lista))
	elif listo == True:
		print('===')


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))


import sys
n = int(input())
txtInit = input()
txt = list(txtInit)
genCant = [0, 0, 0, 0]
posPre = []
genFaltante = [0] * 4
letras = ['A', 'G', 'C', 'T']
if n % 4 != 0:
	print('===')
else:
	i = 0
	for x in range(0, len(txt)):
		if txt[x] == 'A':
			genCant[0] += 1
		elif txt[x] == 'G':
			genCant[1] += 1
		elif txt[x] == 'C':
			genCant[2] += 1
		elif txt[x] == 'T':
			genCant[3] += 1
		else:
			posPre.append(x)
			i = i + 1
	for x in range(0, 4):
		genFaltante[x] = max(genCant) - genCant[x]
	if sum(genFaltante) == 0 and len(posPre) > 0:
		i = 0
		for x in range(0, n):
			txt[x] = letras[i]
			i = i + 1
			if i == 4:
				i = 0
		print(''.join(txt))
	elif sum(genFaltante) - len(posPre) <= 0:
		preExtra = (sum(genFaltante) - len(posPre)) * -1
		i = 0
		u = 0
		for z in range(0, len(genFaltante)):
			while genFaltante[i] > 0:
				txt[posPre[u]] = letras[i]
				u = u + 1
				genFaltante[i] = genFaltante[i] - 1
			i = i + 1
		i = 0
		for x in range(0, preExtra):
			txt[posPre[u]] = letras[i]
			u = u + 1
			i = i + 1
			if i == 4:
				i = 0
		print(''.join(txt))
	else:
		print('===')


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])


from collections import defaultdict
n = int(input())
dna = input()
bag = defaultdict(int)
for c in dna:
	bag[c] += 1
chrs = 'AGCT'
can = True
qmarks = bag['?']
del bag['?']
if qmarks > 0:
	off = 0
	top = 0
	for key in bag:
		if bag[key] > top:
			top = bag[key]
	missing = {}
	for c in chrs:
		diff = top - bag[c]
		if diff > 0:
			missing[c] = diff
		off += diff
	if qmarks - off >= 0 and (qmarks - off) % 4 == 0:
		todo = []
		if qmarks - off > 0:
			for c in chrs:
				todo += [c] * ((qmarks - off) // 4)
		for key in missing:
			todo += [key] * missing[key]
		for c in dna:
			if c == '?':
				print(todo.pop(), end='')
			else:
				print(c, end='')
		print()
	else:
		print('===')
else:
	can = True
	for c in chrs:
		if c not in bag:
			can = False
	first = -1
	for key in bag:
		if first < 0:
			first = bag[key]
		elif bag[key] != first:
			can = False
			break
	print(dna if can else '===')


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())
d = list(map(str, input()))
f = dict(zip(['A', 'G', 'T', 'C'], [0, 0, 0, 0]))
if n % 4 != 0:
	print('===')
elif 'A' not in d and 'G' not in d and ('T' not in d) and ('C' not in d):
	for i in range(n // 4):
		print('AGTC', end='')
else:
	p = 0
	for x in d:
		if x != '?':
			f[x] += 1
		else:
			p += 1
	mx = 0
	imx = ''
	for x in f.keys():
		if f[x] > mx:
			mx = f[x]
			imx = x
	if p < 4 * mx - f['A'] - f['G'] - f['T'] - f['C'] or (p - (4 * mx - f['A'] - f['G'] - f['T'] - f['C'])) % 4 != 0:
		print('===')
	elif p == 4 * mx - f['A'] - f['G'] - f['T'] - f['C']:
		for x in d:
			if x != '?':
				print(x, end='')
			else:
				for y in f.keys():
					if f[imx] - f[y] != 0:
						print(y, end='')
						f[y] += 1
						break
	elif p > 4 * mx - f['A'] - f['G'] - f['T'] - f['C']:
		for i in range((p - (4 * mx - f['A'] - f['G'] - f['T'] - f['C'])) // 4):
			d[d.index('?')] = 'A'
			d[d.index('?')] = 'T'
			d[d.index('?')] = 'C'
			d[d.index('?')] = 'G'
		for x in d:
			if x != '?':
				print(x, end='')
			else:
				for y in f.keys():
					if f[imx] - f[y] != 0:
						print(y, end='')
						f[y] += 1
						break


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 sys

def is2power(num):
	return num & num - 1 == 0 and num > 0
array = []
for i in range(5):
	array.append(0)
number = int(input())
inGenome = list(input())
maxAppear = number / 4
for letter in inGenome:
	if letter == 'A':
		array[0] += 1
	if letter == 'G':
		array[1] += 1
	if letter == 'C':
		array[2] += 1
	if letter == 'T':
		array[3] += 1
	if letter == '?':
		array[4] += 1
for letter in inGenome:
	if letter == '?':
		for i in range(4):
			if array[i] < maxAppear:
				if i == 0:
					inGenome[inGenome.index(letter)] = 'A'
					array[0] += 1
				elif i == 1:
					inGenome[inGenome.index(letter)] = 'G'
					array[1] += 1
				elif i == 2:
					inGenome[inGenome.index(letter)] = 'C'
					array[2] += 1
				elif i == 3:
					inGenome[inGenome.index(letter)] = 'T'
					array[3] += 1
				array[4] -= 1
				break
if array[4] > 0 or array[0] > maxAppear or (array[1] > maxAppear or array[2] > maxAppear or array[3] > maxAppear):
	print('===')
else:
	print(''.join(inGenome))


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()
if n % 4 != 0:
	print('===')
else:
	A = 0
	G = 0
	C = 0
	T = 0
	for i in s:
		if i == 'A':
			A += 1
		if i == 'G':
			G += 1
		if i == 'C':
			C += 1
		if i == 'T':
			T += 1
	if max(max(A, G), max(C, T)) > n // 4:
		print('===')
	else:
		for i in s:
			if i != '?':
				print(i, end='')
			elif A < n // 4:
				print('A', end='')
				A += 1
			elif G < n // 4:
				print('G', end='')
				G += 1
			elif C < n // 4:
				print('C', end='')
				C += 1
			else:
				print('T', end='')


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)


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


n = int(input())
s = input()
na = 0
ng = 0
nc = 0
nt = 0
ans = ''
flag = 0
for i in s:
	if i == '?':
		continue
	elif i == 'A':
		na += 1
	elif i == 'G':
		ng += 1
	elif i == 'T':
		nt += 1
	elif i == 'C':
		nc += 1
if na > n // 4 or ng > n // 4 or nc > n // 4 or (nt > n // 4) or (n % 4 != 0):
	flag = 1
if flag == 0:
	for i in range(len(s)):
		if s[i] != '?':
			ans += s[i]
		elif na < n // 4:
			na += 1
			ans += 'A'
		elif ng < n // 4:
			ng += 1
			ans += 'G'
		elif nc < n // 4:
			nc += 1
			ans += 'C'
		elif nt < n // 4:
			nt += 1
			ans += 'T'
print(ans) if flag == 0 else print('===')


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)


import collections
length = int(input())
sentence = input()
counts = collections.Counter(sentence)
if length % 4 != 0:
	print('===')
elif max(counts['A'], counts['G'], counts['C'], counts['T']) > int(length / 4):
	print('===')
else:
	s = list(sentence)
	A = int(length / 4 - counts['A'])
	G = int(length / 4 - counts['G'])
	C = int(length / 4 - counts['C'])
	T = int(length / 4 - counts['T'])
	for i in range(0, length):
		if s[i] == '?':
			if A:
				s[i] = 'A'
				A -= 1
			elif G:
				s[i] = 'G'
				G -= 1
			elif C:
				s[i] = 'C'
				C -= 1
			elif T:
				s[i] = 'T'
				T -= 1
	print(''.join(s))


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('===')


nuckleo = 'ACGT'
n = int(input())
s_orig = input()
dct = {c: 0 for c in nuckleo + '?'}
for c in s_orig:
	dct[c] += 1
s = list(s_orig)
m = max((dct[c] for c in nuckleo))
k = sum((m - dct[c] for c in nuckleo))
if k > dct['?'] or n % 4 != 0:
	print('===')
else:
	i = 0
	nuck = 0
	while k > 0:
		while dct[nuckleo[nuck]] == m:
			nuck += 1
		c = nuckleo[nuck]
		if s[i] == '?':
			s[i] = c
			k -= 1
			dct[c] += 1
		i += 1
	nuck = 0
	for j in range(i, n):
		if s[j] == '?':
			s[j] = nuckleo[nuck]
			nuck = (nuck + 1) % 4
	print(''.join(s))


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)


def main():
	n = int(input())
	s = input()
	print(solver(s))

def solver(s):
	d = {'A': 0, 'T': 0, 'C': 0, 'G': 0}
	Qs = set()
	for i in range(len(s)):
		c = s[i]
		if c == 'A':
			d['A'] += 1
		elif c == 'T':
			d['T'] += 1
		elif c == 'C':
			d['C'] += 1
		elif c == 'G':
			d['G'] += 1
		elif c == '?':
			Qs.add(i)
	counts = [d[letter] for letter in d]
	m = max(counts)
	remains = 4 * m - sum(counts)
	if not (len(Qs) >= remains and (len(Qs) - remains) % 4 == 0):
		return '==='
	else:
		result = list(s)
		for letter in d:
			for i in range(d[letter], m):
				index = Qs.pop()
				result[index] = letter
		while len(Qs) != 0:
			for letter in d:
				index = Qs.pop()
				result[index] = letter
		return ''.join(result)
main()


num = int(input())
strings = input()
a = strings.count('A')
g = strings.count('G')
c = strings.count('C')
t = strings.count('T')
x = strings.count('?')
maks = max(a, g, c, t)
maksa = maks - a
maksg = maks - g
maksc = maks - c
makst = maks - t
need = maksa + maksg + maksc + makst
if len(strings) % 4 != 0:
	print('===')
else:
	maks = max(a, g, c, t)
	maksa = maks - a
	maksg = maks - g
	maksc = maks - c
	makst = maks - t
	need = maksa + maksg + maksc + makst
	if need > x:
		print('===')
	elif need == 0:
		y = x // 4
		strings = strings.replace('?', 'A', y)
		strings = strings.replace('?', 'G', y)
		strings = strings.replace('?', 'C', y)
		strings = strings.replace('?', 'T', y)
		print(strings)
	elif (x - need) % 4 == 0:
		strings = strings.replace('?', 'A', maksa)
		strings = strings.replace('?', 'G', maksg)
		strings = strings.replace('?', 'C', maksc)
		strings = strings.replace('?', 'T', makst)
		while strings.count('?') != 0:
			strings = strings.replace('?', 'A', 1)
			strings = strings.replace('?', 'G', 1)
			strings = strings.replace('?', 'C', 1)
			strings = strings.replace('?', 'T', 1)
		print(strings)
	else:
		print('===')


import math
n = int(input())
s = list(input())
ar = [0] * 1000
for ch in s:
	if ch != '?':
		ar[ord(ch)] += 1
if n % 4 == 0:
	val = n // 4
	for i in range(n):
		if s[i] == '?' and val > ar[ord('A')]:
			s[i] = 'A'
			ar[ord('A')] += 1
	for i in range(n):
		if s[i] == '?' and val > ar[ord('G')]:
			s[i] = 'G'
			ar[ord('G')] += 1
	for i in range(n):
		if s[i] == '?' and val > ar[ord('C')]:
			s[i] = 'C'
			ar[ord('C')] += 1
	for i in range(n):
		if s[i] == '?' and val > ar[ord('T')]:
			s[i] = 'T'
			ar[ord('T')] += 1
if n % 4 == 0 and ar[ord('A')] == ar[ord('G')] and (ar[ord('G')] == ar[ord('C')]) and (ar[ord('C')] == ar[ord('T')]):
	for ch in s:
		print(ch, end='')
else:
	print('===')


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='')


from collections import Counter
import operator
n = int(input())
string = input()
lst = ['A', 'G', 'C', 'T']
count = Counter(string)
questions = None
if count.get('?'):
	questions = count.pop('?')
try:
	temp_mx = max(count.items(), key=operator.itemgetter(1))[1]
except:
	pass
if not questions:
	for i in lst:
		if i not in count:
			print('===')
			exit()
	for (k, v) in count.items():
		if v < temp_mx:
			print('===')
			exit()
	print(string)
	exit()
if n % 4 != 0:
	print('===')
	exit()
mx = n // 4
if questions == n:
	temp = n // 4
	for i in lst:
		string = string.replace('?', i, temp)
	print(string)
	exit()
if n < 4 * temp_mx:
	print('===')
	exit()
for i in lst:
	if i not in count:
		count[i] = 0
for (k, v) in count.items():
	if v < mx:
		temp = mx - v
		string = string.replace('?', k, temp)
		v += temp
print(string)


from collections import defaultdict

def main():
	n = int(input())
	s = list(input())
	d = defaultdict(int)
	chars = ['A', 'C', 'G', 'T']
	ques_index = []
	max_val = -1
	m = 0
	for i in range(n):
		d[s[i]] += 1
		if s[i] == '?':
			ques_index.append(i)
			m += 1
		else:
			max_val = max(max_val, d[s[i]])
	i = 0
	flag = True
	for char in chars:
		if d[char] < max_val and char != '?':
			if max_val - d[char] <= d['?']:
				for _ in range(max_val - d[char]):
					s[ques_index[i]] = char
					i += 1
				d['?'] -= max_val - d[char]
			else:
				flag = False
				break
	if flag:
		j = 0
		if d['?'] % 4 == 0:
			while i < m:
				s[ques_index[i]] = chars[j % 4]
				j += 1
				i += 1
		else:
			flag = False
	if flag:
		print(''.join(s))
	else:
		print('===')
main()


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)


def Main(n):
	s = input()
	A = s.count('A')
	C = s.count('C')
	G = s.count('G')
	T = s.count('T')
	q = s.count('?')
	mx = 4 * max(A, C, G, T)
	have = A + C + G + T
	if mx - have > q or (q - (mx - have)) % 4 != 0:
		print('===')
		return 0
	ans = ''
	for i in range(len(s)):
		if s[i] == '?':
			if A == min(A, C, G, T):
				ans += 'A'
				A += 1
			elif C == min(A, C, G, T):
				ans += 'C'
				C += 1
			elif G == min(A, C, G, T):
				ans += 'G'
				G += 1
			elif T == min(A, C, G, T):
				ans += 'T'
				T += 1
		else:
			ans += s[i]
	print(ans)
n = int(input())
Main(n)


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


length = int(input())
s = str(input())
n = int(length / 4)
n_each = {}
ncltds = [('A', 0), ('C', 0), ('G', 0), ('T', 0)]
if length % 4 == 0:
	neuclotides = ncltds[:]
	for t in ncltds:
		if t[0] in s:
			new_t = (t[0], s.count(t[0]))
			neuclotides.remove(t)
			neuclotides.append(new_t)
	neuclotides = dict(neuclotides)
	if any((neuclotides[nctl] > n for nctl in neuclotides)):
		print('===')
	else:
		for nctl in neuclotides:
			while neuclotides[nctl] < n:
				s = s.replace('?', nctl, 1)
				neuclotides[nctl] = s.count(nctl)
		print(s)
else:
	print('===')


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)


from array import array
n = int(input())
g = input()
if n % 4 == 0:
	gnome = array('u', list(g))
	thr = n / 4
	indx_q = []
	chk = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
	for i in range(len(gnome)):
		if gnome[i] == '?':
			indx_q.append(i)
		else:
			chk[gnome[i]] += 1
	if chk['A'] > thr or chk['C'] > thr or chk['G'] > thr or (chk['T'] > thr):
		print('===')
	else:
		for (key, value) in chk.items():
			for _ in range(int(thr - value)):
				gnome[indx_q.pop()] = key
		print(''.join(list(gnome)))
else:
	print('===')


n = int(input())
s = input()
y = list(s)
a = c = g = t = q = 0
for x in s:
	if x == 'A':
		a += 1
	elif x == 'C':
		c += 1
	elif x == 'G':
		g += 1
	elif x == 'T':
		t += 1
	else:
		q += 1
m = max(a, c, g, t)
if m == 0:
	m = 1
sum = 0
sum += m - a
sum += m - c
sum += m - g
sum += m - t
if sum > q:
	print('===')
else:
	x = 0
	while x < n:
		if y[x] == '?':
			if m != a:
				y[x] = 'A'
				a += 1
			elif m != c:
				y[x] = 'C'
				c += 1
			elif m != g:
				y[x] = 'G'
				g += 1
			elif m != t:
				y[x] = 'T'
				t += 1
			else:
				m += 1
				x -= 1
		x += 1
	if a == g and g == c and (c == t):
		p = ''.join(y)
		print(p)
	else:
		print('===')


from collections import Counter
arr = ['A', 'G', 'C', 'T']
n = int(input())
st = list(input())
s = Counter(st)
if n % 4 == 0:
	q = s['?']
	m = max(s.values())
	ma = n // 4
	for i in arr:
		if s[i] > ma:
			print('===')
			break
	else:
		ans = []
		l = 0
		for i in arr:
			for j in range(ma - s[i]):
				ans.append(i)
		for i in range(len(st)):
			if st[i] == '?':
				st[i] = ans[-1]
				ans.pop()
		print(''.join(st))
else:
	print('===')


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())

def genom(n, s):
	(s_new, n4) = ('', n / 4)
	if n % 4 != 0 or s.count('A') > n4 or s.count('T') > n4 or (s.count('G') > n4) or (s.count('C') > n4):
		return '==='
	else:
		(As, Ts, Gs, Cs) = (s.count('A'), s.count('T'), s.count('G'), s.count('C'))
		for i in range(len(s)):
			if s[i] in ['A', 'T', 'G', 'C']:
				s_new += s[i]
			elif As < n4:
				s_new += 'A'
				As += 1
			elif Ts < n4:
				s_new += 'T'
				Ts += 1
			elif Gs < n4:
				s_new += 'G'
				Gs += 1
			elif Cs < n4:
				s_new += 'C'
				Cs += 1
		return s_new
print(genom(n, s))


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('===')


_len = int(input())
word = [x for x in input()]
my_dict = dict(A=0, C=0, G=0, T=0)
qmarks = 0

def get_max():
	global my_dict
	_max = 0
	for x in my_dict:
		if my_dict[x] > _max:
			_max = my_dict[x]
	if _max == 0:
		return 1
	return _max

def all_equal():
	global my_dict
	a = my_dict['A']
	for x in my_dict:
		if a != my_dict[x]:
			return False
	return True

def get_letter():
	global my_dict
	for key in my_dict:
		if my_dict[key] < get_max():
			my_dict[key] += 1
			return key
	if all_equal():
		my_dict[key] += 1
		return key
	print('===')
	exit()
for x in word:
	if x not in my_dict:
		qmarks += 1
	else:
		my_dict[x] += 1
for x in range(_len):
	if word[x] == '?':
		word[x] = get_letter()
		if word[x] == None:
			set_trace()
out = ''.join(word)
if len(set(out)) == 4 and len(out) % 4 == 0:
	print(''.join(word))
else:
	print('===')


from collections import Counter
length = int(input())
dna = input()
counts = Counter(dna)

def main():
	if length % 4 != 0:
		return '==='
	without_qmark = Counter(dna.replace('?', '')).values()
	if not without_qmark:
		most = 0
	else:
		most = max(without_qmark)
	if most > length // 4:
		return '==='
	letters = []
	miss_count = 0
	for key in 'AGCT':
		miss_amnt = length // 4 - counts[key]
		miss_count += miss_amnt
		letters.extend(key * miss_amnt)
	qcount = counts['?']
	qcount -= miss_count
	if qcount < 0:
		return '==='
	else:
		letters = iter(letters)
		res = []
		for i in range(len(dna)):
			if dna[i] == '?':
				res.append(next(letters))
			else:
				res.append(dna[i])
		return ''.join(res)
print(main())


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()
l = list(s)
a = s.count('A')
c = s.count('C')
g = s.count('G')
t = s.count('T')
q = s.count('?')
ma = n // 4
if a + g + c + t == 0:
	if q % 4 == 0:
		print('ACGT' * (q // 4))
	else:
		print('===')
else:
	for i in range(n):
		if l[i] == '?':
			if a < ma:
				l[i] = 'A'
				a += 1
				q -= 1
			elif c < ma:
				l[i] = 'C'
				c += 1
				q -= 1
			elif g < ma:
				l[i] = 'G'
				g += 1
				q -= 1
			elif t < ma:
				l[i] = 'T'
				t += 1
				q -= 1
	if q == 0 and (a == ma and c == ma and (g == ma) and (t == ma)):
		print(*l, sep='')
	else:
		print('===')


def decoding(s):
	cuenta = [0] * 4
	cuenta[0] = s.count('A')
	cuenta[1] = s.count('C')
	cuenta[2] = s.count('G')
	cuenta[3] = s.count('T')
	faltantesA = max(cuenta) - cuenta[0]
	faltantesC = max(cuenta) - cuenta[1]
	faltantesG = max(cuenta) - cuenta[2]
	faltantesT = max(cuenta) - cuenta[3]
	faltantesTotales = faltantesA + faltantesC + faltantesG + faltantesT
	incognitas = s.count('?')
	if len(s) % 4 != 0:
		return '==='
	tmp1 = s.replace('?', 'A', faltantesA)
	tmp2 = tmp1.replace('?', 'C', faltantesC)
	tmp3 = tmp2.replace('?', 'G', faltantesG)
	s = tmp3.replace('?', 'T', faltantesT)
	while s.count('?') != 0:
		tmp1 = s.replace('?', 'A', 1)
		tmp2 = tmp1.replace('?', 'C', 1)
		tmp3 = tmp2.replace('?', 'G', 1)
		s = tmp3.replace('?', 'T', 1)
	if s.count('A') != s.count('C') or s.count('A') != s.count('G') or s.count('A') != s.count('T'):
		return '==='
	return s
n = int(input())
s = input()
print(decoding(s))


def MG(n, s):
	if n % 4 != 0:
		return '==='
	else:
		v = n / 4
		l = [v] * 4
		r = ''
		for i in range(n):
			if s[i] == 'A':
				l[0] -= 1
			elif s[i] == 'G':
				l[1] -= 1
			elif s[i] == 'C':
				l[2] -= 1
			elif s[i] == 'T':
				l[3] -= 1
		if l[0] < 0 or l[1] < 0 or l[2] < 0 or (l[3] < 0):
			return '==='
		g = ['A', 'G', 'C', 'T']
		for i in range(n):
			if s[i] != '?':
				r += s[i]
			else:
				for j in range(4):
					if l[j] != 0:
						r += g[j]
						l[j] -= 1
						break
	return r
(n, s) = (int(input()), input())
print(MG(n, s))


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)


input()
a = input()
(b, c) = ('ACGT?', [0] * 5)
for i in a:
	c[b.index(i)] += 1
for i in range(c.pop()):
	a = a.replace('?', b[c.index(min(c))], 1)
	c[c.index(min(c))] += 1
print([a, '==='][len(set(c)) != 1])


n = int(input())
l = list(input())
temp = ['A', 'C', 'G', 'T']
if n % 4 == 0:
	d = {}
	(d['A'], d['C'], d['G'], d['T'], c) = (0, 0, 0, 0, 0)
	for i in l:
		if i == '?':
			c += 1
		else:
			d[i] += 1
	if c == n:
		k = 0
		for i in range(len(l)):
			l[i] = temp[k]
			k = (k + 1) % 4
		print(''.join(l))
	else:
		k = n // 4
		for i in range(0, len(l)):
			if l[i] == '?':
				if d['A'] < k:
					l[i] = 'A'
					d['A'] += 1
				elif d['C'] < k:
					l[i] = 'C'
					d['C'] += 1
				elif d['G'] < k:
					l[i] = 'G'
					d['G'] += 1
				elif d['T'] < k:
					l[i] = 'T'
					d['T'] += 1
		qu = 0
		for i in l:
			if i == '?':
				qu += 1
		if d['A'] == d['C'] == d['G'] == d['T'] == k and qu == 0:
			print(''.join(l))
		else:
			print('===')
else:
	print('===')


n = int(input())
genome = input()
nucleo_a = genome.count('A')
nucleo_t = genome.count('T')
nucleo_g = genome.count('G')
nucleo_c = genome.count('C')
unknown_nuclei = n - nucleo_a - nucleo_t - nucleo_g - nucleo_c
if unknown_nuclei == 0:
	if nucleo_a == nucleo_t and nucleo_t == nucleo_g and (nucleo_g == nucleo_c):
		print(genome)
	else:
		print('===')
elif n % 4 == 0 and nucleo_c <= n // 4 and (nucleo_g <= n // 4) and (nucleo_a <= n // 4) and (nucleo_t <= n // 4):
	genome = genome.replace('?', 'A', n // 4 - nucleo_a)
	genome = genome.replace('?', 'T', n // 4 - nucleo_t)
	genome = genome.replace('?', 'C', n // 4 - nucleo_c)
	genome = genome.replace('?', 'G', n // 4 - nucleo_g)
	print(genome)
else:
	print('===')


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('===')


import sys
l = int(input())
s = input()
if l % 4 != 0:
	print('===')
	sys.exit()
d = {}
qm = 0
mx = int(l / 4)
mx_n = -float('inf')
qmi = []
sa = []
for (i, n) in enumerate(s):
	d.setdefault(n, 0)
	d[n] += 1
	sa.append(n)
	if n == '?':
		qm += 1
		qmi.append(i)
	else:
		mx_n = max(d[n], mx_n)
		if mx_n > mx:
			print('===')
			sys.exit()
if qm == 0:
	print(s)
else:
	for n in 'AGCT':
		if d.get(n) is None:
			d[n] = 0
		m = mx - d[n]
		for i in qmi[:m]:
			sa[i] = n
		qmi = qmi[m:]
	print(''.join(sa))


def index_of_first(lst, pred):
	for (i, v) in enumerate(lst):
		if pred(v):
			return i
	return None

def nuc_by_ind(nuc):
	if nuc == 0:
		return 'A'
	elif nuc == 1:
		return 'C'
	elif nuc == 2:
		return 'G'
	else:
		return 'T'
n = int(input())
s = list(input())
q = 0
acgt = [0] * 4
for i in range(n):
	if s[i] == '?':
		q += 1
	elif s[i] == 'A':
		acgt[0] += 1
	elif s[i] == 'C':
		acgt[1] += 1
	elif s[i] == 'G':
		acgt[2] += 1
	else:
		acgt[3] += 1
ma = max(acgt)
comp = [0] * 4
for i in range(4):
	comp[i] = ma - acgt[i]
compSum = sum(comp)
if compSum > q or (q - compSum) % 4 != 0:
	print('===')
else:
	for i in range(n):
		if s[i] == '?':
			nuc = index_of_first(comp, lambda x: x > 0)
			if nuc == None:
				break
			s[i] = nuc_by_ind(nuc)
			comp[nuc] -= 1
	k = 0
	for l in range(n):
		if s[l] == '?':
			s[l] = nuc_by_ind(k)
			k += 1
			if k == 4:
				k = 0
	print(''.join(s))


v = int(input())
s = input()
l = []
w = len(s) // 4
if len(s) % 4 != 0:
	print('===')
elif s.count('A') > w or s.count('G') > w or s.count('C') > w or (s.count('T') > w):
	print('===')
else:
	l.append((w - s.count('A')) * 'A')
	l.append((w - s.count('G')) * 'G')
	l.append((w - s.count('C')) * 'C')
	l.append((w - s.count('T')) * 'T')
	p = ''.join(l)
	s = list(s)
	k = 0
	for j in range(len(s)):
		if s[j] == '?':
			s[j] = p[k]
			k = k + 1
	print(''.join(s))


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='')


def sol(n, s):
	letters = ['A', 'G', 'C', 'T']
	if n % 4 != 0:
		return '==='
	else:
		dic = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
		for c in s:
			if c in letters:
				dic[c] += 1
				if dic[c] > n / 4:
					return '==='
		for i in range(len(s)):
			if s[i] == '?':
				for v in letters:
					if dic[v] < n / 4:
						s = s[:i] + v + s[i + 1:]
						dic[v] += 1
						break
		return s
n = int(input())
s = input()
print(sol(n, s))


import sys
from collections import Counter

def genome(s):
	ls = list(s)
	if len(s) % 4 != 0:
		return '==='
	dic = {'A': 0, 'G': 1, 'C': 2, 'T': 3, '?': 4}
	count = 5 * [0]
	for x in ls:
		count[dic[x]] += 1
	if max(count[0:4]) * 4 > len(s):
		return '==='
	expected = len(ls) // 4
	n = 0
	for c in ['A', 'G', 'C', 'T']:
		i = expected - count[dic[c]]
		while i > 0:
			while ls[n] != '?':
				n += 1
			ls[n] = c
			i -= 1
	result = ''.join(ls)
	return result
(c, d) = sys.stdin.read().strip().split()
print(str(genome(d)))


import os
from math import *
from bisect import *
n = int(input())
s = input()
if n % 4 == 0:
	(a, t, c, g) = [0] * 4
	ns = s
	ns = sorted(ns)
	a = bisect_right(ns, 'A') - bisect_left(ns, 'A')
	t = bisect_right(ns, 'T') - bisect_left(ns, 'T')
	c = bisect_right(ns, 'C') - bisect_left(ns, 'C')
	g = bisect_right(ns, 'G') - bisect_left(ns, 'G')
	y = [a, t, c, g]
	check = 0
	for i in range(4):
		y[i] = n // 4 - y[i]
		if y[i] < 0:
			check = 1
			break
	if check == 1:
		print('===')
	else:
		z = ['A', 'T', 'C', 'G']
		for x in s:
			if x == '?':
				for i in range(4):
					if y[i] > 0:
						print(z[i], end='')
						y[i] -= 1
						break
			else:
				print(x, end='')
else:
	print('===')


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)


f = int(input())
t = list(input())
if f % 4 != 0:
	print('===')
else:
	a = t.count('A')
	y = t.count('T')
	c = t.count('C')
	g = t.count('G')
	b = t.count('?')
	v = f // 4
	if max(a, y, c, g) <= v:
		for j in range(v - a):
			t[t.index('?')] = 'A'
		for j in range(v - y):
			t[t.index('?')] = 'T'
		for j in range(v - c):
			t[t.index('?')] = 'C'
		for j in range(v - g):
			t[t.index('?')] = 'G'
		print(''.join(t))
	else:
		print('===')


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)


def sol():
	n = int(input())
	if n % 4 != 0:
		return '==='
	S = input()
	if '?' not in S:
		if len(set(S)) == 4:
			return S
		else:
			return '==='
	(tmp, tmpn) = ('AGCT', n // 4)
	l = [S.count(i) for i in tmp]
	if tmpn < max(l):
		return '==='
	S = S.replace('?', 'A', tmpn - l[0])
	S = S.replace('?', 'G', tmpn - l[1])
	S = S.replace('?', 'C', tmpn - l[2])
	S = S.replace('?', 'T', tmpn - l[-1])
	return S
print(sol())


def Count(string, number):
	number //= 4
	lists = list(string)
	a = number - lists.count('A')
	c = number - lists.count('C')
	g = number - lists.count('G')
	t = number - lists.count('T')
	return [a, c, g, t]

def Check(string, number):
	if not number % 4 == 0:
		return False
	lists = Count(string, number)
	for i in lists:
		if i < 0:
			return False
	return True

def Lacks(string, number):
	num = Count(string, number)
	lists = [['A'], ['C'], ['G'], ['T']]
	lacklist = []
	for (m, n) in zip(num, lists):
		lacklist += m * n
	return lacklist

def Answer(string, number):
	string = list(string)
	lack = Lacks(string, number)
	length = -1
	for i in string:
		length += 1
		if i == '?':
			string[length] = lack.pop()
	return ''.join(string)
while True:
	try:
		number = int(input())
		string = input()
		if not Check(string, number):
			print('===')
		else:
			print(Answer(string, number))
	except EOFError:
		break


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())
if n % 4 != 0:
	print('===')
else:
	t = input()
	if 'A' in t:
		A = t.count('A')
	else:
		A = 0
	if 'C' in t:
		C = t.count('C')
	else:
		C = 0
	if 'T' in t:
		T = t.count('T')
	else:
		T = 0
	if 'G' in t:
		G = t.count('G')
	else:
		G = 0
	d = {'A': A, 'C': C, 'T': T, 'G': G}
	for i in d:
		if d[i] > n // 4:
			print('===')
			exit()
	while True:
		flag = 0
		for i in d:
			if d[i] == n // 4:
				pass
			else:
				flag = 1
				break
		if flag == 0:
			break
		else:
			k = t.index('?')
			for i in d:
				if d[i] < n // 4:
					d[i] = d[i] + 1
					break
			t = t[:k] + i + t[k + 1:]
	print(t)


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())
s = input()
a = c = g = t = q = 0
for i in s:
	if i == 'A':
		a += 1
	if i == 'C':
		c += 1
	if i == 'G':
		g += 1
	if i == 'T':
		t += 1
	if i == '?':
		q += 1
tmp = max(a, c, g, t)
sum = tmp * 4 - a - c - g - t
if a == 0 and c == 0 and (g == 0) and (t == 0):
	if n % 4 == 0:
		print('ACGT' * (q // 4))
	else:
		print('===')
elif q < sum:
	print('===')
elif q == sum:
	a = tmp - a
	c = tmp - c
	g = tmp - g
	t = tmp - t
	for i in s:
		if 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(i, end='')
elif q > sum:
	a = tmp - a + (q - sum) // 4
	c = tmp - c + (q - sum) // 4
	g = tmp - g + (q - sum) // 4
	t = tmp - t + (q - sum) // 4
	if (q - sum) % 4 != 0:
		print('===')
	else:
		for i in s:
			if 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(i, end='')


n = int(input())
a = input()
A = n // 4
G = A
C = A
T = A
if n % 4 != 0:
	print('===')
else:
	for i in range(n):
		if a[i] == 'A':
			A -= 1
		elif a[i] == 'G':
			G -= 1
		elif a[i] == 'C':
			C -= 1
		elif a[i] == 'T':
			T -= 1
	if A < 0 or G < 0 or C < 0 or (T < 0):
		print('===')
	else:
		a = list(a)
		for i in range(n):
			if a[i] == '?':
				if A > 0:
					a[i] = 'A'
					A -= 1
				elif G > 0:
					a[i] = 'G'
					G -= 1
				elif C > 0:
					a[i] = 'C'
					C -= 1
				elif T > 0:
					a[i] = 'T'
					T -= 1
		res = ''
		res = res.join(a)
		print(res)


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))


n = int(input())
adn = list(input())
a = adn.count('A')
g = adn.count('G')
c = adn.count('C')
t = adn.count('T')
unk = n - a - g - c - t
high = max(a, g, c, t)
a = high - a
g = high - g
c = high - c
t = high - t
suma = a + g + c + t
if suma > unk:
	print('===')
elif suma < unk and (unk - suma) % 4 != 0:
	print('===')
elif (unk - suma) % 4 == 0:
	r = (unk - suma) // 4
	a = a + r
	g = g + r
	c = c + r
	t = t + r
	for i in range(n):
		if adn[i] == '?':
			if a > 0:
				adn[i] = 'A'
				a = a - 1
			elif g > 0:
				adn[i] = 'G'
				g = g - 1
			elif c > 0:
				adn[i] = 'C'
				c = c - 1
			elif t > 0:
				adn[i] = 'T'
				t = t - 1
	print(''.join(map(str, adn)))


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()


n = int(input())
a = input()
if n % 4 == 0:
	l = [a.count('A'), a.count('G'), a.count('C'), a.count('T')]
	m = max(l)
	if m * 4 <= n:
		if '?' in a:
			t = n // 4
			c1 = t - a.count('A')
			c2 = t - a.count('G')
			c3 = t - a.count('C')
			c4 = t - a.count('T')
			for i in a:
				if i == '?' and c1 > 0:
					a = a.replace('?', 'A', 1)
					c1 = c1 - 1
				elif i == '?' and c2 > 0:
					a = a.replace('?', 'G', 1)
					c2 = c2 - 1
				elif i == '?' and c3 > 0:
					a = a.replace('?', 'C', 1)
					c3 = c3 - 1
				elif i == '?' and c4 > 0:
					a = a.replace('?', 'T', 1)
					c4 = c4 - 1
			else:
				print(a)
		else:
			print(a)
	else:
		print('===')
else:
	print('===')


n = int(input())
s = input()
d = len(s) // 4
if len(s) % 4 != 0:
	print('===', end='')
elif s.count('A') > d or s.count('G') > d or s.count('C') > d or (s.count('T') > d):
	print('===', end='')
else:
	if s.count('A') != d:
		f = d - s.count('A')
		s = s.replace('?', 'A', f)
	if s.count('G') != d:
		a = d - s.count('G')
		s = s.replace('?', 'G', a)
	if s.count('C') != d:
		v = d - s.count('C')
		s = s.replace('?', 'C', v)
	if s.count('T') != d:
		b = d - s.count('T')
		s = s.replace('?', 'T', b)
	print(s, end='')


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()
d = {'A': 0, 'G': 0, 'C': 0, 'T': 0, '?': 0}
for c in s:
	d[c] += 1
m = max(d['A'], d['G'], d['C'], d['T'])
q = d['?']
if d['A'] == m:
	maxi = 'A'
elif d['G'] == m:
	maxi = 'G'
if d['C'] == m:
	maxi = 'C'
if d['T'] == m:
	maxi = 'T'
a = [0 for i in range(4)]
a[0] = m - d['A']
a[1] = m - d['G']
a[2] = m - d['C']
a[3] = m - d['T']
xx = 'AGCT'
if q < sum(a):
	print('===')
	exit()
ss = ['x' for i in range(n)]
j = 0
for i in range(n):
	if s[i] != '?':
		ss[i] = s[i]
		continue
	if a[0] > 0:
		ss[i] = 'A'
		a[0] -= 1
		continue
	if a[1] > 0:
		ss[i] = 'G'
		a[1] -= 1
		continue
	if a[2] > 0:
		ss[i] = 'C'
		a[2] -= 1
		continue
	if a[3] > 0:
		ss[i] = 'T'
		a[3] -= 1
		continue
	ss[i] = xx[j]
	j = (j + 1) % 4
	a[j] -= 1
if max(a) != min(a):
	print('===')
	exit()
print(''.join(ss))


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()
ans = ''
chk = [0] * 4
for i in s:
	if i == 'A':
		chk[0] += 1
	elif i == 'C':
		chk[1] += 1
	elif i == 'G':
		chk[2] += 1
	elif i == 'T':
		chk[3] += 1
for i in s:
	if i != '?':
		ans += i
	elif min(chk) == chk[0]:
		ans += 'A'
		chk[0] += 1
	elif min(chk) == chk[1]:
		ans += 'C'
		chk[1] += 1
	elif min(chk) == chk[2]:
		ans += 'G'
		chk[2] += 1
	else:
		ans += 'T'
		chk[3] += 1
print(ans if len(set(chk)) == 1 else '===')


n = int(input())
tar = n // 4
ls = ('A', 'G', 'T', 'C')
st = list(input())
count = [0, 0, 0, 0]
j = 0
for i in range(0, n):
	if st[i] == 'A':
		count[0] += 1
	if st[i] == 'G':
		count[1] += 1
	if st[i] == 'T':
		count[2] += 1
	if st[i] == 'C':
		count[3] += 1
if n % 4:
	print('===')
elif count[0] > n // 4 or count[1] > n // 4 or count[2] > n // 4 or (count[3] > n // 4):
	print('===')
else:
	for i in range(0, n):
		if st[i] == '?':
			while count[j] == n // 4:
				j += 1
			st[i] = ls[j]
			count[j] += 1
	ans = ''.join(map(str, st))
	print(ans)


n = int(input())
w = input()
lists = list(w)
a = 0
c = 0
g = 0
t = 0
for x in lists:
	if x == 'A':
		a += 1
	elif x == 'C':
		c += 1
	elif x == 'G':
		g += 1
	elif x == 'T':
		t += 1
for i in range(n):
	if lists[i] == '?':
		temp = min(a, c, g, t)
		if temp == a:
			lists[i] = 'A'
			a += 1
		elif temp == c:
			lists[i] = 'C'
			c += 1
		elif temp == g:
			lists[i] = 'G'
			g += 1
		elif temp == t:
			lists[i] = 'T'
			t += 1
if a == c == g == t:
	for x in lists:
		print(x, end='')
else:
	print('===')


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())
s = list(input())
a = s.count('A')
g = s.count('G')
c = s.count('C')
t = s.count('T')
d = s.count('?')
m = 4 * max(a, g, t, c) - a - g - c - t
if d < m or (d - m) % 4 != 0:
	print('===')
else:
	q = len(s) // 4
	for i in range(0, len(s)):
		if s[i] == '?':
			if a < q:
				s[i] = 'A'
				a += 1
			elif g < q:
				s[i] = 'G'
				g += 1
			elif c < q:
				s[i] = 'C'
				c += 1
			else:
				s[i] = 'T'
				t += 1
	print(*s, sep='')


n = int(input())
s = list(input())
l = [0 for x in range(4)]
q = 0
for i in range(n):
	if s[i] == 'A':
		l[0] += 1
	elif s[i] == 'C':
		l[1] += 1
	elif s[i] == 'G':
		l[2] += 1
	elif s[i] == 'T':
		l[3] += 1
	else:
		q += 1
_l = []
_l.append([l[0], 'A'])
_l.append([l[1], 'C'])
_l.append([l[2], 'G'])
_l.append([l[3], 'T'])
_l.sort()
tba = []
for i in range(3):
	for j in range(_l[3][0] - _l[i][0]):
		tba.append(_l[i][1])
if q < len(tba) or (q - len(tba)) % 4 != 0:
	print('===')
	exit(0)
if q - len(tba) != 0:
	for i in range((q - len(tba)) // 4):
		tba.append('A')
		tba.append('C')
		tba.append('G')
		tba.append('T')
i = 0
for j in range(n):
	if s[j] == '?':
		s[j] = tba[i]
		i += 1
_s = ''
for i in s:
	_s += i
print(_s)


n = int(input())
s = list(input())
target = n / 4
if target != int(target):
	print('===')
else:
	As = s.count('A')
	Bs = s.count('T')
	Cs = s.count('C')
	Ds = s.count('G')
	table = [[As, 'A'], [Bs, 'T'], [Cs, 'C'], [Ds, 'G']]
	table.sort(reverse=True)
	while '?' in s and len(table):
		if len(table) and table[-1][0] == target:
			table.pop()
		else:
			s[s.index('?')] = table[-1][1]
			table[-1][0] += 1
	if s.count('A') != target or s.count('T') != target or s.count('G') != target or (s.count('C') != target):
		print('===')
	else:
		print(''.join(s))


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))


n = int(input())
l = list(input())
a = l.count('A')
c = l.count('C')
g = l.count('G')
t = l.count('T')
ma = max(a, g, c, t)
for i in range(n):
	if l[i] == '?':
		if a < ma:
			l[i] = 'A'
			a += 1
		elif c < ma:
			l[i] = 'C'
			c += 1
		elif g < ma:
			l[i] = 'G'
			g += 1
		elif t < ma:
			l[i] = 'T'
			t += 1
		else:
			l[i] = 'T'
			t += 1
			ma += 1
if a < ma or c < ma or g < ma or (t < ma):
	print('===')
else:
	print(''.join(l))


n = int(input())
s = input()
if n % 4 != 0:
	print('===')
else:
	d = {'A': 0, 'G': 0, 'C': 0, 'T': 0}
	for value in s:
		if value != '?':
			d[value] = d[value] + 1
	maxv = max(d.values())
	if maxv == 0:
		print('A' * (n // 4) + 'G' * (n // 4) + 'C' * (n // 4) + 'T' * (n // 4))
	else:
		for key in d:
			if d[key] <= n // 4:
				d[key] = n // 4 - d[key]
			else:
				print('===')
				exit(0)
		for i in range(n):
			if s[i] == '?':
				for key in d:
					if d[key]:
						d[key] = d[key] - 1
						print(key, end='')
						break
			else:
				print(s[i], end='')


length = int(input())
code = input()
fail = False
if length % 4 != 0:
	fail = True
a_count = code.count('A')
c_count = code.count('C')
g_count = code.count('G')
t_count = code.count('T')
each_num = length // 4
if a_count > each_num or c_count > each_num or g_count > each_num or (t_count > each_num):
	fail = True
remain_a = each_num - a_count
remain_g = each_num - g_count
remain_c = each_num - c_count
remain_t = each_num - t_count
code = code.replace('?', 'A', remain_a)
code = code.replace('?', 'G', remain_g)
code = code.replace('?', 'C', remain_c)
code = code.replace('?', 'T', remain_t)
if fail:
	print('===')
else:
	print(code)


def main():
	try:
		while True:
			n = int(input())
			s = input()
			a = s.count('A')
			c = s.count('C')
			g = s.count('G')
			t = s.count('T')
			q = s.count('?')
			m = max(a, c, g, t)
			if (m << 2) - a - c - g - t > q:
				print('===')
			else:
				s = s.replace('?', 'A', m - a)
				s = s.replace('?', 'C', m - c)
				s = s.replace('?', 'G', m - g)
				s = s.replace('?', 'T', m - t)
				assert s.count('A') == s.count('C') == s.count('G') == s.count('T')
				q = s.count('?')
				if q & 3:
					print('===')
				else:
					for i in range(q >> 2):
						s = s.replace('?', 'A', 1)
						s = s.replace('?', 'C', 1)
						s = s.replace('?', 'G', 1)
						s = s.replace('?', 'T', 1)
					print(s)
	except EOFError:
		pass
main()


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()


def decode(s):
	if '?' not in s:
		d = {'A': 0, 'G': 0, 'C': 0, 'T': 0}
		for x in s:
			d[x] += 1
		if len(set(list(d.values()))) == 1:
			return s
		else:
			return '==='
	else:
		d = {'A': 0, 'G': 0, 'C': 0, 'T': 0, '?': 0}
		for x in s:
			d[x] += 1
		m = max(list(d.values())[:-1])
		q = list(d.values())[-1]
		c = 0
		del d['?']
		for y in d.values():
			c += m - y
		if q < c:
			return '==='
		elif (q - c) % 4 != 0:
			return '==='
		else:
			rem = (q - c) // 4
			for (a, b) in d.items():
				n = m - b + rem
				s = s.replace('?', a, n)
			return s
w = int(input())
s = input()
print(decode(s))


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='')


n = int(input())
chracters = list(input())
if n % 4 != 0:
	print('===')
else:
	gen = {'A': chracters.count('A'), 'C': chracters.count('C'), 'G': chracters.count('G'), 'T': chracters.count('T')}
	m = max(gen['A'], gen['C'], gen['G'], gen['T'])
	for i in range(n):
		if chracters[i] == '?':
			if gen['A'] < m:
				chracters[i] = 'A'
				gen['A'] += 1
			elif gen['C'] < m:
				chracters[i] = 'C'
				gen['C'] += 1
			elif gen['G'] < m:
				chracters[i] = 'G'
				gen['G'] += 1
			elif gen['T'] < m:
				chracters[i] = 'T'
				gen['T'] += 1
			else:
				chracters[i] = 'A'
				gen['A'] += 1
				m += 1
	print('===' if gen['A'] < m or gen['C'] < m or gen['G'] < m or (gen['T'] < m) else ''.join(chracters))


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('===')


length = int(input())
str = input()
if length % 4 != 0:
	print('===')
else:
	dic = {'A': 0, 'G': 0, 'T': 0, 'C': 0, '?': 0}
	for let in str:
		dic[let] += 1
	count = dic['?']
	del dic['?']
	Max = max(list(dic.values()))
	while True:
		if count == 0:
			if dic['G'] == dic['A'] == dic['C'] == dic['T']:
				print(str)
			else:
				print('===')
			break
		elif min(list(dic.values())) != Max:
			for key in dic.keys():
				if dic[key] < Max:
					dic[key] += 1
					str = str.replace('?', key, 1)
					count -= 1
				if count == 0:
					break
		if count != 0 and dic['G'] == dic['A'] == dic['C'] == dic['T']:
			str = str.replace('?', 'A', 1)
			count -= 1
			dic['A'] += 1
			Max = max(list(dic.values()))


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('===')


import sys
nuc = 'ACGT'
count = {}
n = int(input())
dna = list(input())
for c in nuc:
	count[c] = dna.count(c)
for i in range(n):
	if dna[i] == '?':
		min_k = 'A'
		min_v = 100000
		for (k, v) in count.items():
			if v < min_v:
				min_k = k
				min_v = v
		dna[i] = min_k
		count[min_k] += 1
for (a, b) in zip(list(count.values()), list(count.values())[1:]):
	if a != b:
		print('===')
		sys.exit(0)
print(''.join(dna))


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())
l = list(input())
if n % 4 != 0:
	print('===')
	exit()
co = n // 4
st = ['A', 'C', 'T', 'G']
for i in st:
	if l.count(i) > co:
		print('===')
		exit()
target = 0
i = 0
while i < n:
	if l[i] == '?':
		if l.count(st[target]) < co:
			l[i] = st[target]
			i += 1
		else:
			target += 1
	else:
		i += 1
print(*l, sep='')


def main():
	(n, l) = (int(input()), list(input()))
	if n % 4:
		print('===')
		return
	cnt = dict.fromkeys('ACGT?', n // 4)
	for c in l:
		cnt[c] -= 1
	del cnt['?']
	if min(cnt.values()) < 0:
		print('===')
		return
	(v, cnt) = (0, list(cnt.items()))
	for (i, a) in enumerate(l):
		if a == '?':
			while not v:
				(c, v) = cnt.pop()
			l[i] = c
			v -= 1
	print(''.join(l))
main()


n = int(input())
s = input()
l = list(s)
qc = l.count('?')
ac = l.count('A')
gc = l.count('G')
tc = l.count('T')
cc = l.count('C')
if n % 4 != 0:
	print('===')
elif qc == 0 and ac == gc and (gc == tc) and (tc == cc):
	print(s)
else:
	val = n // 4
	if ac > val or gc > val or tc > val or (cc > val):
		print('===')
	else:
		a_rep = val - ac
		g_rep = val - gc
		t_rep = val - tc
		c_rep = val - cc
		res = ''
		for i in range(n):
			if l[i] == '?':
				if a_rep > 0:
					res += 'A'
					a_rep -= 1
				elif g_rep > 0:
					res += 'G'
					g_rep -= 1
				elif t_rep > 0:
					res += 'T'
					t_rep -= 1
				elif c_rep > 0:
					res += 'C'
					c_rep -= 1
			else:
				res += l[i]
		print(res)


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 collections import *
n = int(input())
s = list(input())
x = ['A', 'C', 'G', 'T']
y = [s.count('A'), s.count('C'), s.count('G'), s.count('T')]
for i in range(n):
	if s[i] == '?':
		m = 10000000
		c = 'A'
		z = 0
		for j in range(4):
			if y[j] < m:
				c = x[j]
				m = y[j]
				z = j
		s[i] = c
		y[z] += 1
l = ''.join(s)
ll = len(set(y))
if ll == 1:
	print(l)
else:
	print('===')


n = int(input())
s = input()
max_g = max(s.count('A'), s.count('C'), s.count('G'), s.count('T'))
if max_g * 4 > n or n % 4:
	print('===')
else:
	s = s.replace('?', 'A', max_g - s.count('A'))
	s = s.replace('?', 'C', max_g - s.count('C'))
	s = s.replace('?', 'G', max_g - s.count('G'))
	s = s.replace('?', 'T', max_g - s.count('T'))
	if '?' in s:
		for _ in range(s.count('?') // 4):
			s = s.replace('?', 'A', 1)
			s = s.replace('?', 'C', 1)
			s = s.replace('?', 'G', 1)
			s = s.replace('?', 'T', 1)
	print(s)


from sys import exit
validChars = ['A', 'G', 'C', 'T']
freq = {}
length = int(input())
genome = list(input())
if length % 4 != 0:
	print('===')
	exit()
for c in validChars:
	freq[c] = 0
for c in genome:
	if c in validChars:
		freq[c] = freq[c] + 1
for c in validChars:
	if freq[c] > length // 4:
		print('===')
		exit()
for i in range(0, length):
	if genome[i] == '?':
		filled = False
		for c in validChars:
			if not filled and freq[c] < length // 4:
				filled = True
				genome[i] = c
				freq[c] = freq[c] + 1
print(''.join(genome))


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('===')


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

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

def mp():
	return map(int, stdin.readline().split())

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

def pr(n):
	return stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	s = st()
	if n % 4:
		pr('===')
		return
	d = Counter(s)
	a = n // 4
	for i in d:
		if i != '?':
			if d[i] > a:
				pr('===')
				return
	A = a - d['A']
	C = a - d['C']
	G = a - d['G']
	T = a - d['T']
	for i in range(n):
		if s[i] == '?':
			if A:
				s[i] = 'A'
				A -= 1
			elif T:
				s[i] = 'T'
				T -= 1
			elif G:
				s[i] = 'G'
				G -= 1
			elif C:
				s[i] = 'C'
				C -= 1
	print(''.join(s))
for _ in range(1):
	solve()


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())


def function(arr):
	pos = []
	nucleotides = ['A', 'G', 'C', 'T']
	freq = {'A': 0, 'G': 0, 'C': 0, 'T': 0}
	if len(arr) % 4 == 0:
		most_frequent = int(len(arr) / 4)
	else:
		return '==='
	for i in range(len(arr)):
		if arr[i] in freq:
			freq[arr[i]] += 1
		else:
			pos.append(i)
	j = 0
	for i in range(len(nucleotides)):
		while freq[nucleotides[i]] < most_frequent:
			if j < len(pos):
				arr[pos[j]] = nucleotides[i]
				j += 1
				freq[nucleotides[i]] += 1
			else:
				return '==='
	if j == len(pos):
		return ''.join(arr)
	else:
		return '==='
int(input())
arr = list(input())
print(function(arr))


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)


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


l = int(input())
dna = input()
(a, t, c, g, q) = (0, 0, 0, 0, 0)
for i in dna:
	if i == 'A':
		a += 1
	elif i == 'T':
		t += 1
	elif i == 'C':
		c += 1
	elif i == 'G':
		g += 1
	else:
		q += 1
(aa, at, ac, ag) = (0, 0, 0, 0)
m = max(a, t, c, g)
x = m - a + m - t + m - c + m - g
if x > q or (q - x) % 4 != 0:
	print('===')
else:
	aa = m - a + (q - x) // 4
	at = m - t + (q - x) // 4
	ac = m - c + (q - x) // 4
	ag = m - c + (q - x) // 4
	for i in dna:
		if i != '?':
			print(i, end='')
		elif aa:
			print('A', end='')
			aa -= 1
		elif at:
			print('T', end='')
			at -= 1
		elif ac:
			print('C', end='')
			ac -= 1
		else:
			print('G', end='')
			ag -= 1


n = int(input())
l1 = []
l2 = []
l3 = []
f = 0
l1 = list(input())
l2.append('A')
l2.append('G')
l2.append('T')
l2.append('C')
l2.append('?')
l3.append(l1.count('A'))
l3.append(l1.count('G'))
l3.append(l1.count('T'))
l3.append(l1.count('C'))
c = max(l3)
l3.append(l1.count('?'))
for i in range(0, 5):
	for j in range(0, n):
		if l3[i] != n / 4:
			if l1[j] == '?':
				l1[j] = l2[i]
				l3[i] = l3[i] + 1
				l3[4] = l3[4] - 1
for p in range(0, 4):
	if l3[p] != n / 4 or l3[4] != 0:
		f = 1
if f == 1:
	print('===')
else:
	for z in range(0, n):
		print(l1[z], end='')


n = int(input())
s = input()
if n % 4:
	print('===')
else:
	m = n // 4
	(q, a, g, c, t) = [s.count(x) for x in '?AGCT']
	for (x, y) in zip('AGCT', [a, g, c, t]):
		s = s.replace('?', x, m - y)
	print(s if s.count('A') == s.count('G') == s.count('C') == s.count('T') else '===')


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))


import re

def main():
	n = int(input())
	if n % 4 != 0:
		print('===')
		return
	t = re.findall('.', input())
	A = B = C = D = E = 0
	for i in t:
		if i == 'A':
			A += 1
		elif i == 'G':
			B += 1
		elif i == 'C':
			C += 1
		elif i == 'T':
			D += 1
		else:
			E += 1
	j = n // 4
	if A > j or B > j or C > j or (D > j):
		print('===')
		return
	else:
		for i in range(len(t)):
			if t[i] == '?':
				if A != j:
					t[i] = 'A'
					A += 1
				elif B != j:
					t[i] = 'G'
					B += 1
				elif C != j:
					t[i] = 'C'
					C += 1
				elif D != j:
					t[i] = 'T'
					D += 1
		print(''.join(t))
main()


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)


def check(string):
	dic = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
	for i in range(len(string)):
		if string[i] in dic:
			dic[string[i]] += 1
	if dic['A'] == dic['C'] and dic['A'] == dic['G'] and (dic['A'] == dic['T']):
		return False
	else:
		return True

def genome():
	length = int(input())
	string = input()
	dic = {'A': 0, 'C': 0, 'G': 0, 'T': 0, '?': 0}
	for i in range(len(string)):
		if string[i] in dic:
			dic[string[i]] += 1
	if dic['A'] == dic['C'] and dic['A'] == dic['G'] and (dic['A'] == dic['T']) and (dic['?'] == 0):
		if dic['A'] != 0:
			return string
	need = []
	maximum = dic['A']
	add_one = False
	if dic['C'] > maximum:
		maximum = dic['C']
	if dic['G'] > maximum:
		maximum = dic['G']
	if dic['T'] > maximum:
		maximum = dic['T']
	if dic['A'] == 0 and dic['C'] == 0 and (dic['G'] == 0) and (dic['T'] == 0):
		maximum = 1
		add_one = True
	if add_one:
		need = ['A', 'C', 'G', 'T']
	else:
		while dic['A'] != dic['C'] or dic['A'] != dic['G'] or dic['A'] != dic['T']:
			if dic['A'] < maximum:
				need.append('A')
				dic['A'] += 1
			if dic['C'] < maximum:
				need.append('C')
				dic['C'] += 1
			if dic['G'] < maximum:
				need.append('G')
				dic['G'] += 1
			if dic['T'] < maximum:
				need.append('T')
				dic['T'] += 1
	if (len(string) - (dic['A'] + dic['C'] + dic['G'] + dic['T'])) % 4 != 0:
		return '==='
	out = ['A', 'C', 'G', 'T']
	string = [string[i] for i in range(len(string))]
	for i in range(len(string)):
		if string[i] == '?':
			if len(need) == 0:
				need = out.copy()
			string[i] = need[0]
			need.pop(0)
	if check(string) or len(need) > 0:
		return '==='
	output = ''
	for i in range(len(string)):
		output = output + string[i]
	return output
A = genome()
print(A)