A string is called beautiful if no two consecutive characters are equal. For example, "ababcb", "a" and "abab" are beautiful strings, while "aaaaaa", "abaa" and "bb" are not.

Ahcl wants to construct a beautiful string. He has a string $s$, consisting of only characters 'a', 'b', 'c' and '?'. Ahcl needs to replace each character '?' with one of the three characters 'a', 'b' or 'c', such that the resulting string is beautiful. Please help him!

More formally, after replacing all characters '?', the condition $s_i \neq s_{i+1}$ should be satisfied for all $1 \leq i \leq |s| - 1$, where $|s|$ is the length of the string $s$.


-----Input-----

The first line contains positive integer $t$ ($1 \leq t \leq 1000$) — the number of test cases. Next $t$ lines contain the descriptions of test cases.

Each line contains a non-empty string $s$ consisting of only characters 'a', 'b', 'c' and '?'. 

It is guaranteed that in each test case a string $s$ has at least one character '?'. The sum of lengths of strings $s$ in all test cases does not exceed $10^5$.


-----Output-----

For each test case given in the input print the answer in the following format:

  If it is impossible to create a beautiful string, print "-1" (without quotes);  Otherwise, print the resulting beautiful string after replacing all '?' characters. If there are multiple answers, you can print any of them. 


-----Example-----
Input
3
a???cb
a??bbc
a?b?c

Output
ababcb
-1
acbac



-----Note-----

In the first test case, all possible correct answers are "ababcb", "abcacb", "abcbcb", "acabcb" and "acbacb". The two answers "abcbab" and "abaabc" are incorrect, because you can replace only '?' characters and the resulting string must be beautiful.

In the second test case, it is impossible to create a beautiful string, because the $4$-th and $5$-th characters will be always equal.

In the third test case, the only answer is "acbac".

Difficulty: EASY

Solutions:
import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	a = insr()
	qw = []
	q = 0
	for i in range(len(a)):
		if i < len(a) - 1:
			w = a[i + 1]
		else:
			w = 0
		if a[i] == '?':
			for j in ['a', 'b', 'c']:
				if j != w and j != q:
					qw.append(j)
					q = j
					break
		else:
			if a[i] == w:
				print(-1)
				break
			qw.append(a[i])
			q = a[i]
	else:
		print(''.join(qw))


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7
INF = float('inf')

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

def inpl():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(inp()):
	s = sys.stdin.readline()
	s = s[:len(s) - 1]
	n = len(s)
	f = True
	for i in range(n - 1):
		if s[i] != '?' and s[i] == s[i + 1]:
			f = False
			break
	if not f:
		print(-1)
		continue
	res = [-1] * n
	for (i, x) in enumerate(s):
		if x != '?':
			res[i] = x
			continue
		ss = set()
		if i:
			ss.add(res[i - 1])
		if i != n - 1 and s[i + 1] != '?':
			ss.add(s[i + 1])
		for y in ['a', 'b', 'c']:
			if not y in ss:
				res[i] = y
				break
	print(''.join(res))


def main():
	n = int(input())
	for x in range(n):
		s = list(input())
		ns = ''
		doublon = False
		for x in range(1, len(s)):
			if s[x - 1] == s[x] and s[x] != '?':
				print(-1)
				doublon = True
				break
		if doublon:
			continue
		for x in range(len(s)):
			if s[x] == '?':
				if x == 0:
					p = '-1'
				else:
					p = s[x - 1]
				if x >= len(s) - 1:
					n = '-1'
				else:
					n = s[x + 1]
				if p != 'a' and n != 'a':
					s[x] = 'a'
				elif p != 'b' and n != 'b':
					s[x] = 'b'
				elif p != 'c' and n != 'c':
					s[x] = 'c'
		print(''.join((x for x in s)))
main()


T = int(input())
for xxxx in range(T):
	s = [c for c in input()]
	lens = len(s)
	for i in range(lens):
		if s[i] == '?':
			prev = 'd' if i == 0 else s[i - 1]
			nxtv = 'e' if i == lens - 1 else s[i + 1]
			for x in ['a', 'b', 'c']:
				if x != prev and x != nxtv:
					s[i] = x
					break
	flag = False
	for i in range(lens - 1):
		if s[i] == s[i + 1]:
			flag = True
			break
	if flag:
		print(-1)
	else:
		print(''.join(s))


def get(s, i):
	return ' ' if i < 0 or i >= len(s) else s[i]

def subst(x, y):
	return next((v for v in 'abc' if v not in [x, y]))
t = int(input())
for _ in range(t):
	s = input()
	if any((u == v and u != '?' for (u, v) in zip(s, s[1:]))):
		print(-1)
	else:
		x = list(s)
		for (i, v) in enumerate(x):
			if v == '?':
				x[i] = subst(get(x, i - 1), get(x, i + 1))
		print(''.join(x))


for i in range(int(input())):
	s = [c for c in input()]
	ln = len(s)
	i = 0
	while i < ln:
		if s[i] == '?':
			if i == 0:
				p = None
			else:
				p = s[i - 1]
			if i + 1 >= ln:
				n = None
			else:
				n = s[i + 1]
			for x in ['a', 'b', 'c']:
				if x != p and x != n:
					s[i] = x
					break
		else:
			i += 1
	prov = True
	for i in range(ln - 1):
		if s[i] == s[i + 1]:
			print('-1')
			prov = False
			break
	if prov == True:
		print(''.join(s))


for i in range(int(input())):
	s = input()
	p = ''
	c = 0
	for j in range(len(s)):
		k = ['a', 'b', 'c']
		if s[j] == '?':
			if len(p) > 0 and p[j - 1] in k:
				k.remove(p[j - 1])
			if j < len(s) - 1 and s[j + 1] in k:
				k.remove(s[j + 1])
			p += k[0]
		elif j < len(s) - 1:
			if s[j] == s[j + 1]:
				c += 1
				break
			else:
				p += s[j]
		else:
			p += s[j]
	if c == 0:
		print(p)
	else:
		print('-1')


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	s = input().strip()
	n = len(s)
	f = 1
	for i in range(n - 1):
		if s[i] != '?':
			if s[i] == s[i + 1]:
				f = 0
				break
	if not f:
		print(-1)
		continue
	if n == 1:
		if s == '?':
			print('a')
		else:
			print(s)
		continue
	s = list(s)
	for i in range(n):
		if i == 0:
			if s[i] == '?':
				mset = ['a', 'b', 'c']
				if s[i + 1] in mset:
					mset.remove(s[i + 1])
				s[i] = mset[0]
		elif i == n - 1:
			if s[i] == '?':
				mset = ['a', 'b', 'c']
				if s[i - 1] in mset:
					mset.remove(s[i - 1])
				s[i] = mset[0]
		elif s[i] == '?':
			mset = ['a', 'b', 'c']
			if s[i + 1] in mset:
				mset.remove(s[i + 1])
			if s[i - 1] in mset:
				mset.remove(s[i - 1])
			s[i] = mset[0]
	s = ''.join(s)
	print(s)


t = int(input())
for _ in range(0, t):
	s = [i for i in input()]
	kk = True
	if len(s) == 1:
		if s[0] != '?':
			print(s[0])
		else:
			print('a')
	else:
		for i in range(0, len(s)):
			if s[i] == '?' and (i == 0 or i == len(s) - 1):
				k = ['a', 'b', 'c']
				if i == 0:
					if s[i + 1] != '?' and s[i + 1] in k:
						k.remove(s[i + 1])
					s[i] = k[0]
				else:
					if s[i - 1] != '?' and s[i - 1] in k:
						k.remove(s[i - 1])
					s[i] = k[0]
			elif s[i] == '?':
				k = ['a', 'b', 'c']
				if s[i - 1] != '?' and s[i - 1] in k:
					k.remove(s[i - 1])
				if s[i + 1] != '?' and s[i + 1] in k:
					k.remove(s[i + 1])
				s[i] = k[0]
			if i == 0 and s[i] == s[i + 1]:
				if s[i] == s[i + 1]:
					kk = False
					break
			elif i == len(s) - 1:
				if s[i - 1] == s[i]:
					kk = False
					break
			elif s[i] == s[i + 1]:
				kk = False
				break
		if kk:
			print(''.join(s))
		else:
			print(-1)


for _ in range(int(input())):
	s = list(input())
	if s == ['?']:
		print('a')
		continue
	if len(s) == 2 and s[0] == s[1] and (s[0] != '?'):
		print(-1)
		continue
	l1 = ['a', 'b', 'c']
	ans = 1
	if s[0] == '?':
		for i in l1:
			if i != s[1]:
				s[0] = i
				break
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			for j in l1:
				if j != s[i - 1] and j != s[i + 1]:
					s[i] = j
					break
		elif s[i] == s[i - 1] or s[i] == s[i + 1]:
			ans = -1
	if s[-1] == '?':
		for i in l1:
			if i != s[-2]:
				s[-1] = i
				break
	if ans == 1:
		print(''.join(s))
	else:
		print(ans)


t = int(input())
for j in range(t):
	s = input()
	fl = True
	st = ''
	for i in range(len(s) - 1):
		if i == 0:
			if len(s) == 1:
				if s == '?':
					st = 'a'
				else:
					st = s
			elif s[i] == '?':
				if s[i + 1] == '?':
					st += 'a'
				elif s[i + 1] == 'a':
					st += 'b'
				else:
					st += 'a'
			else:
				st += s[i]
		if s[i] == s[i + 1] and s[i] != '?':
			fl = False
			break
		elif i == 0:
			pass
		elif s[i] == '?':
			if i == 0:
				if i + 1 < len(s):
					if s[i + 1] == '?':
						st += 'a'
					elif s[i + 1] == 'a':
						st += 'b'
					elif s[i + 1] == 'b':
						st += 'a'
					else:
						st += 'a'
				else:
					st += 'a'
			elif i == len(s) - 1:
				if i > 0:
					if st[i - 1] == '?':
						st += 'a'
					elif st[i - 1] == 'a':
						st += 'b'
					elif st[i - 1] == 'b':
						st += 'a'
					else:
						st += 'a'
				else:
					st += 'a'
			elif s[i + 1] == '?':
				if st[i - 1] == '?':
					st += 'a'
				elif st[i - 1] == 'a':
					st += 'b'
				elif st[i - 1] == 'b':
					st += 'a'
				else:
					st += 'a'
			elif st[i - 1] == '?':
				if s[i + 1] == '?':
					st += 'a'
				elif s[i + 1] == 'a':
					st += 'b'
				elif s[i + 1] == 'b':
					st += 'a'
				else:
					st += 'a'
			else:
				if s[i + 1] == 'a':
					if st[i - 1] == 'b':
						st += 'c'
					else:
						st += 'b'
				if s[i + 1] == 'b':
					if st[i - 1] == 'a':
						st += 'c'
					else:
						st += 'a'
				if s[i + 1] == 'c':
					if st[i - 1] == 'a':
						st += 'b'
					else:
						st += 'a'
		else:
			st += s[i]
	if s[-1] == '?':
		if len(s) == 1:
			st = 'a'
		elif st[-1] == 'a':
			st += 'b'
		else:
			st += 'a'
	else:
		st += s[-1]
	if fl:
		print(st)
	else:
		print(-1)


t = int(input())
for _ in range(t):
	s = input()
	N = len(s)
	ans = [s[i] for i in range(N)]
	flg = 0
	for i in range(N):
		if ans[i] == '?':
			used = []
			if i > 0:
				used.append(ans[i - 1])
			if i + 1 < N:
				used.append(ans[i + 1])
			if 'a' not in used:
				ans[i] = 'a'
			elif 'b' not in used:
				ans[i] = 'b'
			else:
				ans[i] = 'c'
		else:
			if i > 0:
				if ans[i - 1] == ans[i]:
					print(-1)
					flg = 1
					break
			if i + 1 < N:
				if ans[i + 1] == ans[i]:
					print(-1)
					flg = 1
					break
	if not flg:
		print(''.join(ans))


k = int(input())
for t in range(k):
	a = input()
	if 'aa' in a or 'bb' in a or 'cc' in a:
		print(-1)
	else:
		a = list(a)
		a.insert(len(a), 'd')
		a.insert(0, 'd')
		for j in range(len(a)):
			if a[j] == '?':
				if a[j - 1] != 'a' and a[j + 1] != 'a':
					a[j] = 'a'
				elif a[j - 1] != 'b' and a[j + 1] != 'b':
					a[j] = 'b'
				elif a[j - 1] != 'c' and a[j + 1] != 'c':
					a[j] = 'c'
		print(''.join(a[1:-1]))


def f(a):
	for x in 'abc':
		if x not in a:
			return x

def solve():
	s = input()
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			return '-1'
	ans = ['?'] + list(s) + ['?']
	for i in range(1, len(ans) - 1):
		if ans[i] == '?':
			ans[i] = f([ans[i - 1], ans[i + 1]])
	return ''.join(ans[1:-1])
t = int(input())
for _ in range(t):
	print(solve())


t = int(input())
for i in range(t):
	s = input()
	s_new = list(s)
	lens = len(s)
	pos = -1
	if 'aa' in s:
		s_new = [-1]
	elif 'bb' in s:
		s_new = [-1]
	elif 'cc' in s:
		s_new = [-1]
	else:
		while s.find('?', pos + 1) != -1:
			pos = s.find('?', pos + 1)
			if pos > 0 and lens >= pos + 2:
				if s_new[pos - 1] != 'a' and s_new[pos + 1] != 'a':
					s_new[pos] = 'a'
				elif s_new[pos - 1] != 'b' and s_new[pos + 1] != 'b':
					s_new[pos] = 'b'
				elif s_new[pos - 1] != 'c' and s_new[pos + 1] != 'c':
					s_new[pos] = 'c'
				else:
					s_new = [-1]
					break
			elif pos > 0 and lens < pos + 2:
				if s_new[pos - 1] != 'a':
					s_new[pos] = 'a'
				elif s_new[pos - 1] != 'b':
					s_new[pos] = 'b'
				elif s_new[pos - 1] != 'c':
					s_new[pos] = 'c'
			elif pos == 0 and lens >= pos + 2:
				if s_new[pos + 1] != 'a':
					s_new[pos] = 'a'
				elif s_new[pos + 1] != 'b':
					s_new[pos] = 'b'
				elif s_new[pos + 1] != 'c':
					s_new[pos] = 'c'
			else:
				s_new = ['a']
				break
	print(*s_new, sep='')


kl = int(input())
for l in range(kl):
	pr = 0
	s = str(input())
	sr = []
	if len(s) == 1:
		if s[0] == '?':
			sr += ['a']
		else:
			sr += s[0]
		print(sr[0])
		continue
	else:
		for i in range(1, len(s)):
			if s[i] == s[i - 1] and s[i] != '?':
				print(-1)
				pr = 1
				break
		if pr == 1:
			continue
		if s[0] == '?':
			sim = ['a', 'b', 'c', '?']
			sim.remove(s[1])
			sr += sim[0]
		else:
			sr += s[0]
		for i in range(1, len(s) - 1):
			sim = ['a', 'b', 'c', '?', 'a', 'b', 'c']
			if s[i] == '?':
				sim.remove(sr[i - 1])
				sim.remove(s[i + 1])
				sr += sim[0]
			else:
				sr += s[i]
		if s[len(s) - 1] == '?':
			sim = ['a', 'b', 'c']
			sim.remove(sr[len(s) - 2])
			sr += sim[0]
		else:
			sr += s[len(s) - 1]
		for i in range(len(s)):
			print(sr[i], end='')
		print()


T = int(input())
for tc in range(T):
	s = [c for c in input()]
	n = len(s)
	i = 0
	while i < n:
		if s[i] == '?':
			prv = 'd' if i == 0 else s[i - 1]
			nxt = 'e' if i + 1 >= n else s[i + 1]
			for x in ['a', 'b', 'c']:
				if x != prv and x != nxt:
					s[i] = x
					break
		else:
			i += 1
	ok = True
	for i in range(n - 1):
		if s[i] == s[i + 1]:
			print('-1')
			ok = False
			break
	if ok == True:
		print(''.join(s))


t = int(input())
mass = ['a', 'b', 'c']
i = 0
while i < t:
	valid = 0
	strok = input()
	stroka = []
	for z in strok:
		stroka.append(z)
	j = 0
	while j < len(stroka) - 1:
		if j == 0:
			if stroka[j] == '?':
				simbol = stroka[j + 1]
				for z in mass:
					if z != simbol:
						simbol = z
						break
				stroka[j] = simbol
				j += 1
				continue
			if stroka[j] == stroka[j + 1] != '?':
				print(-1)
				valid = 1
				break
			else:
				j += 1
		else:
			if stroka[j] == '?':
				simbol1 = stroka[j + 1]
				simbol2 = stroka[j - 1]
				if 'a' != simbol1 and 'a' != simbol2:
					stroka[j] = 'a'
					j += 1
					continue
				elif 'b' != simbol1 and 'b' != simbol2:
					stroka[j] = 'b'
					j += 1
					continue
				else:
					stroka[j] = 'c'
					j += 1
					continue
			if stroka[j] == stroka[j + 1] != '?':
				print(-1)
				valid = 1
				break
			else:
				j += 1
	if stroka[-1] == '?':
		ind = len(stroka) - 2
		simbol1 = stroka[ind]
		if simbol1 != 'a':
			stroka[-1] = 'a'
		else:
			stroka[-1] = 'b'
	if valid == 0:
		answer = ''
		for z in stroka:
			answer += z
		print(answer)
	i += 1


t = int(input())
for i in range(t):
	k = input()
	s = ['/0']
	flag = 0
	for i in k:
		s.append(i)
	s.append('/o')
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			s[i] = 'a'
			if s[i] == s[i + 1] or s[i] == s[i - 1]:
				s[i] = 'b'
				if s[i] == s[i + 1] or s[i] == s[i - 1]:
					s[i] = 'c'
					if s[i] == s[i + 1] or s[i] == s[i - 1]:
						flag = 1
		elif s[i] == s[i - 1] or s[i] == s[i + 1]:
			flag = 1
			break
	if flag == 0:
		s.pop(0)
		s.pop()
		print(''.join(s))
	else:
		print(-1)


t = int(input())
for _ in range(t):
	cha = []
	stri = list(map(ord, input()))
	if len(stri) == 1:
		print('a')
		continue
	for i in range(len(stri)):
		if stri[i] == ord('?'):
			stri[i] = ord('a')
			if i > 0 and i < len(stri) - 1:
				while stri[i] == stri[i - 1] or stri[i] == stri[i + 1]:
					stri[i] += 1
			while i == 0 and stri[i] == stri[i + 1]:
				stri[i] += 1
			while i == len(stri) - 1 and stri[i] == stri[i - 1]:
				stri[i] += 1
		elif i > 0 and stri[i] == stri[i - 1] or (i < len(stri) - 1 and stri[i] == stri[i + 1]):
			print(-1)
			cha = []
			break
		cha.append(stri[i])
	if cha:
		print(''.join((chr(i) for i in cha)))


def return_other_1(a):
	l = ['a', 'b', 'c']
	for i in l:
		if a != i:
			return i

def return_other_2(a, b):
	l = ['a', 'b', 'c']
	for i in l:
		if a != i and b != i:
			return i

def main_function():
	input_data = [list(input()) for i in range(int(input()))]
	for i in range(len(input_data)):
		is_answer_out = False
		for j in range(len(input_data[i])):
			if j == 0 and j != len(input_data[i]) - 1:
				if input_data[i][j] != '?':
					if input_data[i][j] == input_data[i][j + 1]:
						is_answer_out = True
						print(-1)
						break
				else:
					input_data[i][j] = return_other_1(input_data[i][j + 1])
			elif j != 0 and j == len(input_data[i]) - 1:
				if input_data[i][j] != '?':
					if input_data[i][j] == input_data[i][j - 1]:
						print(-1)
						is_answer_out = True
						break
				else:
					input_data[i][j] = return_other_1(input_data[i][j - 1])
			elif j != 0 and j != len(input_data[i]) - 1:
				if input_data[i][j] != '?':
					if input_data[i][j] == input_data[i][j + 1] or input_data[i][j] == input_data[i][j - 1]:
						print(-1)
						is_answer_out = True
						break
				else:
					input_data[i][j] = return_other_2(input_data[i][j + 1], input_data[i][j - 1])
			else:
				if input_data[i][j] != '?':
					print(input_data[i][j])
				else:
					print('a')
				is_answer_out = True
		if not is_answer_out:
			for j in range(len(input_data[i])):
				print(input_data[i][j], end='')
			print()
main_function()


for _ in range(int(input())):
	s = input()
	s = list(s)
	f = False
	n = len(s)
	if n > 1:
		for i in range(len(s)):
			if i == 0 or i == n - 1:
				if s[i] == '?':
					if i == 0:
						if s[i + 1] != 'a':
							s[i] = 'a'
						elif s[i + 1] != 'b':
							s[i] = 'b'
						elif s[i + 1] != 'c':
							s[i] = 'c'
					if i == n - 1:
						if s[i - 1] != 'a':
							s[i] = 'a'
						elif s[i - 1] != 'b':
							s[i] = 'b'
						elif s[i - 1] != 'c':
							s[i] = 'c'
			elif s[i] == '?':
				if s[i - 1] != 'a' and s[i + 1] != 'a':
					s[i] = 'a'
				elif s[i - 1] != 'b' and s[i + 1] != 'b':
					s[i] = 'b'
				elif s[i - 1] != 'c' and s[i + 1] != 'c':
					s[i] = 'c'
		for i in range(1, n):
			if s[i - 1] == s[i]:
				f = True
		if f == False:
			print(''.join(s))
		else:
			print('-1')
	else:
		print('a')


n = int(input())
for i in range(n):
	s = list(input())
	s.append('1')
	for i in range(len(s) - 1):
		if s[i] == '?':
			if s[i - 1] != 'a' and s[i + 1] != 'a':
				s[i] = 'a'
			elif s[i - 1] != 'b' and s[i + 1] != 'b':
				s[i] = 'b'
			else:
				s[i] = 'c'
	s.remove('1')
	if all((s[i] != s[i + 1] for i in range(len(s) - 1))):
		print(''.join(map(str, s)))
	else:
		print(-1)


for i in range(int(input())):
	a = ' ' + input() + ' '
	if 'bb' in a or 'aa' in a or 'cc' in a:
		print(-1)
	else:
		a = list(a)
		for j in range(len(a)):
			if a[j] == '?':
				d = a[j + 1] + a[j - 1]
				if not 'a' in d:
					a[j] = 'a'
				elif not 'b' in d:
					a[j] = 'b'
				else:
					a[j] = 'c'
		print(''.join(a[1:-1]))


def check(string):
	for i in range(1, len(string)):
		if string[i] == '?':
			continue
		if string[i - 1] == string[i]:
			return True
	return False

def b_string():
	cases = int(input())
	strings = []
	for i in range(cases):
		strings.append(input())
	for i in range(len(strings)):
		if len(strings[i]) == 1:
			if strings[i][0] == '?':
				print('a')
			else:
				print(strings[i][0])
		elif check(strings[i]):
			print(-1)
		else:
			for j in range(len(strings[i])):
				dic = {'a': 1, 'b': 2, 'c': 3}
				if strings[i][j] == '?':
					if j != 0:
						if strings[i][j - 1] in dic:
							dic.pop(strings[i][j - 1])
					if j != len(strings[i]) - 1:
						if strings[i][j + 1] in dic:
							dic.pop(strings[i][j + 1])
					if 'a' in dic:
						strings[i] = strings[i][:j] + 'a' + strings[i][j + 1:]
					elif 'b' in dic:
						strings[i] = strings[i][:j] + 'b' + strings[i][j + 1:]
					elif 'c' in dic:
						strings[i] = strings[i][:j] + 'c' + strings[i][j + 1:]
			print(strings[i])
b_string()


from typing import Union

def select_right_letter(prev_letter: Union[str, None], next_letter: Union[str, None]) -> str:
	available_choices = ['a', 'b', 'c']
	if prev_letter is not None:
		available_choices.remove(prev_letter)
	if next_letter != '?' and next_letter is not None:
		try:
			available_choices.remove(next_letter)
		except ValueError:
			pass
	return available_choices[0]

def format_str(word: Union[list, str]) -> str:
	word_len = len(word)
	word = list(word)
	for i in range(word_len):
		prev_letter = word[i - 1] if i - 1 >= 0 else None
		next_letter = word[i + 1] if i + 1 < word_len else None
		if word[i] == '?':
			fitted_letter = select_right_letter(prev_letter, next_letter)
			word[i] = fitted_letter
		else:
			word[i] = word[i]
	return ''.join(word)

def is_word_can_be_pretty(word: str) -> bool:
	word_len = len(word)
	for i in range(word_len):
		prev_letter = word[i - 1] if i - 1 >= 0 else None
		if prev_letter == word[i] and word[i] != '?':
			return False
	return True

def main():
	lines_of_word = int(input())
	for i in range(lines_of_word):
		word = input()
		if not is_word_can_be_pretty(word):
			print('-1')
			continue
		new_word = format_str(word)
		print(new_word)
main()


def compute(arr, n):
	for i in range(n - 1):
		if arr[i] != '?' and arr[i + 1] != '?' and (arr[i] == arr[i + 1]):
			return -1
	for i in range(n):
		if arr[i] == '?':
			if i == 0 and n > 1:
				for j in 'abc':
					if arr[i + 1] != j:
						arr[i] = j
						break
			elif i == n - 1:
				for j in 'abc':
					if arr[i - 1] != j:
						arr[i] = j
						break
			else:
				for j in 'abc':
					if arr[i - 1] != j and arr[i + 1] != j:
						arr[i] = j
						break
	return ''.join(arr)
t = int(input())
for _ in range(t):
	arr = list(input())
	print(compute(arr, len(arr)))


import sys
sys.setrecursionlimit(2000)
from collections import Counter
from functools import reduce

def read_line():
	return sys.stdin.readline().rstrip()
total_test_cases = int(read_line())
possible_chars = ['a', 'b', 'c']
for _ in range(total_test_cases):
	test_case = list(read_line())
	length = len(test_case)
	invalid = False
	index = 0
	for char in test_case:
		if char == '?':
			for c in possible_chars:
				check_back = index > 0
				check_front = index + 1 < length
				if check_front and check_back:
					if c != test_case[index - 1] and c != test_case[index + 1]:
						found = True
						test_case[index] = c
						break
				elif check_front:
					if c != test_case[index + 1]:
						found = True
						test_case[index] = c
						break
				elif check_back:
					if c != test_case[index - 1]:
						found = True
						test_case[index] = c
						break
				else:
					found = True
					test_case[index] = c
					break
			if not found:
				invalid = True
				break
		if index > 0 and test_case[index - 1] == test_case[index]:
			invalid = True
			break
		index += 1
	if invalid:
		print('-1')
	else:
		print(''.join(test_case))


n = int(input())

def re(l, r):
	if 'a' != l and 'a' != r:
		return 'a'
	if 'b' != l and 'b' != r:
		return 'b'
	if 'c' != l and 'c' != r:
		return 'c'
for _ in range(n):
	s = list(input())
	ln = len(s)
	sig = True
	if s[0] == '?':
		if ln == 1:
			print('a')
			continue
		elif s[1] == 'a':
			s[0] = 'b'
		else:
			s[0] = 'a'
	elif ln != 1 and s[0] == s[1]:
		print('-1')
		continue
	for i in range(1, ln - 1):
		if s[i] == '?':
			s[i] = re(s[i - 1], s[i + 1])
		if s[i] == s[i + 1]:
			print('-1')
			sig = False
			break
	if sig:
		if s[ln - 1] == '?':
			if s[ln - 2] == 'a':
				s[ln - 1] = 'b'
			else:
				s[ln - 1] = 'a'
		x = ''.join(s)
		print(x)


from sys import stdin
test_cases = True
if test_cases:
	t = int(stdin.readline())
	while t:
		ans = 1
		s = input()
		s = 's' + s + 's'
		s = list(s)
		for i in range(1, len(s) - 1):
			if s[i] == '?':
				if s[i - 1] == 'a':
					if s[i + 1] != 'b':
						s[i] = 'b'
					elif s[i + 1] != 'c':
						s[i] = 'c'
				elif s[i - 1] == 'b':
					if s[i + 1] != 'a':
						s[i] = 'a'
					elif s[i + 1] != 'c':
						s[i] = 'c'
				elif s[i + 1] != 'a':
					s[i] = 'a'
				elif s[i + 1] != 'b':
					s[i] = 'b'
			elif s[i - 1] == s[i] or s[i] == s[i + 1]:
				ans = -1
				break
		s = ''.join(s[1:-1])
		print(s if ans == 1 else -1)
		t -= 1
else:
	(k, n) = map(int, stdin.readline().split())


t = int(input())
for _ in range(t):
	st = input()
	f = 0
	for (i, val) in enumerate(st[:-1]):
		if val != '?' and val == st[i + 1]:
			f = 1
			break
	if f == 1:
		print('-1')
	else:
		ans = ''
		temp = ['a', 'b', 'c']
		for (i, val) in enumerate(st):
			if val == '?':
				for value in temp:
					if i == 0:
						if i < len(st) - 1:
							if value != st[i + 1]:
								ans += value
								break
						else:
							ans += value
							break
					elif value != ans[-1]:
						if i < len(st) - 1:
							if value != st[i + 1]:
								ans += value
								break
						else:
							ans += value
							break
			else:
				ans += val
		print(ans)


t = int(input())
s_sum = ''
for i in range(t):
	st = input() + ' '
	s_new = ' '
	T = 0
	for j in range(len(st) - 1):
		abc_dict = {'a': 0, 'b': 0, 'c': 0}
		if st[j] == st[j + 1] and st[j] != '?' and (j != len(st)):
			s_sum = s_sum + '-1' + '\n'
			T = 1
			break
		if st[j] != '?':
			s_new = s_new + st[j]
		if st[j] == '?':
			abc_dict[s_new[j]] = 1
			abc_dict[st[j + 1]] = 1
			s_new += str([i for i in abc_dict if abc_dict[i] == 0][0])
	if T == 0:
		s_sum = s_sum + s_new[1:] + '\n'
print(s_sum)


for i in range(int(input())):
	s = list(input())
	n = len(s)
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print(-1)
			break
	else:
		if n == 1:
			if s[0] == '?':
				s[0] = 'a'
			print(''.join(s))
			continue
		if s[0] == '?':
			for j in 'abc':
				if s[1] != j:
					s[0] = j
					break
		for i in range(1, n - 1):
			if s[i] == '?':
				for j in 'abc':
					if s[i + 1] != j and s[i - 1] != j:
						s[i] = j
						break
		if s[-1] == '?':
			for j in 'abc':
				if j != s[-2]:
					s[-1] = j
					break
		print(''.join(s))


for _ in range(int(input())):
	s = [*input() + 'x']
	n = len(s) - 1
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print(-1)
			break
	else:
		letters = ['a', 'b', 'c']
		for i in range(n):
			if s[i] == '?':
				y = [s[i - 1], s[i + 1]]
				for letter in letters:
					if letter not in y:
						s[i] = letter
						break
		for i in range(n):
			print(s[i], end='')
		print('')


t = int(input())
for i in range(t):
	s = input()
	s += 'k'
	ns = 'k'
	bol = True
	for j in range(len(s) - 1):
		if s[j] == '?':
			if ns[j] != 'a' and s[j + 1] != 'a':
				ns += 'a'
			elif ns[j] != 'b' and s[j + 1] != 'b':
				ns += 'b'
			else:
				ns += 'c'
		elif ns[j] == s[j] or s[j + 1] == s[j]:
			bol = False
			print(-1)
			break
		else:
			ns += s[j]
	if bol:
		print(ns[1:])


t = int(input())
for _ in range(t):
	s = [x for x in input()]
	n = len(s)
	i = 0
	while i < n:
		if s[i] == '?':
			prev = '1' if i == 0 else s[i - 1]
			next = '0' if i == n - 1 else s[i + 1]
			for x in ['a', 'b', 'c']:
				if x != prev and x != next:
					s[i] = x
					break
		else:
			i += 1
	flag = 1
	for i in range(n - 1):
		if s[i] == s[i + 1]:
			print('-1')
			flag = 0
			break
	if flag:
		print(''.join(s))


import sys
inf = float('inf')

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
use = ['a', 'b', 'c']

def put(string):
	lst = list(string)
	n = len(string)
	for i in range(n):
		if lst[i] != '?':
			continue
		elif i == 0:
			for m in use:
				if m != lst[i + 1]:
					lst[i] = m
					break
		elif i == n - 1:
			for m in use:
				if m != lst[i - 1]:
					lst[i] = m
					break
		else:
			for m in use:
				if m != lst[i - 1] and m != lst[i + 1]:
					lst[i] = m
					break
	return lst

def check(string):
	for i in range(1, len(string)):
		if string[i] != '?' and string[i - 1] != '?' and (string[i] == string[i - 1]):
			return True
	return False
T = int(input())
while T:
	string = input()
	if len(string) == 1:
		print('a')
		T -= 1
		continue
	if check(string):
		print(-1)
		T -= 1
		continue
	ans = put(string)
	print(''.join(ans))
	T -= 1


import random
for _ in range(int(input())):
	s = input()
	s = list('0' + s + '0')
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print(-1)
			break
		elif s[i] == '?':
			if s[i - 1] != 'a' and s[i + 1] != 'a':
				s[i] = 'a'
			elif s[i - 1] != 'b' and s[i + 1] != 'b':
				s[i] = 'b'
			else:
				s[i] = 'c'
	else:
		a = s[1:len(s) - 1]
		b = ''.join(a)
		print(b)


def is_letter(x):
	if x != '?':
		return True
	return False

def dif_than(a, b):
	if a != 'a' and b != 'a':
		return 'a'
	if a != 'b' and b != 'b':
		return 'b'
	return 'c'

def add_chars(a):
	a = list(a)
	i = 0
	while i < len(a):
		if is_letter(a[i]):
			if i > 0 and is_letter(a[i - 1]) and (a[i - 1] == a[i]):
				return -1
			elif i < len(a) - 1 and is_letter(a[i + 1]) and (a[i + 1] == a[i]):
				return -1
		else:
			aa = '?'
			bb = '?'
			if i > 0:
				aa = a[i - 1]
			if i < len(a) - 1:
				bb = a[i + 1]
			a[i] = dif_than(aa, bb)
		i += 1
	return ''.join(a)
n = int(input())
for i in range(n):
	st = input()
	print(add_chars(st))


for i in range(int(input())):
	x = input()
	if 'aa' in x or 'bb' in x or 'cc' in x:
		print(-1)
	else:
		n = ['', *x]
		for i in range(len(n) - 1):
			if n[i] == '?':
				if n[i - 1] != 'a' and n[i + 1] != 'a':
					n[i] = 'a'
				elif n[i - 1] != 'b' and n[i + 1] != 'b':
					n[i] = 'b'
				else:
					n[i] = 'c'
		if n[-1] == '?':
			if n[-2] != 'a':
				n[-1] = 'a'
			elif n[-2] != 'b':
				n[-1] = 'b'
			else:
				n[-1] = 'c'
		print(*n, sep='')


Z = int(input())
for I in range(Z):
	S = list(input())
	F = 0
	X = len(S)
	if S[0] == '?':
		try:
			if S[1] != 'a':
				S[0] = 'a'
			elif S[1] != 'b':
				S[0] = 'b'
			else:
				S[0] = 'c'
		except:
			S[0] = 'a'
	for J in range(0, X - 1):
		if S[J] == S[J + 1] != '?':
			print(-1)
			F = 1
			break
		elif S[J] == '?':
			if S[J - 1] != 'a' and S[J + 1] != 'a':
				S[J] = 'a'
			elif S[J - 1] != 'b' and S[J + 1] != 'b':
				S[J] = 'b'
			else:
				S[J] = 'c'
	if S[X - 1] == '?':
		if S[X - 2] != 'a':
			S[X - 1] = 'a'
		elif S[X - 2] != 'b':
			S[X - 1] = 'b'
		else:
			S[X - 1] = 'c'
	if F == 0:
		print(''.join(S))


def inp():
	return [int(s) for s in input().split()]
for i in range(int(input())):
	s = input()
	output = ''
	if len(s) == 1 and s[0] == '?':
		s = 'a'
	for j in range(len(s)):
		if s[j] != '?':
			output += s[j]
			continue
		av = ['a', 'b', 'c', '?', '?']
		if j == 0:
			av.remove(s[j + 1])
			output += av[0]
		elif j == len(s) - 1:
			av.remove(output[j - 1])
			output += av[0]
		else:
			av.remove(s[j + 1])
			if output[j - 1] in av:
				av.remove(output[j - 1])
			output += av[0]
	flag = True
	for j in range(1, len(output)):
		if output[j - 1] == output[j]:
			flag = False
			break
	if flag:
		print(output)
	else:
		print(-1)


for _ in [0] * int(input()):
	a = ['d', *input(), 'd']
	r = 1
	for i in range(len(a) - 2):
		(x, y, z) = a[i:i + 3]
		if y == '?':
			y = [u for u in 'abc' if u not in [x, z]][0]
		r &= x != y
		a[i + 1] = y
	print([-1, ''.join(a[1:-1])][r])


t = int(input())
for i in range(t):
	s = input()
	ans = ''
	ln = len(s)
	for j in range(ln):
		if s[j] == '?':
			if j == 0:
				if ln == 1 or s[1] != 'a':
					ans += 'a'
				else:
					ans += 'b'
			elif j == ln - 1:
				if ans[-1] != 'a':
					ans += 'a'
				else:
					ans += 'b'
			elif ans[-1] != 'a' and s[j + 1] != 'a':
				ans += 'a'
			elif ans[-1] != 'b' and s[j + 1] != 'b':
				ans += 'b'
			else:
				ans += 'c'
		else:
			ans += s[j]
			if j != 0:
				if s[j] == s[j - 1]:
					ans = -1
					break
	print(ans)


for u in range(int(input())):
	s = input()
	n = len(s)
	r = []
	l = 'abc'
	if n == 1:
		if s == '?':
			print('a')
		else:
			print(s)
	elif s == '??':
		print('ab')
	elif 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
	else:
		if s[0] == '?':
			for i in l:
				if i != s[1]:
					r.append(i)
					break
		else:
			r.append(s[0])
		for i in range(1, n - 1):
			if s[i] == '?':
				for j in l:
					if j != s[i + 1] and j != r[-1]:
						r.append(j)
						break
			else:
				r.append(s[i])
		if s[-1] == '?':
			for i in l:
				if i != r[-1]:
					r.append(i)
					break
		else:
			r.append(s[-1])
		print(''.join(r))


q = int(input())
for _ in range(q):
	s = list(input() + '0')
	ans = ''
	for i in range(len(s) - 1):
		if s[i] == '?':
			if 'a' != s[i - 1] and 'a' != s[i + 1]:
				s[i] = 'a'
			elif 'b' != s[i - 1] and 'b' != s[i + 1]:
				s[i] = 'b'
			else:
				s[i] = 'c'
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			print(-1)
			break
	else:
		print(''.join(s[:-1]))


import sys, os
from math import sqrt, gcd, ceil, log, floor, sin, pi
from math import factorial as fact
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
from itertools import permutations
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
MOD = 10 ** 9 + 7

def f(arr):
	for i in 'abc':
		if not i in arr:
			return i

def main():
	ans_ = []
	for _ in range(int(input())):
		s = '?' + input().strip() + '?'
		n = len(s) - 1
		ans = '0'
		fl = 0
		for i in range(1, n):
			if s[i] == '?':
				ans += f([ans[i - 1], s[i + 1]])
			elif s[i] == ans[i - 1]:
				fl = 1
				break
			else:
				ans += s[i]
		if fl:
			ans_.append(-1)
		else:
			ans_.append(ans[1:])
	for i in ans_:
		print(i)
main()


def solve(s):
	if len(s) == 1:
		if s[0] == '?':
			return 'a'
		else:
			return s
	p = [i for i in s]
	for x in range(len(p) - 1):
		if p[x] == p[x + 1] and p[x] != '?':
			return -1
	for x in range(len(p)):
		if p[x] == '?':
			k = ''
			if x > 0 and x < len(p) - 1:
				k = p[x - 1] + p[x + 1]
			elif x == 0:
				k = p[x + 1]
			elif x == len(p) - 1:
				k = p[x - 1]
			if 'a' not in k:
				p[x] = 'a'
			elif 'b' not in k:
				p[x] = 'b'
			elif 'c' not in k:
				p[x] = 'c'
	return ''.join(p)
k = int(input())
for i in range(k):
	s = str(input())
	print(solve(s))


for z in range(int(input())):
	s = list(input())
	n = len(s)
	ok = True
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print('-1')
			ok = False
			break
	if not ok:
		continue
	if n == 1:
		if s[0] == '?':
			print('a')
		else:
			print(''.join(s))
		continue
	for i in range(n):
		if s[i] == '?' and (i != 0 and i != n - 1):
			if s[i - 1] != 'a' and s[i + 1] != 'a':
				s[i] = 'a'
			elif s[i - 1] != 'b' and s[i + 1] != 'b':
				s[i] = 'b'
			elif s[i - 1] != 'c' and s[i + 1] != 'c':
				s[i] = 'c'
		elif s[i] == '?' and i == 0:
			if s[i + 1] != 'a':
				s[i] = 'a'
			elif s[i + 1] != 'b':
				s[i] = 'b'
			elif s[i + 1] != 'c':
				s[i] = 'c'
		elif s[i] == '?' and i == n - 1:
			if s[i - 1] != 'a':
				s[i] = 'a'
			elif s[i - 1] != 'b':
				s[i] = 'b'
			elif s[i - 1] != 'c':
				s[i] = 'c'
	print(''.join(s))


t = int(input())
while t > 0:
	t = t - 1
	s = input()
	if len(s) == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s)
		continue
	ok = True
	l = 'd'
	ans = ''
	for i in range(len(s) - 1):
		if s[i] != '?':
			ans += s[i]
			if s[i] == l or s[i] == s[i + 1]:
				ok = False
				break
		elif l == 'a' or s[i + 1] == 'a':
			if l == 'b' or s[i + 1] == 'b':
				ans += 'c'
			else:
				ans += 'b'
		else:
			ans += 'a'
		l = ans[i]
	if s[len(s) - 1] == '?':
		if ans[len(ans) - 1] != 'a':
			ans += 'a'
		elif ans[len(ans) - 1] != 'b':
			ans += 'b'
		elif ans[len(ans) - 1] != 'c':
			ans += 'c'
	else:
		ans += s[len(s) - 1]
	if ok:
		print(ans)
	else:
		print('-1')


q = int(input())
for t in range(q):
	ans = ''
	v = False
	s = input()
	if len(s) == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s[0])
	else:
		if s[0] == '?':
			if s[1] != 'a':
				ans += 'a'
			elif s[1] != 'b':
				ans += 'b'
			else:
				ans += 'c'
		else:
			ans += s[0]
		for i in range(1, len(s) - 1):
			if s[i] != '?':
				ans += s[i]
			elif ans[-1] != 'a' and s[i + 1] != 'a':
				ans += 'a'
			elif ans[-1] != 'b' and s[i + 1] != 'b':
				ans += 'b'
			elif ans[-1] != 'c' and s[i + 1] != 'c':
				ans += 'c'
			else:
				v = True
				print(-1)
				break
			if ans[i] == ans[i - 1]:
				v = True
				print(-1)
				break
		if s[-1] == '?':
			if ans[-1] != 'a':
				ans += 'a'
			elif ans[-1] != 'b':
				ans += 'b'
			else:
				ans += 'c'
		else:
			ans += s[-1]
		if not v and ans[-1] == ans[-2]:
			v = True
			print(-1)
		elif not v and len(ans) == len(s):
			print(ans)


T = int(input())
for t in range(T):
	s = input()
	si = list(s)
	d = ['a', 'b', 'c']
	chk = False
	if len(s) == 1:
		si[0] = 'a'
	else:
		for i in range(len(s)):
			if i != len(s) - 1:
				if si[i] == si[i + 1] and si[i] != '?':
					chk = True
					break
				elif si[i] == '?':
					if i == 0:
						for a in d:
							if a != si[i + 1]:
								si[i] = str(a)
								break
					else:
						for a in d:
							if a != si[i - 1] and a != si[i + 1]:
								si[i] = str(a)
								break
			elif si[i] == '?':
				if si[i - 1] == 'a':
					si[i] = 'b'
				elif si[i - 1] == 'b':
					si[i] = 'a'
				elif si[i - 1] == 'c':
					si[i] = 'a'
	if chk == False:
		for i in range(len(s)):
			print(si[i], end='')
		print('')
	else:
		print(-1)


t = int(input())
for x in range(t):
	word = list(input())
	prev = word[0]
	for y in range(1, len(word)):
		if word[y] == prev and word[y] != '?':
			print(-1)
			break
		prev = word[y]
	else:
		pos = 0
		new = ''
		if len(word) == 1:
			print('a')
		else:
			while pos < len(word):
				list1 = ['a', 'b', 'c']
				if word[pos] != '?':
					new += word[pos]
					pos += 1
					continue
				if pos == 0:
					if word[pos + 1] != '?':
						list1.remove(word[pos + 1])
					word[pos] = list1[0]
				elif pos == len(word) - 1:
					list1.remove(word[pos - 1])
					word[pos] = list1[0]
				else:
					if word[pos - 1] != '?':
						list1.remove(word[pos - 1])
					if word[pos + 1] != '?' and word[pos + 1] in list1:
						list1.remove(word[pos + 1])
					word[pos] = list1[0]
				new += word[pos]
				pos += 1
			print(new)


z = ['a', 'b', 'c']
t = int(input())
for case in range(t):
	s = input()
	l = list(s)
	n = len(s)
	for i in range(n):
		y = set()
		if s[i] == '?':
			if i > 0:
				y.add(l[i - 1])
			if i < n - 1:
				y.add(l[i + 1])
			y = [a for a in z if a not in y]
			l[i] = y[0]
	ans = ''.join(l)
	if 'aa' in ans or 'bb' in ans or 'cc' in ans:
		print(-1)
	else:
		print(ans)


from sys import stdin, stdout, setrecursionlimit
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from random import seed, randint
from datetime import datetime
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
from collections import defaultdict as dd
mod = pow(10, 9) + 7
mod2 = 998244353

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

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def def_value():
	return 0
for _ in range(iinp()):
	s = list(inp())
	n = len(s)
	s = ['d'] + s + ['d']
	flg = False
	ll = ['a', 'b', 'c']
	for i in range(1, n + 1):
		if s[i] == '?':
			for j in ll:
				if j != s[i - 1] and j != s[i + 1]:
					s[i] = j
					break
	for i in range(1, n):
		if s[i] == s[i + 1]:
			flg = True
			break
	s = s[1:n + 1]
	if flg:
		print(-1)
	else:
		print(''.join(s))


import sys, queue, copy
sys.setrecursionlimit(10 ** 8)

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

def inpl_str():
	return list(sys.stdin.readline().split())
INF = float('inf')
abc = list(['a', 'b', 'c'])

def test(s):
	ans = list()
	if len(s) == 1:
		if s[0] == '?':
			ans.append('a')
			return ans
		else:
			ans.append(s[0])
			return ans
	for i in range(len(s)):
		if i == len(s) - 1:
			if s[i] == '?':
				for temp in abc:
					if ans[i - 1] != temp:
						ans.append(temp)
						break
				else:
					ans.clear()
					ans.append('-1')
					return ans
			else:
				ans.append(s[i])
		elif i == 0:
			if s[i] == s[i + 1] and s[i] != '?':
				ans.clear()
				ans.append('-1')
				return ans
			if s[i] == '?':
				for temp in abc:
					if temp != s[i + 1]:
						ans.append(temp)
						break
				else:
					ans.clear()
					ans.append('-1')
					return ans
			else:
				ans.append(s[i])
		else:
			if s[i] == s[i + 1] and s[i] != '?':
				ans.clear()
				ans.append('-1')
				return ans
			if s[i] == '?':
				for temp in abc:
					if temp != s[i + 1] and temp != ans[i - 1]:
						ans.append(temp)
						break
				else:
					ans.clear()
					ans.append('-1')
					return ans
			else:
				ans.append(s[i])
	return ans
N = int(input())
Slist = list()
for _ in range(N):
	Slist.append(input())
ans = list()
for s in Slist:
	ans = test(s)
	print(''.join(ans))
	ans.clear()


from sys import stdin, stdout
num = int(stdin.readline().strip())
outputs = []
for _ in range(num):
	s = stdin.readline().strip()
	possible = True
	output = ''
	for i in range(len(s)):
		if i != len(s) - 1 and s[i] != '?' and (s[i] == s[i + 1]):
			possible = False
			break
		candidates = ['a', 'b', 'c']
		if s[i] != '?':
			output += s[i]
			continue
		else:
			if i != 0 and s[i - 1] in candidates:
				candidates.remove(s[i - 1])
			if i != len(s) - 1 and s[i + 1] in candidates:
				candidates.remove(s[i + 1])
			if output and output[-1] in candidates:
				candidates.remove(output[-1])
			output += candidates[0]
	if not possible:
		outputs.append('-1')
	else:
		outputs.append(output)
stdout.write('\n'.join(outputs) + '\n')


from sys import stdin
n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]
for i in li:
	frag = 0
	lin = [_ for _ in i]
	lin = ['?'] + lin + ['?']
	for j in range(1, len(lin) - 1):
		if lin[j] != '?' and lin[j] == lin[j + 1]:
			frag = 1
			break
		elif lin[j] == '?':
			lis = ['a', 'b', 'c']
			if lin[j - 1] in lis:
				lis.remove(lin[j - 1])
			if lin[j + 1] in lis:
				lis.remove(lin[j + 1])
			lin[j] = lis[0]
	if frag == 1:
		print(-1)
	else:
		print(''.join(lin[1:len(lin) - 1]))


t = int(input())
for _ in range(t):
	st = list(input())
	co = 0
	for i in range(len(st) - 1):
		if st[i] != '?' and st[i] == st[i + 1]:
			print(-1)
			co = 1
			break
	if co == 0:
		for i in range(len(st)):
			l = ['a', 'b', 'c', 'a', 'b', 'c', '?', '?']
			if st[i] == '?':
				l.remove(st[max(0, i - 1)])
				l.remove(st[min(len(st) - 1, i + 1)])
				st[i] = l[0]
		print(*st, sep='')


for _ in range(int(input())):
	l = []
	s = list(map(ord, input()))
	if len(s) == 1:
		print('a')
		continue
	for i in range(len(s)):
		if s[i] == ord('?'):
			s[i] = ord('a')
			if i > 0 and i < len(s) - 1:
				while s[i] == s[i - 1] or s[i] == s[i + 1]:
					s[i] += 1
			while i == 0 and s[i] == s[i + 1]:
				s[i] += 1
			while i == len(s) - 1 and s[i] == s[i - 1]:
				s[i] += 1
		elif i > 0 and s[i] == s[i - 1] or (i < len(s) - 1 and s[i] == s[i + 1]):
			print(-1)
			l = []
			break
		l.append(s[i])
	if l:
		print(''.join((chr(i) for i in l)))


tc = int(input().strip())
for t in range(tc):
	gs = list(input().strip())
	poss = True
	for i in range(1, len(gs)):
		if gs[i] != '?' and gs[i] == gs[i - 1]:
			poss = False
			break
	if poss:
		for i in range(len(gs)):
			if gs[i] == '?':
				if i == 0:
					if len(gs) == 1 or gs[i + 1] in ['?', 'b', 'c']:
						gs[i] = 'a'
					elif gs[i + 1] in ['?', 'c', 'a']:
						gs[i] = 'b'
					else:
						gs[i] = 'c'
				elif i == len(gs) - 1:
					if gs[i - 1] in ['b', 'c']:
						gs[i] = 'a'
					elif gs[i - 1] in ['c', 'a']:
						gs[i] = 'b'
					else:
						gs[i] = 'c'
				elif gs[i + 1] in ['?', 'b', 'c'] and gs[i - 1] in ['?', 'b', 'c']:
					gs[i] = 'a'
				elif gs[i + 1] in ['?', 'c', 'a'] and gs[i - 1] in ['?', 'c', 'a']:
					gs[i] = 'b'
				else:
					gs[i] = 'c'
		print(''.join(gs))
	else:
		print(-1)


def char(r, s, i):
	(c1, c2) = (get_char(r, i - 1), get_char(s, i + 1))
	if 'a' not in [c1, c2]:
		return 'a'
	elif 'b' not in [c1, c2]:
		return 'b'
	return 'c'

def get_char(s, i):
	if i == -1 or i == len(s):
		return '.'
	return s[i]

def check(s, i):
	if i == 0:
		return True
	else:
		return s[i] != s[i - 1]
n = int(input())
for _ in range(n):
	beautiful = True
	r = []
	s = input()
	for i in range(len(s)):
		if s[i] == '?':
			r.append(char(r, s, i))
		else:
			r.append(s[i])
			beautiful = beautiful and check(s, i)
	if beautiful:
		for c in r:
			print(c, end='')
		print()
	else:
		print(-1)


t = int(input())
for i in range(t):
	s = list(input())
	li = []
	n = len(s)
	f = 0
	for j in range(n):
		if j == 0:
			if s[j] != '?':
				li.append(s[j])
			else:
				g = ['a', 'b', 'c']
				if j != n - 1:
					if s[j + 1] != '?':
						g.remove(s[j + 1])
				li.append(g[0])
		elif s[j] == li[-1]:
			f = 1
			break
		elif s[j] != '?':
			li.append(s[j])
		else:
			g = ['a', 'b', 'c']
			if j != n - 1:
				if s[j + 1] in g:
					g.remove(s[j + 1])
			if li[-1] in g:
				g.remove(li[-1])
			li.append(g[0])
	if f == 0:
		print(''.join(li))
	else:
		print(-1)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

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

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(iinp()):
	s = list(inp())
	n = len(s)
	b = ''
	t = True
	for i in range(n):
		if s[i] == '?':
			l = s[i - 1] if i > 0 else 'z'
			r = 'y' if i == n - 1 else s[i + 1]
			for j in 'abc':
				if l != j and r != j:
					s[i] = j
					break
			else:
				t = False
				break
		if i > 0 and s[i] == s[i - 1]:
			t = False
			break
	out(''.join(s) if t else -1)


tests = int(input())
for te in range(tests):
	s = input()
	stringa = []
	n = len(s)
	for i in range(n):
		stringa.append(s[i])
	flag = 1
	for i in range(n - 1):
		if stringa[i] != '?' and stringa[i] == stringa[i + 1]:
			flag = 0
	if flag == 0:
		print(-1)
		continue
	if stringa[0] == '?':
		if n == 1:
			stringa[0] = 'a'
		elif stringa[1] == 'a':
			stringa[0] = 'b'
		elif stringa[1] == 'b':
			stringa[0] = 'a'
		elif stringa[1] == 'c':
			stringa[0] = 'a'
		elif stringa[1] == '?':
			stringa[0] = 'a'
	for i in range(1, n - 1):
		if stringa[i] == '?':
			if stringa[i - 1] == 'a':
				if stringa[i + 1] == 'a':
					stringa[i] = 'b'
				elif stringa[i + 1] == 'b':
					stringa[i] = 'c'
				elif stringa[i + 1] == 'c':
					stringa[i] = 'b'
				elif stringa[i + 1] == '?':
					stringa[i] = 'b'
			elif stringa[i - 1] == 'b':
				if stringa[i + 1] == 'a':
					stringa[i] = 'c'
				elif stringa[i + 1] == 'b':
					stringa[i] = 'a'
				elif stringa[i + 1] == 'c':
					stringa[i] = 'a'
				elif stringa[i + 1] == '?':
					stringa[i] = 'a'
			elif stringa[i - 1] == 'c':
				if stringa[i + 1] == 'a':
					stringa[i] = 'b'
				elif stringa[i + 1] == 'b':
					stringa[i] = 'a'
				elif stringa[i + 1] == 'c':
					stringa[i] = 'a'
				elif stringa[i + 1] == '?':
					stringa[i] = 'a'
	if stringa[n - 1] == '?':
		if stringa[n - 2] == 'a':
			stringa[n - 1] = 'b'
		elif stringa[n - 2] == 'b':
			stringa[n - 1] = 'a'
		elif stringa[n - 2] == 'c':
			stringa[n - 1] = 'a'
	for i in range(n):
		if i == n - 1:
			print(stringa[i])
			break
		print(stringa[i], end='')


n = int(input())
for _ in range(n):
	s = [c for c in input()]
	s.append('R')
	last = 'j'
	nope = False
	for i in range(len(s) - 1):
		if last == s[i]:
			nope = True
			break
		if s[i] != '?':
			last = s[i]
			continue
		if last == s[i + 1] or last == 'j' or s[i + 1] == '?' or (s[i + 1] == 'R'):
			if s[i + 1] == 'a' or last == 'a':
				s[i] = 'b'
			else:
				s[i] = 'a'
			last = s[i]
			continue
		if last == 'a' and s[i + 1] == 'b':
			s[i] = 'c'
			last = 'c'
			continue
		if last == 'b' and s[i + 1] == 'a':
			s[i] = 'c'
			last = 'c'
			continue
		if last == 'a' and s[i + 1] == 'c':
			s[i] = 'b'
			last = 'b'
			continue
		if last == 'c' and s[i + 1] == 'a':
			s[i] = 'b'
			last = 'b'
			continue
		if last == 'c' and s[i + 1] == 'b':
			s[i] = 'a'
			last = 'a'
			continue
		if last == 'b' and s[i + 1] == 'c':
			s[i] = 'a'
			last = 'a'
			continue
	if nope:
		print(-1)
	else:
		print(''.join(s[:-1]))


def resh(s):
	i = 1
	l = len(s)
	if s[0] == '?':
		if s[1] != 'a':
			s = 'a' + s[1:]
		elif s[1] != 'b':
			s = 'b' + s[1:]
		else:
			s = 'c' + s[1:]
	kl = 0
	while i < l - 1:
		if s[i] == s[i - 1] and s[i] != '?':
			kl = 1
			break
		if s[i] == '?':
			if s[i - 1] != 'a' and s[i + 1] != 'a':
				s = s[0:i] + 'a' + s[i + 1:]
			elif s[i - 1] != 'b' and s[i + 1] != 'b':
				s = s[0:i] + 'b' + s[i + 1:]
			else:
				s = s[0:i] + 'c' + s[i + 1:]
		i += 1
	if s[l - 1] == s[l - 2]:
		kl = 1
	if s[l - 1] == '?':
		if s[l - 2] != 'a':
			s = s[0:l - 1] + 'a'
		elif s[l - 2] != 'b':
			s = s[0:l - 1] + 'b'
		else:
			s = s[0:l - 1] + 'c'
	if kl == 1:
		s = '-1'
	return s
n = int(input())
while n > 0:
	n -= 1
	s = input()
	if s == '?':
		ans = 'a'
	else:
		ans = resh(s)
	print(ans)


def get_val(before, after):
	letters = ['a', 'b', 'c']
	for i in letters:
		if i != before and i != after:
			return i

def beautify(ugly):
	result = []
	length = len(ugly)
	if length == 1:
		return get_val(None, None) if ugly[0] == '?' else ugly[0]
	else:
		result.append(get_val(None, ugly[1]) if ugly[0] == '?' else ugly[0])
	for i in range(1, length - 1):
		if ugly[i] == '?':
			result.append(get_val(result[-1], ugly[i + 1]))
		else:
			if ugly[i] == result[-1]:
				return '-1'
			result.append(ugly[i])
	if result[-1] == ugly[-1]:
		return '-1'
	result.append(get_val(None, result[-1]) if ugly[-1] == '?' else ugly[-1])
	return ''.join(result)

def solution(inp):
	return beautify(inp)

def main():
	inp1 = input()
	length = int(inp1)
	result = []
	for i in range(length):
		result += [solution(input())]
	print(*result, sep='\n', end='')
main()


for _ in range(int(input())):
	s = input()
	a = 'abc'
	f = 0
	l = len(s)
	for i in range(1, l):
		if s[i - 1] == s[i] and s[i - 1] != '?':
			f = 1
			break
	if f:
		print(-1)
		continue
	n = ''
	if s[0] == '?':
		if l == 1:
			n += a[0]
		else:
			c = 0
			while s[1] == a[c]:
				c += 1
			n += a[c]
	else:
		n += s[0]
	for i in range(1, l - 1):
		c = 0
		if s[i] == '?':
			while n[i - 1] == a[c] or s[i + 1] == a[c]:
				c += 1
			n += a[c]
		else:
			n += s[i]
	if s[l - 1] == '?' and l != 1:
		c = 0
		while n[l - 2] == a[c]:
			c += 1
		n += a[c]
	elif l != 1:
		n += s[l - 1]
	print(n)


for _ in range(int(input())):
	s = input()
	ans = ''
	x = ''
	f = 0
	for i in range(0, len(s) - 1):
		if s[i + 1] != '?' and s[i + 1] == s[i]:
			f = 1
			ans = -1
	if len(s) == 1:
		ans += 'a'
		f = 1
	if f == 0:
		if s[0] == '?':
			c = s[1]
			i = 0
			while c == s[1]:
				c = chr(ord('a') + i)
				i += 1
			ans = ans + c
		else:
			ans = ans + s[0]
		for i in range(1, len(s) - 1):
			if s[i] != '?':
				ans += s[i]
				continue
			else:
				c = ans[i - 1]
				j = 0
				while c == ans[i - 1] or c == s[i + 1]:
					c = chr(ord('a') + j)
					j += 1
				ans = ans + c
		if s[len(s) - 1] == '?':
			c = ans[len(s) - 2]
			i = 0
			while c == ans[len(s) - 2]:
				c = chr(ord('a') + i)
				i += 1
			ans = ans + c
		else:
			ans = ans + s[len(s) - 1]
	print(ans)


from sys import stdin

def input():
	return stdin.readline()[:-1]
for _ in range(int(input())):
	s = list(input())
	for i in range(0, len(s)):
		if s[i] == '?':
			if i > 0:
				prev = s[i - 1]
			else:
				prev = 'x'
			if i < len(s) - 1:
				post = s[i + 1]
			else:
				post = 'x'
			for ch in list('abc'):
				if ch != prev and ch != post:
					s[i] = ch
					break
	correct = True
	for i in range(0, len(s) - 1):
		if s[i + 1] == s[i]:
			correct = False
	print(''.join(s)) if correct else print(-1)


from math import sqrt, ceil

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

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

def li():
	return list(mi())

def si():
	return input()
abc = ['a', 'b', 'c']
t = ii()
while t:
	t -= 1
	s = si()
	s = list(s)
	f = 0
	n = len(s)
	i = 0
	while i < n - 1:
		if s[i] == s[i + 1] and s[i] != '?':
			f = 1
			break
		if s[i] == '?':
			for j in range(i + 1, len(s)):
				if s[j] != '?':
					break
			for k in range(i, j):
				if k - 1 >= 0:
					for k1 in range(3):
						if abc[k1] != s[k - 1] and abc[k1] != s[k + 1]:
							s[k] = abc[k1]
							break
				else:
					for k1 in range(3):
						if abc[k1] != s[k + 1]:
							s[k] = abc[k1]
							break
			i = j
		else:
			i += 1
	if s[n - 1] == '?':
		for k1 in range(3):
			if abc[k1] != s[n - 2]:
				s[n - 1] = abc[k1]
				break
	if f == 1:
		print('-1')
	else:
		print(''.join(s))


import re
for _ in range(int(input())):
	a = input()
	a = a + ','
	b = ''
	aha = re.search('aa', a)
	ahi = re.search('bb', a)
	ahu = re.search('cc', a)
	if aha or ahi or ahu:
		print(-1)
		continue
	for i in range(len(a) - 1):
		if a[i] == '?':
			if i == 0:
				for j in ['a', 'b', 'c']:
					if j != a[i + 1]:
						a = a[:i] + j + a[i + 1:]
						break
			else:
				for j in ['a', 'b', 'c']:
					if j != a[i + 1] and j != a[i - 1]:
						a = a[:i] + j + a[i + 1:]
						break
	print(a[:-1])


for _ in range(int(input())):
	s = [0]
	for i in input():
		s.append(i)
	s.append(0)
	flag = 0
	for i in range(0, len(s)):
		if s[i] == '?':
			if s[i - 1] != 'a' and s[i + 1] != 'a':
				s[i] = 'a'
			elif s[i - 1] != 'b' and s[i + 1] != 'b':
				s[i] = 'b'
			elif s[i - 1] != 'c' and s[i + 1] != 'c':
				s[i] = 'c'
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			print(-1)
			flag = 1
			break
	if flag == 1:
		continue
	for i in s[1:len(s) - 1]:
		print(i, end='')
	print()


t = int(input())
for _ in range(t):
	s = str(input())
	res = []
	flag = True
	for (i, c) in enumerate(s):
		if c == '?':
			for j in range(26):
				x = chr(j + ord('a'))
				if res:
					if res[-1] == x:
						continue
				if i != len(s) - 1:
					if s[i + 1] == x:
						continue
				res.append(x)
				break
			else:
				flag = False
		else:
			res.append(c)
	if not flag:
		print(-1)
		continue
	for i in range(len(res) - 1):
		if res[i] == res[i + 1]:
			print(-1)
			break
	else:
		print(''.join(res))


for i in int(input()) * [0]:
	s = list(input())
	x = 1
	s.append('0')
	s.insert(0, '0')
	for i in range(1, len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print(-1)
			x = 0
			break
		elif s[i] == '?':
			s[i] = 'a' if s[i - 1] != 'a' and s[i + 1] != 'a' else 'b' if s[i - 1] != 'b' and s[i + 1] != 'b' else 'c'
	if x == 1:
		print(''.join(s).strip('0'))


for _ in range(int(input())):
	s = list(input())
	n = len(s)
	for i in range(n):
		if s[i] == '?':
			for ch in 'abc':
				if s[max(0, i - 1)] != ch != s[min(n - 1, i + 1)]:
					s[i] = ch
					break
	print(-1 if any((s[i] == s[i + 1] for i in range(n - 1))) else ''.join(s))


def solve(s):
	for (i, c) in enumerate(s):
		if c == '?':
			for j in ('a', 'b', 'c'):
				if i > 0 and s[i - 1] == j:
					continue
				if i < len(s) - 1 and s[i + 1] == j:
					continue
				s[i] = j
				break
		elif i > 0 and c == s[i - 1]:
			print(-1)
			return
		elif i < len(s) - 1 and c == s[i + 1]:
			print(-1)
			return
	print(''.join(s))
n = input().strip()
n = int(n)
for _ in range(n):
	s = input().strip()
	s = list(s)
	solve(s)


n = int(input())

def solve():
	s = input()
	imp = False
	for (c, v) in zip(s, s[1:]):
		if c == v != '?':
			imp = True
			break
	if imp:
		return -1
	r = []
	bef = None
	aft = None
	prev = None
	for (i, c) in enumerate(s):
		if c != '?':
			r.append(c)
			bef = None
			aft = None
			prev = None
		else:
			if bef is None:
				if i == 0:
					bef = 'd'
				else:
					bef = s[i - 1]
				j = i + 1
				while j < len(s) and s[j] == '?':
					j += 1
				if j == len(s):
					aft = 'd'
				else:
					aft = s[j]
			if i == 0:
				prev = 'd'
			else:
				prev = r[i - 1]
			r.append(next((v for v in 'abc' if v != prev and v != aft)))
	return ''.join(r)
for _ in range(n):
	print(solve())


for _ in range(int(input())):
	a = list(input())
	n = len(a)
	temp = 0
	for i in range(1, n):
		if a[i] == a[i - 1] and a[i] != '?':
			temp = 1
	if temp == 1:
		print(-1)
	elif n == 1:
		if a[0] == '?':
			print('a')
		else:
			print(a[0])
	else:
		for i in range(n):
			if a[i] == '?':
				if i == 0:
					if a[i + 1] != 'a':
						a[i] = 'a'
					else:
						a[i] = 'b'
				elif i == n - 1:
					if a[i - 1] != 'a':
						a[i] = 'a'
					else:
						a[i] = 'b'
				elif a[i - 1] != 'a' and a[i + 1] != 'a':
					a[i] = 'a'
				elif a[i - 1] != 'b' and a[i + 1] != 'b':
					a[i] = 'b'
				elif a[i - 1] != 'c' and a[i + 1] != 'c':
					a[i] = 'c'
		ans = ''
		for i in a:
			ans += i
		print(ans)


T = int(input())
for t in range(1, T + 1):
	flag = True
	s = input()
	for i in range(len(s)):
		if s[i] == '?':
			for j in ['a', 'b', 'c']:
				if (i + 1 >= len(s) or j != s[i + 1]) and (i - 1 < 0 or j != s[i - 1]):
					s = s[:i] + j + s[i + 1:]
					break
		if i + 1 < len(s) and s[i] == s[i + 1] or (i - 1 >= 0 and s[i] == s[i - 1]):
			flag = False
			break
	if flag:
		print(s)
	else:
		print(-1)


for _ in range(int(input())):
	s = list(input())
	ln = len(s)
	possible = True
	for i in range(ln):
		c = s[i]
		nxt = None
		prev = None
		if i < ln - 1:
			nxt = s[i + 1]
		if i > 0:
			prev = s[i - 1]
		if nxt == c and nxt != '?':
			print(-1)
			possible = False
			break
		if c == '?':
			chc = ['a', 'b', 'c']
			if prev is not None and prev in chc:
				chc.remove(prev)
			if nxt is not None and nxt != '?' and (nxt in chc):
				chc.remove(nxt)
			if len(chc) == 0:
				possible = False
				break
			s[i] = chc[0]
	if possible:
		print(''.join(s))


for _ in range(int(input())):
	s = ['.'] + list(input()) + ['.']
	f = 1
	for i in range(1, len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print(-1)
			f = 0
			break
		elif s[i] == '?':
			s[i] = 'abc'.replace(s[i + 1], '').replace(s[i - 1], '')[0]
	if f:
		print(''.join(s[1:len(s) - 1]))


t = int(input())
for _ in range(t):
	s = list(input())
	x = 'abc'
	for i in range(len(s)):
		if s[i] != '?':
			continue
		for j in x:
			if s[max(0, i - 1)] != j != s[min(i + 1, len(s) - 1)]:
				s[i] = j
				break
	tmp = 0
	for j in range(1, len(s)):
		if s[j - 1] == s[j]:
			tmp = 1
			break
	if tmp == 1:
		print(-1)
	else:
		ans = ''
		for j in s:
			ans += j
		print(ans)


t = int(input())
for q in range(t):
	s = input()
	string = list(s)
	bad = False
	for i in range(0, len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			bad = True
			break
	if bad:
		print(-1)
	else:
		l = ['a', 'b', 'c']
		for i in range(0, len(s)):
			if string[i] == '?':
				if i == 0:
					if i + 1 < len(s):
						if string[i + 1] == '?':
							string[i] = l[0]
						else:
							x = l[0]
							c = 0
							while x == string[i + 1]:
								x = l[c + 1]
								c += 1
							string[i] = x
					else:
						c = 0
						x = l[c]
						while x == string[i - 1]:
							x = l[c + 1]
							c += 1
						string[i] = x
				elif i + 1 < len(s):
					if string[i + 1] == '?':
						c = 0
						x = l[c]
						while x == string[i - 1]:
							x = l[c + 1]
							c += 1
						string[i] = x
					else:
						c = 0
						x = l[c]
						while x == string[i - 1] or x == string[i + 1]:
							x = l[c + 1]
							c += 1
						string[i] = x
				else:
					c = 0
					x = l[c]
					while x == string[i - 1]:
						x = l[c + 1]
						c += 1
					string[i] = x
		for i in string:
			print(i, end='')
		print('\n', end='')


t = int(input())
for i in range(t):
	s = input()
	s1 = list(s)
	if len(s1) > 1:
		if s1[0] == '?':
			if s1[1] != 'a':
				s1[0] = 'a'
			elif s1[1] != 'b':
				s1[0] = 'b'
			else:
				s1[0] = 'c'
		f = 1
		for j in range(1, len(s1) - 1):
			if s1[j] == '?':
				if s1[j - 1] != 'a' and s1[j + 1] != 'a':
					s1[j] = 'a'
				elif s1[j - 1] != 'b' and s1[j + 1] != 'b':
					s1[j] = 'b'
				elif s1[j - 1] != 'c' and s1[j + 1] != 'c':
					s1[j] = 'c'
			elif s1[j] == s1[j - 1] or s1[j] == s1[j + 1]:
				f = 0
				print(-1)
				break
		if f == 1:
			if s1[len(s) - 1] == '?':
				if s1[len(s) - 2] != 'a':
					s1[len(s) - 1] = 'a'
				elif s1[len(s) - 2] != 'b':
					s1[len(s) - 1] = 'b'
				else:
					s1[len(s) - 1] = 'c'
			s2 = ''.join(s1)
			print(s2)
	elif s1[0] == '?':
		print('a')
	else:
		print(s1[0])


def check(s):
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			return True
	return False
for _ in range(int(input())):
	l = input()
	ch = check(l)
	if ch:
		print(-1)
	else:
		l = list(l)
		for i in range(len(l)):
			if l[i] == '?':
				l[i] = 'a'
				if i == 0:
					if check(l[:i + 2]):
						l[i] = 'b'
						if check(l[:i + 2]):
							l[i] = 'c'
				elif check(l[i - 1:i + 2]):
					l[i] = 'b'
					if check(l[i - 1:i + 2]):
						l[i] = 'c'
		print(''.join(l))


t = int(input())
for i in range(t):
	s = list(input())
	n = len(s)
	flag = 0
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			flag = -1
	if flag == 0:
		if n == 1:
			print('a')
		else:
			for i in range(n):
				if s[i] == '?':
					if i == 0:
						if s[1] != 'a':
							s[0] = 'a'
						elif s[1] != 'b':
							s[0] = 'b'
						else:
							s[0] = 'c'
					elif i == n - 1:
						if s[n - 2] != 'a':
							s[n - 1] = 'a'
						elif s[n - 2] != 'b':
							s[n - 1] = 'b'
						else:
							s[n - 1] = 'c'
					elif s[i - 1] != 'a' and s[i + 1] != 'a':
						s[i] = 'a'
					elif s[i - 1] != 'b' and s[i + 1] != 'b':
						s[i] = 'b'
					else:
						s[i] = 'c'
			for i in range(n):
				print(s[i], end='')
			print()
	else:
		print(-1)


def test():
	poss = ['a', 'b', 'c']
	s = input()
	n = len(s)
	ans = ''
	if n == 1:
		if s == '?':
			return 'a'
		else:
			return s
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			return -1
	if s[0] == '?':
		for char in poss:
			if char != s[1]:
				s = char + s[1:]
				ans += char
				break
	else:
		ans += s[0]
	for i in range(1, n - 1):
		if s[i] == '?':
			flag = False
			for char in poss:
				if char != s[i - 1] and char != s[i + 1]:
					ans += char
					s = s[:i] + char + s[i + 1:]
					flag = True
					break
			if not flag:
				return -1
		else:
			ans += s[i]
	if s[-1] == '?':
		for char in poss:
			if char != s[-2]:
				ans += char
				break
	else:
		ans += s[-1]
	return ans
for i in range(int(input())):
	print(test())


from os import path
import sys
from math import ceil, floor, gcd, log
from collections import defaultdict, Counter
maxx = float('inf')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))
else:
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))
for _ in range(I()):
	s = S()
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
		continue
	s = ['$'] + list(s) + ['$']
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			s[i] = 'abc'.replace(s[i + 1], '').replace(s[i - 1], '')[0]
	print(''.join(s)[1:len(s) - 1])


def beautify_string(s):
	string_length = len(s)
	question_mark = '?'
	prev_char = ''
	for i in range(string_length):
		if s[i] == question_mark:
			prev_char = ''
			if string_length == 1:
				return 'a'
			elif i == 0:
				replace_char = replace_questions_mark(None, s[i + 1])
			elif i == string_length - 1:
				replace_char = replace_questions_mark(s[i - 1], None)
			else:
				replace_char = replace_questions_mark(s[i - 1], s[i + 1])
			s = s[:i] + replace_char + s[i + 1:]
		elif prev_char == s[i]:
			return -1
		else:
			prev_char = s[i]
	return s

def replace_questions_mark(prev=None, nxt=None):
	chars = ['a', 'b', 'c']
	if not prev and nxt:
		for i in range(len(chars)):
			if chars[i] != nxt:
				return chars[i]
	elif prev and nxt:
		for i in range(len(chars)):
			if chars[i] != prev and chars[i] != nxt:
				return chars[i]
	else:
		for i in range(len(chars)):
			if chars[i] != prev:
				return chars[i]

def main():
	num_of_tests = eval(input())
	for i in range(num_of_tests):
		test = input()
		print(beautify_string(test))
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	s = input().strip()
	s = list(s)
	n = len(s)
	if n == 1:
		if s[0] == '?':
			print('a')
		else:
			print(''.join(s))
		continue

	def check1(a, b):
		for i in 'abc':
			if i != s[b]:
				return i

	def check(a, b, c):
		for i in 'abc':
			if i != s[b] and i != s[c]:
				return i
	for i in range(n):
		if s[i] != '?':
			continue
		if i == 0:
			s[i] = check1(i, i + 1)
		elif i == n - 1:
			s[i] = check1(i, i - 1)
		else:
			s[i] = check(i, i - 1, i + 1)

	def ok(s):
		return all((s[i] != s[i - 1] for i in range(1, n)))
	if ok(s):
		print(''.join(s))
	else:
		print(-1)


def main():
	s = input()
	ans = ''
	for i in range(len(s)):
		if s[i] == '?':
			lr = []
			if i != 0:
				lr.append(s[i - 1])
			if i != len(s) - 1:
				lr.append(s[i + 1])
			if len(ans) != 0:
				lr.append(ans[-1])
			for c in abc:
				if c not in lr:
					ans += c
					break
		elif i == 0:
			if s[i] == s[i + 1]:
				return '-1'
			else:
				ans += s[i]
		elif i == len(s) - 1:
			if s[i] == s[i - 1]:
				return '-1'
			else:
				ans += s[i]
		elif s[i] == s[i - 1] or s[i] == s[i + 1]:
			return '-1'
		else:
			ans += s[i]
	return ans
abc = ['a', 'b', 'c']
t = int(input())
for i in range(t):
	print(main())


lens = int(input())
arr = []
for i in range(lens):
	v = input()
	arr.append(v)
ans = []
trys = ['a', 'b', 'c']
for strs in arr:
	prev = ''
	n = len(strs)
	vt = ''
	for i in range(n):
		if strs[i] != '?':
			vt += strs[i]
			prev = strs[i]
			if i + 1 != n:
				if strs[i] == strs[i + 1]:
					vt = '-1'
					break
		elif i + 1 == n:
			if i == 0:
				vt += 'a'
			else:
				for u in trys:
					if u != prev:
						prev = u
						vt += u
						break
		elif i == 0 and strs[i + 1] != '?':
			for u in trys:
				if u != strs[i + 1]:
					prev = u
					vt += u
					break
		elif i == 0 and strs[i + 1] == '?':
			vt += 'a'
			prev = 'a'
		elif strs[i + 1] == '?':
			for u in trys:
				if u != prev:
					prev = u
					vt += u
					break
		else:
			for u in trys:
				if u != prev and u != strs[i + 1]:
					prev = u
					vt += u
					break
	ans.append(vt)
for i in ans:
	print(i)


def solve(s):
	n = len(s)
	if s[0] == '?':
		if s[1] != 'a':
			s = 'a' + s[1:]
		elif s[1] != 'b':
			s = 'b' + s[1:]
		else:
			s = 'c' + s[1:]
	flag = 0
	for i in range(1, n - 1):
		if s[i] == s[i - 1] and s[i] != '?':
			flag = -1
			break
		if s[i] == '?':
			if s[i - 1] != 'a' and s[i + 1] != 'a':
				s = s[:i] + 'a' + s[i + 1:]
			elif s[i - 1] != 'b' and s[i + 1] != 'b':
				s = s[:i] + 'b' + s[i + 1:]
			else:
				s = s[:i] + 'c' + s[i + 1:]
	if s[n - 1] == s[n - 2]:
		flag = -1
	if s[n - 1] == '?':
		if s[n - 2] != 'a':
			s = s[:n - 1] + 'a'
		elif s[n - 2] != 'b':
			s = s[:n - 1] + 'b'
		else:
			s = s[:n - 1] + 'c'
	if flag == -1:
		return -1
	else:
		return s
for _ in range(int(input())):
	s = input()
	if s == '?':
		print('a')
	else:
		print(solve(s))


def f(a, b):
	s = list('abc')
	for e in s:
		if e not in [a, b]:
			return e
for _ in range(int(input())):
	s = list(input())
	n = len(s)
	if n == 1:
		if s == ['?']:
			print('a')
		else:
			print(''.join(s))
		continue
	ok = True
	s = ['*'] + s + ['*']
	for i in range(1, n + 1):
		if s[i] == '?':
			s[i] = f(s[i - 1], s[i + 1])
	for i in range(1, n + 1):
		ok = ok and s[i - 1] != s[i] and (s[i + 1] != s[i])
	if ok:
		print(''.join(s[1:-1]))
	else:
		print(-1)


n = int(input())
while n > 0:
	s = input()
	l = len(s)
	flag = 1
	for i in range(1, l):
		if s[i] == s[i - 1] and s[i] != '?':
			flag = 0
			break
	if flag:
		last = '?'
		for i in range(l):
			if s[i] != '?':
				last = s[i]
			elif last != 'a' and (i == l - 1 or s[i + 1] != 'a'):
				last = 'a'
			elif last != 'b' and (i == l - 1 or s[i + 1] != 'b'):
				last = 'b'
			else:
				last = 'c'
			print(last, end='')
		print()
	else:
		print(-1)
	n -= 1


def readInput():
	t = int(input())
	strings = [input() for i in range(t)]
	return (t, strings)
solveTree = {'a': {'a': 'b', 'b': 'c', 'c': 'b', '?': 'b'}, 'b': {'a': 'c', 'b': 'a', 'c': 'a', '?': 'a'}, 'c': {'a': 'b', 'b': 'a', 'c': 'a', '?': 'a'}, '?': {'a': 'b', 'b': 'a', 'c': 'a', '?': 'a'}}

def solve(pattern):
	p = pattern
	length = len(pattern)
	if length == 1:
		return 'a' if pattern != 'a' else 'b'
	i = 1
	while i < length:
		if p[i] != '?' and p[i] == p[i - 1]:
			return '-1'
		i += 1
	p = '?' + p + '?'
	i = 1
	solution = '?'
	for i in range(1, len(p) - 1):
		if p[i] == '?':
			solution += solveTree.get(solution[i - 1]).get(p[i + 1])
		else:
			solution += p[i]
		i += 1
	return solution[1:]
(t, strings) = readInput()
for pattern in strings:
	print(solve(pattern))


def beautify(str):
	ln = len(str)
	wrong = False
	for i in range(ln):
		if str[i] == '?':
			add_a = True
			add_b = True
			add_c = True
			if i > 0:
				if str[i - 1] == 'a':
					add_a = False
				if str[i - 1] == 'b':
					add_b = False
				if str[i - 1] == 'c':
					add_c = False
			if i < ln - 1:
				if str[i + 1] == 'a':
					add_a = False
				if str[i + 1] == 'b':
					add_b = False
				if str[i + 1] == 'c':
					add_c = False
			if add_a:
				str[i] = 'a'
			elif add_b:
				str[i] = 'b'
			elif add_c:
				str[i] = 'c'
		elif i < ln - 1:
			if str[i] == str[i + 1]:
				wrong = True
				break
	if wrong:
		print(-1)
	else:
		print(''.join(str))
tc = int(input())
for i in range(tc):
	str = input()
	beautify(list(str))


for i in range(int(input())):
	s = [c for c in input()]
	n = len(s)
	i = 0
	while i < n:
		if s[i] == '?':
			pr = 'd' if i == 0 else s[i - 1]
			nx = 'e' if i + 1 == n else s[i + 1]
			for j in ['a', 'b', 'c']:
				if j != pr and j != nx:
					s[i] = j
					break
		else:
			i += 1
	f = 0
	for i in range(n - 1):
		if s[i] == s[i + 1]:
			f = 1
			print('-1')
			break
	if f == 0:
		print(''.join(s))


name = int(input())
for i in range(name):
	line = input()
	length = len(line)
	changed = True
	for j in range(length):
		if j > 0 and line[j] == line[j - 1] and (line[j] != '?'):
			changed = False
			break
		if line[j] == '?':
			ava = 'abc'
			if j > 0:
				ava = ava.replace(line[j - 1], '')
			if j < length - 1 and line[j + 1] != '?':
				ava = ava.replace(line[j + 1], '')
			line = line[:j] + ava[0] + line[j + 1:]
	if changed:
		print(line)
	else:
		print(-1)


N = int(input())
for s in range(N):
	flag = 0
	st = list(input())
	prev = ''
	if len(st) > 1 and st[0] == '?':
		if st[1] != 'a':
			st[0] = 'a'
		elif st[1] != 'b':
			st[0] = 'b'
		elif st[1] != 'c':
			st[0] = 'c'
	elif len(st) == 1 and st[0] == '?':
		st[0] = 'a'
	if len(st) > 1:
		prev = st[0]
	for i in range(1, len(st) - 1):
		if st[i] == prev:
			flag = 1
		if st[i] == '?':
			if st[i - 1] != 'a' and st[i + 1] != 'a':
				st[i] = 'a'
			elif st[i - 1] != 'b' and st[i + 1] != 'b':
				st[i] = 'b'
			elif st[i - 1] != 'c' and st[i + 1] != 'c':
				st[i] = 'c'
			else:
				flag = 1
		prev = st[i]
	if len(st) > 1 and st[len(st) - 1] == '?':
		if st[len(st) - 2] != 'a':
			st[len(st) - 1] = 'a'
		elif st[len(st) - 2] != 'b':
			st[len(st) - 1] = 'b'
		elif st[len(st) - 2] != 'c':
			st[len(st) - 1] = 'c'
	elif st[len(st) - 1] == prev:
		flag = 1
	if flag == 0:
		print(''.join(st))
	else:
		print(-1)


allowed = 'abc'
for _ in range(int(input())):
	flag = False
	s = list(input())
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			flag = True
			break
	if flag:
		print(-1)
	else:
		if s[0] == '?':
			for elem in allowed:
				if len(s) > 1:
					if elem != s[1]:
						s[0] = elem
						break
				else:
					s[-1] = 'a'
		for i in range(1, len(s) - 1):
			if s[i] == '?':
				for elem in allowed:
					if elem != s[i - 1] and elem != s[i + 1]:
						s[i] = elem
						break
		if s[-1] == '?':
			for elem in allowed:
				if len(s) > 1:
					if elem != s[-2]:
						s[-1] = elem
						break
				else:
					s[-1] = 'a'
		print(''.join(s))


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
t = int(input())
for y in range(t):
	s = list(input())
	n = len(s)
	for i in range(n):
		if s[i] == '?':
			if 0 == n - 1:
				s[i] = 'a'
			elif i == 0:
				if s[i + 1] != 'a':
					s[i] = 'a'
				elif s[i + 1] != 'b':
					s[i] = 'b'
				else:
					s[i] = 'c'
			elif i == n - 1:
				if s[i - 1] != 'a':
					s[i] = 'a'
				elif s[i - 1] != 'b':
					s[i] = 'b'
				else:
					s[i] = 'c'
			elif s[i + 1] != 'a' and s[i - 1] != 'a':
				s[i] = 'a'
			elif s[i + 1] != 'b' and s[i - 1] != 'b':
				s[i] = 'b'
			else:
				s[i] = 'c'
	flag = 0
	for i in range(1, n):
		if s[i] == s[i - 1]:
			flag = 1
			break
	if flag == 1:
		print(-1)
	else:
		print(''.join(s))


lines = int(input())
for i in range(lines):
	my_string = input()
	answer = ''
	impossible = False
	for j in range(len(my_string)):
		if my_string[j] == '?':
			if j == 0:
				if len(my_string) > 1:
					if my_string[1] == 'a':
						answer += 'b'
					else:
						answer += 'a'
				else:
					answer += 'a'
			elif j == len(my_string) - 1:
				if answer[-1] == 'a':
					answer += 'b'
				else:
					answer += 'a'
			elif my_string[j + 1] == '?':
				if answer[j - 1] == 'a':
					answer += 'b'
				else:
					answer += 'a'
			elif my_string[j + 1] == answer[j - 1]:
				if my_string[j + 1] == 'a':
					answer += 'b'
				else:
					answer += 'a'
			elif answer[j - 1] == 'a':
				if my_string[j + 1] == 'b':
					answer += 'c'
				else:
					answer += 'b'
			elif answer[j - 1] == 'b':
				if my_string[j + 1] == 'a':
					answer += 'c'
				else:
					answer += 'a'
			elif my_string[j + 1] == 'a':
				answer += 'b'
			else:
				answer += 'a'
		else:
			answer += my_string[j]
		if j >= 1:
			if answer[j] == answer[j - 1]:
				print(-1)
				impossible = True
				break
	if not impossible:
		print(answer)


chars = ['a', 'b', 'c']
n = int(input())
for i in range(n):
	s = list(input())
	x = s[0]
	if x == '?':
		if len(s) == 1:
			x = 'a'
		else:
			x = 'a'
			if s[1] == x:
				x = 'b'
			if s[1] == x:
				x = 'c'
		s[0] = x
	for j in range(1, len(s) - 1):
		x = s[j]
		if x == '?':
			x = 'a'
			if s[j - 1] == x or s[j + 1] == x:
				x = 'b'
			if s[j - 1] == x or s[j + 1] == x:
				x = 'c'
			s[j] = x
	x = s[-1]
	if x == '?':
		if len(s) == 1:
			x = 'a'
		else:
			x = 'a'
			if s[-2] == x:
				x = 'b'
			if s[-2] == x:
				x = 'c'
		s[-1] = x
	imp = False
	for j in range(1, len(s)):
		if s[j] == s[j - 1]:
			imp = True
	if imp:
		print(-1)
	else:
		print(''.join(s))


import sys
LETTERS = 'abc'

def solve(s: str):
	n = len(s)
	a = list(s)
	for i in range(n):
		if i + 1 < n and a[i] == a[i + 1] and (a[i] != '?'):
			print(-1)
			return
		if a[i] == '?':
			for l in LETTERS:
				if i > 0 and a[i - 1] == l:
					continue
				if i + 1 < n and a[i + 1] == l:
					continue
				a[i] = l
				break
	print(''.join(a))
t = int(input())
for i in range(t):
	line = input()
	solve(line)


for _ in range(int(input())):
	s = str(input())
	ans = ''
	value = 0
	for i in range(len(s)):
		if s[i] == '?':
			lr = []
			if i != 0:
				lr.append(s[i - 1])
			if i != len(s) - 1:
				lr.append(s[i + 1])
			if len(ans) != 0:
				lr.append(ans[-1])
			for c in ['a', 'b', 'c']:
				if c not in lr:
					ans += c
					break
		elif i == 0:
			if s[i] == s[i + 1]:
				value = -1
			else:
				ans += s[i]
		elif i == len(s) - 1:
			if s[i] == s[i - 1]:
				value = -1
			else:
				ans += s[i]
		elif s[i] == s[i - 1] or s[i] == s[i + 1]:
			value = -1
		else:
			ans += s[i]
	if value == 0:
		print(ans)
	else:
		print(-1)


def solve():
	string = list(input())
	string = ['x'] + string + ['x']
	i = -1
	word = ''
	for letter in string:
		i += 1
		if letter in ['a', 'b', 'c'] and letter == string[i - 1]:
			print(-1)
			return
		if letter == '?':
			for y in ['a', 'b', 'c']:
				if string[i - 1] != y and string[i + 1] != y:
					string[i] = y
					break
	for letter in string[1:-1]:
		word += letter
	print(word)

def main():
	for case in range(int(input())):
		solve()
main()


def f(s):
	for i in range(len(s) - 1):
		if s[i] != '?' and s[i] == s[i + 1]:
			return '-1'
	L = ['a', 'b', 'c']
	Ls = ['x'] + list(s) + ['x']
	for j in range(1, len(Ls) - 1):
		if Ls[j] == '?':
			if Ls[j - 1] != '?':
				if Ls[j - 1] in L:
					L.remove(Ls[j - 1])
			if Ls[j + 1] != '?':
				if Ls[j + 1] in L:
					L.remove(Ls[j + 1])
			if len(L) == 0:
				return '-1'
			else:
				Ls[j] = L[0]
				L = ['a', 'b', 'c']
	return ''.join(Ls[1:-1])
n = int(input().strip())
for i in range(n):
	s = input().strip()
	print(f(s))


for _ in range(int(input())):
	s = list(input())
	if len(s) == 1:
		print('a')
		continue
	if s[0] == '?':
		s[0] = 'a' if s[1] != 'a' else 'b'
	f = True
	for (i, c) in enumerate(s[1:-1]):
		if c == '?':
			if s[i] != 'a' and s[i + 2] != 'a':
				s[i + 1] = 'a'
			elif s[i] != 'b' and s[i + 2] != 'b':
				s[i + 1] = 'b'
			elif s[i] != 'c' and s[i + 2] != 'c':
				s[i + 1] = 'c'
			else:
				f = False
				break
		elif c == s[i] or c == s[i + 2]:
			f = False
			break
	if not f:
		print(-1)
		continue
	if s[-1] == '?':
		s[-1] = 'a' if s[-2] != 'a' else 'b'
	print(*s, sep='')


a = int(input())
c = []
b1 = [0]
c1 = []
b2 = [0]
for i in range(0, a):
	b = str(input())
	b1.append(len(b))
	b2.append(b2[i] + len(b))
	c = c + list(b)
for k in range(a):
	c1.clear()
	c1.append('1')
	for z in range(b2[k], b2[k + 1]):
		c1.append(c[z])
	c1.append('1')
	for n in range(1, b1[k + 1] + 1):
		d = ['a', 'b', 'c']
		if c1[n] == c1[n + 1] and c1[n] != '?':
			c1 = [0, -1, 0]
			break
		elif c1[n] == '?':
			if c1[n + 1] in d:
				d.remove(c1[n + 1])
			if c1[n - 1] in d:
				d.remove(c1[n - 1])
			d.sort()
			c1[n] = d[0]
	c1.pop(0)
	c1.pop(len(c1) - 1)
	kk = 0
	for i in range(len(c1)):
		if kk == 0:
			print(end='\n')
		kk = +1
		print(c1[i], end='')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
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 list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

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

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

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

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

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

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		s = S()
		n = len(s)
		r = []
		ok = True
		for i in range(n):
			if s[i] != '?':
				if i > 0 and s[i] == s[i - 1] or (i < n - 1 and s[i] == s[i + 1]):
					ok = False
					break
				r.append(s[i])
			else:
				t = set()
				if i > 0:
					t.add(r[-1])
				if i < n - 1:
					t.add(s[i + 1])
				for k in 'abc':
					if k not in t:
						r.append(k)
						break
		rr.append(IF(ok, JA(r, ''), -1))
	return JA(rr, '\n')
print(main())


def choose(toAvoid):
	possible = ['a', 'b', 'c']
	for a in possible:
		if a not in toAvoid:
			return a
	return None
q = int(input())
for _ in range(q):
	s = input()
	ok = 1
	for k in range(len(s) - 1):
		if s[k] == s[k + 1] and s[k] != '?':
			ok = 0
			break
	if ok:
		res = []
		for k in range(len(s)):
			if s[k] != '?':
				res.append(s[k])
			else:
				toAvoid = ['', '']
				if k != 0:
					toAvoid[0] = res[k - 1]
				if k != len(s) - 1 and s[k + 1] != '?':
					toAvoid[1] = s[k + 1]
				res.append(choose(toAvoid))
		print(''.join(res))
	else:
		print(-1)


import sys

def I():
	return sys.stdin.readline().rstrip()
for _ in range(int(I())):
	s = I()
	l = []
	last = 0
	for i in range(len(s)):
		nxt = s[i + 1] if i < len(s) - 1 else 0
		if s[i] == '?':
			for c in 'abc':
				if c != last and c != nxt:
					l.append(c)
					last = c
					break
		else:
			if s[i] == nxt:
				print(-1)
				break
			l.append(s[i])
			last = s[i]
	else:
		print(''.join(l))


t = int(input())
while t > 0:
	t -= 1
	s = list(input())
	no = 0
	for i in range(len(s)):
		if s[i] == '?':
			s[i] = 'a'
			ok = 1
			if i >= 1 and s[i - 1] == 'a':
				ok = 0
			if i < len(s) - 1 and s[i + 1] == 'a':
				ok = 0
			if ok:
				continue
			s[i] = 'b'
			ok = 1
			if i >= 1 and s[i - 1] == 'b':
				ok = 0
			if i < len(s) - 1 and s[i + 1] == 'b':
				ok = 0
			if ok:
				continue
			s[i] = 'c'
			ok = 1
			if i >= 1 and s[i - 1] == 'c':
				ok = 0
			if i < len(s) - 1 and s[i + 1] == 'c':
				ok = 0
			if ok:
				continue
			no = 1
	for i in range(len(s)):
		if i < len(s) - 1:
			if s[i + 1] == s[i]:
				no = 1
	if no:
		print(-1)
	else:
		print(''.join(s))


def main():
	num = int(input())
	lists = []
	newList = []
	for i in range(num):
		lists.append(str(input()))
	for i in range(len(lists)):
		string = ''
		for j in range(len(lists[i])):
			if '?' == lists[i][j]:
				if j == 0 and len(lists[i]) == 1:
					string += 'a'
				elif j == 0 and len(lists[i]) > 1:
					if lists[i][j + 1] in 'bc?':
						string += 'a'
					elif lists[i][j + 1] in 'ac?':
						string += 'b'
					else:
						print('hey')
						string += 'c'
				elif j == len(lists[i]) - 1:
					if string[-1] in 'bc?':
						string += 'a'
					elif string[-1] in 'ac?':
						string += 'b'
					else:
						string += 'c'
				elif string[-1] in 'bc?' and lists[i][j + 1] in 'bc?':
					string += 'a'
				elif string[-1] in 'ac?' and lists[i][j + 1] in 'ac?':
					string += 'b'
				else:
					string += 'c'
			elif lists[i][j] != 'j':
				string += lists[i][j]
		newList.append(string)
	for list in newList:
		nn = False
		for j in range(len(list) - 1):
			if list[j] == list[j + 1]:
				nn = True
		if nn == True:
			print('-1')
		else:
			print(list)
main()


n = int(input())
c = ['a', 'b', 'c']
for k in range(n):
	s = str(input())
	a = []
	if len(s) == 1:
		if s[0] != '?':
			print(s)
		else:
			print('a')
	else:
		for i in range(len(s)):
			if s[i] != '?':
				a.append(s[i])
			elif len(s) - 1 > i > 0:
				for j in range(3):
					if c[j] != a[i - 1] and c[j] != s[i + 1]:
						a.append(c[j])
						break
			elif i == 0:
				for j in range(3):
					if c[j] != s[i + 1]:
						a.append(c[j])
						break
			elif i == len(s) - 1:
				for j in range(3):
					if c[j] != a[i - 1]:
						a.append(c[j])
						break
		flag = True
		ans = ''.join(a)
		if len(s) == 2:
			if a[0] != a[1]:
				print(ans)
			else:
				print(-1)
		elif len(s) >= 3:
			for i in range(1, len(a) - 1):
				if a[i - 1] == a[i] or a[i + 1] == a[i]:
					flag = False
			if flag:
				print(ans)
			else:
				print(-1)


n = int(input())
alist = ['a', 'b', 'c']
for i in range(n):
	s = input()
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
	else:
		s = list(s)
		if len(s) == 1:
			if s != ['?']:
				print(''.join(s))
			else:
				print('a')
		else:
			for k in range(len(s)):
				if s[k] == '?':
					if k == 0:
						for i in alist:
							if i != s[1]:
								s[0] = i
								break
					elif k == len(s) - 1:
						for i in alist:
							if i != s[len(s) - 2]:
								s[len(s) - 1] = i
								break
					else:
						for i in alist:
							if i not in [s[k - 1], s[k + 1]]:
								s[k] = i
								break
			print(''.join(s))


abc = ['a', 'b', 'c']
t = int(input())
for i in range(t):
	s = list(input())
	s_len = len(s)
	for j in range(s_len):
		k = 0
		if s[j] == '?':
			for k in range(3):
				if (j == s_len - 1 or s[j + 1] != abc[k]) and (j == 0 or s[j - 1] != abc[k]):
					s[j] = abc[k]
					break
		elif j != s_len - 1 and s[j] == s[j + 1]:
			s = ['-1']
			break
	s = ''.join(s)
	print(s)


class Solution(object):

	def beautiful_string(self, s: str) -> str:
		s = [c for c in s]
		(i, n) = (0, len(s))
		while i < n:
			if s[i] == '?':
				prv = 'd' if i == 0 else s[i - 1]
				nxt = 'e' if i + 1 >= n else s[i + 1]
				for x in ['a', 'b', 'c']:
					if x != prv and x != nxt:
						s[i] = x
						break
			else:
				i += 1
		ok = True
		for i in range(n - 1):
			if s[i] == s[i + 1]:
				return '-1'
		if ok == True:
			return ''.join(s)
T = int(input())
for tc in range(T):
	print(Solution().beautiful_string(input()))


test = int(input())
for i in range(test):
	arr = list(input())
	n = len(arr)
	i = 0
	while i < n:
		if arr[i] == '?':
			prev = 'd' if i == 0 else arr[i - 1]
			nextt = 'e' if i == n - 1 else arr[i + 1]
			for x in ['a', 'b', 'c']:
				if x != prev and x != nextt:
					arr[i] = x
					break
		else:
			i += 1
	ok = True
	for i in range(n - 1):
		if arr[i] == arr[i + 1] and arr[i] != '?':
			ok = False
			print('-1')
			break
	if ok == True:
		print(''.join(arr))


x = int(input())
lol = ['a', 'b', 'c']
for __ in range(x):
	a = list(input())
	for i in range(len(a)):
		if a[i] == '?':
			if len(a) == 1:
				a[0] = 'a'
				break
			for j in range(3):
				if i == 0:
					if a[i + 1] != lol[j]:
						a[i] = lol[j]
						break
				if i == len(a) - 1:
					if a[i - 1] != lol[j]:
						a[i] = lol[j]
						break
				elif a[i - 1] != lol[j] and a[i + 1] != lol[j]:
					a[i] = lol[j]
					break
	f = 0
	for i in range(len(a) - 1):
		if a[i] == a[i + 1]:
			f = 1
			break
	if f == 0:
		print(''.join(a))
	else:
		print(-1)


for _ in range(int(input())):
	X = ['a', 'b', 'c']
	L = list(input())
	N = len(L)
	FLAG = 0
	if N == 1:
		if L[0] != '?':
			print(''.join(L))
		else:
			print('a')
	else:
		if L[0] == '?':
			for j in X:
				if j != L[1]:
					L[0] = j
					break
		for i in range(1, N - 1):
			if L[i] == L[i - 1]:
				FLAG = 1
				break
			if L[i] == '?':
				for j in X:
					if j != L[i + 1] and j != L[i - 1]:
						L[i] = j
						break
		if L[N - 2] == L[N - 1]:
			FLAG = 1
		if L[N - 1] == '?':
			for j in X:
				if j != L[N - 2]:
					L[N - 1] = j
					break
		if FLAG == 0:
			print(''.join(L))
		else:
			print('-1')


ch = ['a', 'b', 'c']
t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	S = []
	for i in range(0, len(s)):
		S.append(s[i])
	for i in range(0, len(s)):
		if s[i] == '?':
			pr = ''
			nx = ''
			if i - 1 >= 0:
				pr = S[i - 1]
			if i + 1 < n:
				nx = S[i + 1]
			for j in ch:
				if j != pr and j != nx:
					S[i] = j
					break
	flag = 0
	for i in range(0, len(S) - 1):
		if S[i] == S[i + 1]:
			flag = 1
			break
	if flag == 1:
		print(-1)
	else:
		ans = ''.join(S)
		print(ans)


t = int(input())
for t1 in range(t):
	s = [c for c in input()]
	n = len(s)
	ansprinted = False
	for i in range(0, n - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print('-1')
			ansprinted = True
			break
	if ansprinted:
		continue
	for i in range(0, n):
		if s[i] == '?':
			if i == 0:
				a = 'd'
			else:
				a = s[i - 1]
			if i == n - 1:
				b = 'e'
			else:
				b = s[i + 1]
			for x in ['a', 'b', 'c']:
				if x != a and x != b:
					s[i] = x
					break
	print(''.join(s))


def solve():
	t = int(input())
	al = ['a', 'b', 'c']
	for i in range(t):
		s = [s for s in input()]
		u = True
		for j in range(len(s)):
			if s[j] == '?':
				for c in al:
					if j == 0:
						if j == len(s) - 1:
							s[j] = c
							break
						elif s[j + 1] != c and j < len(s) - 1:
							s[j] = c
							break
					elif j < len(s) - 1:
						if s[j - 1] != c and s[j + 1] != c:
							s[j] = c
							break
					elif j == len(s) - 1:
						if s[j - 1] != c:
							s[j] = c
							break
				else:
					u = False
			elif j > 0 and s[j - 1] == s[j]:
				u = False
		if u:
			print(*s, sep='')
		else:
			print(-1)
solve()


def solve():
	s = input()
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
		return
	syms = s + '@'
	ans = ['@']
	for (i, sym) in enumerate(s):
		if sym != '?':
			ans.append(sym)
			continue
		for x in 'abc':
			if x != ans[-1] and x != syms[i + 1]:
				ans.append(x)
				break
	print(''.join(ans[1:]))
for _ in range(int(input())):
	solve()


for i in range(int(input())):
	s = list(input())
	s.append('#')
	s.insert(0, '#')
	k = 1
	for j in range(1, len(s) - 1):
		if s[j] != '?' and s[j] == s[j - 1]:
			k = 0
			break
		if s[j] == '?':
			s[j] = 'a'
			if s[j] == s[j - 1] or s[j] == s[j + 1]:
				s[j] = 'b'
				if s[j] == s[j - 1] or s[j] == s[j + 1]:
					s[j] = 'c'
	if k == 1:
		for j in range(1, len(s) - 1):
			print(s[j], end='')
		print()
	else:
		print('-1')


def es_hermosa(cadena):
	for i in range(len(cadena)):
		if i + 1 != len(cadena):
			if cadena[i] == cadena[i + 1] and cadena[i] != '?' and (cadena[i + 1] != '?'):
				return -1
	return True

def resolver(cadena):
	cadena = list(cadena)
	if es_hermosa(cadena) == -1:
		return -1
	for i in range(len(cadena)):
		if i - 1 >= 0:
			anterior = cadena[i - 1]
		else:
			anterior = ''
		if i + 1 <= len(cadena) - 1:
			proximo = cadena[i + 1]
		else:
			proximo = ''
		reemplazo = ''
		if cadena[i] == '?':
			if proximo != '?':
				if proximo != 'a' and anterior != 'a':
					reemplazo = 'a'
				elif proximo != 'b' and anterior != 'b':
					reemplazo = 'b'
				elif proximo != 'c' and anterior != 'c':
					reemplazo = 'c'
			elif proximo != 'a' and anterior != 'a':
				reemplazo = 'a'
			elif proximo != 'b' and anterior != 'b':
				reemplazo = 'b'
			elif proximo != 'c' and anterior != 'c':
				reemplazo = 'c'
		cadena[i] = cadena[i].replace('?', reemplazo)
	if es_hermosa(cadena) == -1:
		return -1
	else:
		return ''.join(cadena)
t = int(input())
for caso in range(1, t + 1):
	cadena = input()
	solucion = resolver(cadena)
	print('{}'.format(solucion))


def f(l):
	for i in range(len(l)):
		s = list('abc')
		if l[i] == '?':
			if i == 0 and len(l) == 1:
				return 'a'
			elif i == 0:
				if l[1] in s:
					s.remove(l[1])
				l[i] = s[0]
			elif i == len(l) - 1:
				if l[-2] in s:
					s.remove(l[-2])
				l[i] = s[0]
			else:
				if l[i - 1] in s:
					s.remove(l[i - 1])
				if l[i + 1] in s:
					s.remove(l[i + 1])
				l[i] = s[0]
	return ''.join(l)
for i in range(int(input())):
	s = input()
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
	else:
		print(f(list(s)))


def compareItem02(el0, el2):
	for el1 in ['a', 'b', 'c']:
		if el0 != el1 and el2 != el1:
			return el1
	return False

def compareItem2(el2):
	for el1 in ['a', 'b', 'c']:
		if el2 != el1:
			return el1
	return False

def compareItem0(el0):
	for el1 in ['a', 'b', 'c']:
		if el0 != el1:
			return el1
	return False

def analyzItem(item):
	item = [i for i in item]
	if item[0] == '?':
		if 1 == len(item):
			return 'a'
		else:
			newValue = compareItem2(item[1])
		if not newValue:
			return '-1'
		item[0] = newValue
	elif len(item) > 1 and item[0] == item[1]:
		return '-1'
	for j in range(1, len(item)):
		if item[j] == '?':
			if j + 1 == len(item):
				newValue = compareItem0(item[j - 1])
			else:
				newValue = compareItem02(item[j - 1], item[j + 1])
			if not newValue:
				return '-1'
			item[j] = newValue
		elif j + 1 < len(item) and item[j] == item[j + 1]:
			return '-1'
	return ''.join(item)
num = int(input())
masStr = (analyzItem(input()) for i in range(num))
print('\n'.join(masStr))


t = int(input())
for _ in range(t):
	s = [c for c in input()]
	n = len(s)
	for i in range(n):
		if s[i] == '?':
			p = 'muha' if i == 0 else s[i - 1]
			ne = 'gay' if i == n - 1 else s[i + 1]
			for x in 'abc':
				if x != p and x != ne:
					s[i] = x
					break
	q = 1
	o = ''
	for i in range(n - 1):
		o += s[i]
		if s[i] == s[i + 1]:
			q = 0
			break
	o += s[n - 1]
	if q:
		print(o)
	else:
		print(-1)


t = int(input())
for _ in range(t):
	s = list(input())
	n = len(s)
	for i in range(n):
		if s[i] != '?':
			continue
		x = 'a'
		if i > 0 and s[i - 1] == x:
			x = 'b'
		if i + 1 < n and s[i + 1] == x:
			x = 'b'
		if i > 0 and s[i - 1] == x:
			x = 'c'
		if i + 1 < n and s[i + 1] == x:
			x = 'c'
		s[i] = x
	bad = 0
	for i in range(1, n):
		if s[i] == s[i - 1]:
			bad = 1
	if bad:
		print(-1)
	else:
		print(''.join(s))


t = int(input())
ans = []
for i in range(t):
	a = list(input())
	STR = ''
	error = 0
	if a[0] == '?' and len(a) == 1:
		STR += 'a'
	else:
		for i in range(len(a)):
			if a[i] != '?':
				STR += a[i]
			elif a[i] == '?' and i == 0:
				if a[i + 1] == 'a':
					STR += 'b'
					a[i] = 'b'
				elif a[i + 1] == 'b':
					STR += 'a'
					a[i] = 'a'
				elif a[i + 1] == 'c':
					STR += 'a'
					a[i] = 'a'
				elif a[i + 1] == '?':
					STR += 'a'
					a[i] = 'a'
			elif a[i] == '?' and i < len(a) - 1:
				if a[i - 1] == a[i + 1]:
					if a[i - 1] == 'a':
						STR += 'b'
						a[i] = 'b'
					elif a[i - 1] == 'c' or a[i - 1] == 'b':
						STR += 'a'
						a[i] = 'a'
				elif a[i - 1] != a[i + 1]:
					if a[i - 1] == 'a' and a[i + 1] == 'b' or (a[i - 1] == 'b' and a[i + 1] == 'a'):
						STR += 'c'
						a[i] = 'c'
					elif a[i - 1] == 'a' and a[i + 1] == 'c' or (a[i - 1] == 'c' and a[i + 1] == 'a'):
						STR += 'b'
						a[i] = 'b'
					elif a[i - 1] == 'b' and a[i + 1] == 'c' or (a[i - 1] == 'c' and a[i + 1] == 'b'):
						STR += 'a'
						a[i] = 'a'
					elif a[i - 1] == 'a':
						STR += 'b'
						a[i] = 'b'
					else:
						STR += 'a'
						a[i] = 'a'
				else:
					STR += a[i]
			elif a[i] == '?' and i == len(a) - 1:
				if a[i - 1] == 'a':
					STR += 'b'
					a[i - 1] = 'b'
				else:
					STR += 'a'
					a[i - 1] = 'a'
			else:
				STR += a[i]
			if i > 0:
				if STR[i] == STR[i - 1]:
					ans.append('-1')
					error += 1
					break
	if len(STR) == len(a) and error == 0:
		ans.append(STR)
for i in range(t - (t - len(ans))):
	print(ans[i])


for _ in range(int(input())):
	s = ['-'] + list(input()) + ['-']
	p = True
	for i in range(1, len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print(-1)
			p = False
			break
		elif s[i] == '?':
			s[i] = 'abc'.replace(s[i + 1], '').replace(s[i - 1], '')[0]
	if p:
		print(''.join(s[1:][:-1]))


from itertools import combinations
import sys
input = sys.stdin.readline
n = int(input())
for i in range(n):
	s = input().rstrip()
	ans = []
	ans.append('#')
	for ch in s:
		ans.append(ch)
	ans.append('#')
	ok = True
	for i in range(1, len(ans) - 1):
		if ans[i] == ans[i + 1] and ans[i] != '?':
			ok = False
			break
		if ans[i] != '?':
			continue
		if 'a' not in ans[i - 1] + ans[i + 1]:
			ans[i] = 'a'
		elif 'b' not in ans[i - 1] + ans[i + 1]:
			ans[i] = 'b'
		elif 'c' not in ans[i - 1] + ans[i + 1]:
			ans[i] = 'c'
	if ok:
		print(''.join([item for item in ans[1:-1]]))
	else:
		print(-1)


t = int(input())
while t > 0:
	s = list(input())
	for i in range(len(s)):
		if len(s) == 1 and s[i] == '?':
			s[i] = 'a'
		elif i == 0 and s[i] == '?':
			if s[i + 1] != 'a':
				s[i] = 'a'
			elif s[i + 1] != 'b':
				s[i] = 'b'
			else:
				s[i] = 'c'
		if i == len(s) - 1 and s[i] == '?':
			if s[i - 1] != 'a':
				s[i] = 'a'
			elif s[i - 1] != 'b':
				s[i] = 'b'
			else:
				s[i] = 'c'
		elif s[i] == '?':
			if s[i + 1] != 'a' and s[i - 1] != 'a':
				s[i] = 'a'
			elif s[i + 1] != 'b' and s[i - 1] != 'b':
				s[i] = 'b'
			else:
				s[i] = 'c'
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			print('-1')
			break
	else:
		print(''.join(s))
	t -= 1


T = int(input())

def get(i, l, x):
	X = [0, 0, 0]
	if i > 0:
		X[ord(l[i - 1]) - 97] = 1
	if i < x - 1 and l[i + 1] != '?':
		X[ord(l[i + 1]) - 97] = 1
	for i in range(3):
		if X[i] == 0:
			return chr(i + 97)
for _ in range(T):
	s = input()
	flag = 0
	for i in range(1, len(s)):
		if s[i] != '?':
			if s[i - 1] == s[i]:
				flag = 1
				break
	if flag == 1:
		print(-1)
		continue
	l = []
	for i in s:
		l.append(i)
	x = len(s)
	for i in range(x):
		if s[i] == '?':
			l[i] = get(i, l, x)
	for i in l:
		print(i, end='')
	print()


def isBeautiful(word):
	for x in range(0, len(word) - 1):
		if word[x] == word[x + 1]:
			return False
	return True

def fillGaps(word):
	mylist = list(word)
	for index in range(0, len(word)):
		if index == len(word) - 1:
			if word[index] == '?':
				mylist[index] = getChar(mylist[index - 1], mylist[index - 1])
		elif index == 0:
			if word[index] == '?':
				mylist[index] = getChar(mylist[index + 1], mylist[index + 1])
		elif word[index] == '?':
			mylist[index] = getChar(mylist[index - 1], mylist[index + 1])
	return mylist

def getChar(a, b):
	mychars = ['a', 'b', 'c']
	given = list(set((a, b)))
	for char in mychars:
		if char not in given:
			return char
	return '#'
num_test = int(input())
for x in range(0, num_test):
	word = input()
	output = fillGaps(word)
	if '#' in output or not isBeautiful(output):
		print('-1')
	else:
		for char in output:
			print(char, end='')
		print('')


from sys import stdin
input = stdin.readline
n = int(input())
can = ['a', 'b', 'c']
for i in range(n):
	s = list(map(str, input().split()))[0]
	s = list(s)
	pre = 0
	flag = 0
	for j in range(len(s)):
		if s[j] == '?':
			for x in can:
				if j and x == s[j - 1] or (j + 1 < len(s) and x == s[j + 1]):
					continue
				s[j] = x
				break
		if j and s[j] == s[j - 1]:
			flag = 1
			break
	if flag:
		print(-1)
	else:
		print(''.join(s))


for _ in range(int(input())):
	s = input().rstrip('\n')
	a = [i for i in s]
	if a[0] == '?':
		if len(a) != 1:
			if a[1] != 'a':
				a[0] = 'a'
			elif a[1] != 'b':
				a[0] = 'b'
			else:
				a[0] = 'c'
		else:
			a[0] = 'a'
	for i in range(1, len(a) - 1):
		if a[i] == '?':
			if a[i - 1] != 'a' and a[i + 1] != 'a':
				a[i] = 'a'
			elif a[i - 1] != 'b' and a[i + 1] != 'b':
				a[i] = 'b'
			else:
				a[i] = 'c'
	if a[-1] == '?':
		if a[-2] != 'a':
			a[-1] = 'a'
		elif a[-2] != 'b':
			a[-1] = 'b'
		else:
			a[-1] = 'c'
	f = False
	for i in range(1, len(a)):
		if a[i] == a[i - 1]:
			f = True
	if f:
		print(-1)
	else:
		for i in a:
			print(i, end='')
		print()


t = int(input().strip())
while t:
	ans = 0
	s = list(input().strip())
	for i in range(len(s)):
		bit = 0
		if s[i] == '?':
			if i - 1 >= 0 and s[i - 1] >= 'a' and (s[i - 1] <= 'c'):
				bit |= 1 << ord(s[i - 1]) - 97
			if i + 1 < len(s) and s[i + 1] >= 'a' and (s[i + 1] <= 'c'):
				bit |= 1 << ord(s[i + 1]) - 97
			for j in range(3):
				if bit & 1 << j == 0:
					s[i] = chr(97 + j)
					break
		elif i + 1 < len(s) and s[i] == s[i + 1]:
			ans = -1
			break
	if ans == -1:
		print(ans)
	else:
		print(''.join(s))
	t -= 1


for _ in range(int(input())):
	l = ['a', 'b', 'c']
	s = list(input())
	f = 0
	for i in range(len(s)):
		k = 0
		if s[i] == '?':
			while 1:
				s[i] = l[k]
				if len(s) == 1:
					break
				elif i == 0:
					if s[i] != s[i + 1]:
						break
				elif i == len(s) - 1:
					if s[i] != s[i - 1]:
						break
				elif s[i] != s[i + 1] and s[i] != s[i - 1]:
					break
				k = (k + 1) % 3
		elif i == len(s) - 1:
			if s[i] == s[i - 1]:
				f = 1
				break
		elif i == 0:
			if s[i] == s[i + 1]:
				f = 1
				break
		elif s[i] == s[i + 1] or s[i] == s[i - 1]:
			f = 1
			break
	print(''.join(s)) if f == 0 else print(-1)


import sys
input = sys.stdin.readline
Q = int(input())
Query = [input().rstrip() for _ in range(Q)]
for S in Query:
	L = len(S)
	ans = []
	ok = True
	pre = '?'
	for i in range(L - 1):
		if S[i] == '?':
			for t in 'abc':
				if t != pre and t != S[i + 1]:
					ans.append(t)
					pre = t
					break
		elif S[i] == S[i + 1]:
			ok = False
			break
		else:
			pre = S[i]
			ans.append(S[i])
	if S[-1] == '?':
		for t in 'abc':
			if t != pre:
				ans.append(t)
				break
	else:
		ans.append(S[-1])
	if ok:
		print(''.join(ans))
	else:
		print(-1)


def correct(string):
	if 'aa' in string or 'bb' in string or 'cc' in string:
		return -1
	listed = list(string)
	for i in range(len(listed)):
		if listed[i] == '?':
			loc = i
			choices = ['a', 'b', 'c', '?', '?', 'a', 'b', 'c']
			if loc > 0:
				choices.remove(listed[loc - 1])
			if loc < len(listed) - 1:
				choices.remove(listed[loc + 1])
			listed[loc] = choices[0]
	return ''.join(listed)
rounds = int(input())
for i in range(rounds):
	string = input()
	print(correct(string))


chars = ['a', 'b', 'c']
ll = None

def findNext(c1, c2):
	global chars
	for i in range(3):
		if chars[i] != c1 and chars[i] != c2:
			return chars[i]

def changeL(i):
	global ll
	if i == 0:
		if len(ll) > 1:
			ll[i] = findNext('z', ll[1])
		else:
			ll[i] = 'a'
	elif i == len(ll) - 1:
		ll[i] = findNext('z', ll[-2])
	else:
		ll[i] = findNext(ll[i - 1], ll[i + 1])
for _ in range(int(input())):
	ll = list(input())
	for i in range(len(ll)):
		c = ll[i]
		if c == '?':
			changeL(i)
	fail = False
	for i in range(len(ll) - 1):
		if ll[i] == ll[i + 1]:
			fail = True
			break
	if fail:
		print(-1)
	else:
		print(''.join(ll))


from sys import stdin, stdout
n1 = int(stdin.readline().strip())
for i in range(n1):
	s = list(stdin.readline().strip())
	ans = ''
	arr = ['a', 'b', 'c']
	n = len(s)
	for j in range(len(s)):
		if s[j] == '?':
			for k in arr:
				if (j > 0 and k != s[j - 1] or j == 0) and (j < n - 1 and k != s[j + 1] or j == n - 1):
					s[j] = k
					ans += k
					break
		else:
			ans += s[j]
	flag = True
	for j in range(1, len(s)):
		if s[j] == s[j - 1]:
			flag = False
			break
	if flag:
		stdout.write('%s\n' % ans)
	else:
		stdout.write('-1\n')


def main():
	string = list(str(input()))
	for i in range(len(string) - 1):
		if string[i] == string[i + 1] and string[i] != '?':
			print(-1)
			return
	arr = ['a', 'b', 'c']
	for i in range(len(string)):
		if string[i] == '?':
			temp1 = '?'
			temp2 = '?'
			if i > 0:
				temp1 = string[i - 1]
			if i < len(string) - 1:
				temp2 = string[i + 1]
			for j in range(3):
				if arr[j] != temp2 and arr[j] != temp1:
					string[i] = arr[j]
					break
	print(''.join(string))

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


for _ in range(int(input())):
	p = list(input())
	n = len(p)
	y = True
	for i in range(n):
		if p[i] == '?':
			prv = 'e' if i == 0 else p[i - 1]
			nxt = 'd' if i + 1 == n else p[i + 1]
			for j in ['a', 'b', 'c']:
				if j != prv and j != nxt:
					p[i] = j
					break
	for i in range(n - 1):
		if p[i] == p[i + 1]:
			print(-1)
			y = False
			break
	if y == True:
		print(*p, sep='')


def re_assign():
	global ch
	ch['a'] = True
	ch['b'] = True
	ch['c'] = True
	ch['?'] = True
	ch['d'] = True

def what_left():
	global ch
	if ch['a']:
		return 'a'
	if ch['b']:
		return 'b'
	if ch['c']:
		return 'c'
ch = {'a': True, 'b': True, 'c': True, '?': True, 'd': True}
n = int(input())
li = []
output = []
for i in range(n):
	li.append(list(input()))
char = 'd'
for s in li:
	char = 'd'
	for i in range(len(s)):
		if s[i] != '?':
			if s[i] == char:
				s[0] = 'N'
				break
			char = s[i]
		else:
			ch[char] = False
			if i < len(s) - 1:
				ch[s[i + 1]] = False
			s[i] = what_left()
			char = s[i]
			re_assign()
for s in li:
	if s[0] == 'N':
		print('-1')
		continue
	print(''.join(s))


for _ in range(int(input())):
	s = input()
	for i in set(s.replace('?', '')):
		if s.count(i + i):
			print(-1)
			break
	else:
		if len(s) == 1:
			ans = 'a' if s[0] == '?' else s[0]
			print(ans)
			continue
		elif s[0] == '?':
			ans = [c for c in 'ab' if c != s[1]][0]
		else:
			ans = s[0]
		for i in range(1, len(s) - 1):
			if s[i] != '?':
				ans += s[i]
			else:
				ans += [c for c in 'abc' if c != ans[i - 1] and c != s[i + 1]][0]
		if s[-1] != '?':
			ans += s[-1]
		else:
			ans += [c for c in 'ab' if c != ans[-1]][0]
		print(ans)
	continue


for i in range(int(input())):
	l = list(input())
	for j in range(len(l) - 1):
		k = 'abc'
		if l[j] == '?':
			if l[j + 1] == '?':
				if j - 1 >= 0:
					k = k.replace(l[j - 1], '')
					l[j] = k[0]
				else:
					l[j] = k[0]
			else:
				k = k.replace(l[j + 1], '')
				if j - 1 >= 0:
					k = k.replace(l[j - 1], '')
					l[j] = k[0]
				else:
					l[j] = k[0]
	k = 'abc'
	if l[-1] == '?':
		if len(l) > 1:
			k = k.replace(l[-2], '')
			l[-1] = k[0]
		else:
			l[-1] = k[0]
	f = 0
	for k in range(len(l) - 1):
		if l[k] == l[k + 1]:
			f = 1
			break
	if f == 1:
		print(-1)
	else:
		print(''.join(l))


t = 1
for i in range(t):
	n = int(input().strip())
	for j in range(n):
		s = '0' + input().strip() + '00'
		it = 3
		fl = True
		result = []
		k1 = s[0]
		k2 = s[1]
		k3 = s[2]
		while fl:
			abc = ['a', 'b', 'c']
			if k1 == k2:
				fl = False
				result = -1
			elif k2 == '?':
				try:
					abc.remove(k1)
				except:
					pass
				try:
					abc.remove(k3)
				except:
					pass
				k2 = abc[0]
				result.append(k2)
				k1 = k2
				k2 = k3
				k3 = s[it]
				it += 1
			else:
				result.append(k2)
				k1 = k2
				k2 = k3
				k3 = s[it]
				it += 1
			if k2 == '0':
				fl = False
		if result == -1:
			print(result)
		else:
			print(''.join(result))


for _ in range(int(input())):
	s = list(input())
	fl = 0
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			fl = 1
	if len(s) == 1:
		if s[0] == '?':
			print('a')
		continue
	if fl:
		print(-1)
		continue
	for i in range(len(s)):
		if s[i] == '?':
			if i == 0:
				if s[i + 1] == 'a':
					s[i] = 'b'
				else:
					s[i] = 'a'
			elif i == len(s) - 1:
				if s[i - 1] == 'a':
					s[i] = 'b'
				else:
					s[i] = 'a'
			elif s[i + 1] == 'a':
				if s[i - 1] == 'b':
					s[i] = 'c'
				else:
					s[i] = 'b'
			elif s[i + 1] == 'b':
				if s[i - 1] == 'a':
					s[i] = 'c'
				else:
					s[i] = 'a'
			elif s[i - 1] == 'a':
				s[i] = 'b'
			else:
				s[i] = 'a'
	print(''.join(s))


t = int(input())
while t:
	t -= 1
	ar = input()
	alpha = ['a', 'b', 'c']
	flag = 0
	if len(ar) == 1:
		if ar[0] == '?':
			print('a')
		else:
			print(ar)
	else:
		for i in range(len(ar)):
			if ar[i] == '?':
				for j in alpha:
					if i == 0:
						if ar[i + 1] != j:
							ar = ar[:i] + j + ar[i + 1:]
							break
					elif i == len(ar) - 1 and i != 0:
						if ar[i - 1] != j:
							ar = ar[:i] + j + ar[i + 1:]
							break
					elif ar[i - 1] != j and ar[i + 1] != j:
						ar = ar[:i] + j + ar[i + 1:]
						break
		for i in range(len(ar) - 1):
			if ar[i] == ar[i + 1]:
				flag = 1
		if '?' in ar or flag == 1:
			print(-1)
		else:
			print(ar)


def test_if_is_beautiful(s):
	for i in range(len(s)):
		if i + 1 != len(s):
			if s[i] == s[i + 1] and s[i] != '?' and (s[i + 1] != '?'):
				return -1
	return True

def solve(s):
	s = list(s)
	if test_if_is_beautiful(s) == -1:
		return -1
	for i in range(len(s)):
		p = s[i - 1] if i - 1 >= 0 else ''
		n = s[i + 1] if i + 1 <= len(s) - 1 else ''
		c = ''
		if s[i] == '?':
			if n != '?':
				if n != 'a' and p != 'a':
					c = 'a'
				elif n != 'b' and p != 'b':
					c = 'b'
				elif n != 'c' and p != 'c':
					c = 'c'
			elif n != 'a' and p != 'a':
				c = 'a'
			elif n != 'b' and p != 'b':
				c = 'b'
			elif n != 'c' and p != 'c':
				c = 'c'
		s[i] = s[i].replace('?', c)
	if test_if_is_beautiful(s) == -1:
		return -1
	return ''.join(s)
t = int(input())
for case in range(1, t + 1):
	s = input()
	solution = solve(s)
	print('{}'.format(solution))


n = int(input())
p = ['a', 'b', 'c']
for kl in range(n):
	s = input()
	s = 'w' + s + 'w'
	b = ''
	t = 0
	s1 = ''
	if 'aa' in s:
		t = -1
	elif 'bb' in s:
		t = -1
	elif 'cc' in s:
		t = -1
	if t == -1:
		print(t)
	else:
		if len(s) == 1:
			if s == '?':
				s = 'a'
		else:
			for i in range(len(s)):
				if s[i] == '?':
					for h in range(3):
						if p[h] != s[i - 1] and p[h] != s[i + 1]:
							s = s[:i] + p[h] + s[i + 1:]
							break
		print(s[1:len(s) - 1])


t = int(input())
for g in range(0, t):
	s = input()
	a = []
	for i in range(0, len(s)):
		a.append(s[i])
	if len(s) == 1:
		print('a')
	else:
		for i in range(0, len(s)):
			if a[i] == '?':
				if i == 0:
					if a[i + 1] == 'a':
						a[i] = 'b'
					else:
						a[i] = 'a'
				elif i == len(s) - 1:
					if a[i - 1] == 'a':
						a[i] = 'b'
					else:
						a[i] = 'a'
				elif a[i - 1] == 'a' or a[i + 1] == 'a':
					if a[i - 1] == 'b' or a[i + 1] == 'b':
						a[i] = 'c'
					else:
						a[i] = 'b'
				else:
					a[i] = 'a'
		ans = 1
		for i in range(0, len(s) - 1):
			if a[i] == a[i + 1]:
				ans = 0
				break
		if ans == 0:
			print(-1)
		else:
			for i in range(0, len(s)):
				print(a[i], end='')
			print('')


for t in range(int(input())):
	s = [c for c in input()]
	n = len(s)
	for i in range(n):
		if s[i] == '?':
			p = 'd' if i == 0 else s[i - 1]
			nx = 'e' if i == n - 1 else s[i + 1]
			for j in ['a', 'b', 'c']:
				if j != p and j != nx:
					s[i] = j
					break
	flag = 0
	for i in range(n - 1):
		if s[i] == s[i + 1]:
			flag = 1
			break
	if flag == 0:
		print(''.join(s))
	else:
		print(-1)


test_case = int(input())
c_set = ['a', 'b', 'c']
dup = ['aa', 'bb', 'cc', '?']

def replace(s, i):
	prev_c = 's' if i == 0 else s[i - 1]
	curr_c = s[i]
	next_c = 'd' if i + 1 >= len(s) else s[i + 1]
	if curr_c == '?':
		for c in c_set:
			if prev_c != c and next_c != c:
				s[i] = c
				break
	return s

def validate(result):
	valid = True
	for d in dup:
		if result.find(d) >= 0:
			valid = False
	if valid:
		print(result)
	else:
		print(-1)
strings = []
for i in range(0, test_case):
	strings.append(input())
for string in strings:
	n = len(string)
	s = list(string)
	i = 0
	while i < n:
		s = replace(s, i)
		i += 1
	result = ''.join(s)
	validate(result)


def pre(a):
	for i in range(len(a) - 1):
		if a[i] == a[i + 1]:
			return False
	return True

def ch(a):
	ans = ''
	s = ['v']
	for x in a:
		s.append(x)
	s.append('t')
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			if s[i - 1] != 'a' and s[i + 1] != 'a':
				s[i] = 'a'
			elif s[i - 1] != 'b' and s[i + 1] != 'b':
				s[i] = 'b'
			elif s[i - 1] != 'c' and s[i + 1] != 'c':
				s[i] = 'c'
	ans = ''
	for i in range(1, len(s) - 1):
		ans += s[i]
	if not pre(ans):
		return -1
	else:
		return ans
n = int(input())
a = []
for i in range(n):
	s = input()
	a.append(ch(s))
for x in a:
	print(x)


for _ in range(int(input())):
	s = list(input())
	ind = []
	le = len(s)
	for i in range(le):
		if s[i] == '?':
			p = '' if i - 1 < 0 else s[i - 1]
			n = '' if i + 1 == le else s[i + 1]
			for l in ['a', 'b', 'c']:
				if l != p and l != n:
					s[i] = l
					break
	t = 0
	for i in range(1, le):
		if s[i] == s[i - 1]:
			t = 1
			break
	if t == 0:
		print(''.join(s))
	else:
		print('-1')


t = int(input())
while t:
	t -= 1
	s = list(input())
	k = len(s)
	if k == 1 and s[0] == '?':
		s[0] = 'a'
	flag = 0
	for i in range(0, k - 1):
		if s[i] != '?' and s[i] == s[i + 1]:
			flag = 1
	if flag == 1:
		print(-1)
		continue
	if flag != 1:
		for i in range(k):
			if i == 0:
				if s[i] == '?':
					if s[i + 1] != 'a':
						s[i] = 'a'
						continue
					if s[i + 1] != 'b':
						s[i] = 'b'
						continue
					if s[i + 1] != 'c':
						s[i] = 'c'
						continue
			if i == k - 1:
				if s[i] == '?':
					if s[i - 1] != 'a':
						s[i] = 'a'
						continue
					if s[i - 1] != 'b':
						s[i] = 'b'
						continue
					if s[i - 1] != 'c':
						s[i] = 'c'
						continue
			if i != 0 and i != k - 1 and (s[i] == '?') and (s[i - 1] != 'a') and (s[i + 1] != 'a'):
				s[i] = 'a'
				continue
			if i != 0 and i != k - 1 and (s[i] == '?') and (s[i - 1] != 'b') and (s[i + 1] != 'b'):
				s[i] = 'b'
				continue
			if i != 0 and i != k - 1 and (s[i] == '?') and (s[i - 1] != 'c') and (s[i + 1] != 'c'):
				s[i] = 'c'
				continue
		for i in range(k):
			print(s[i], end='')
		print()


for i in range(int(input())):
	s = ' '.join(input()).split()
	n = len(s)
	s = ['0'] + s + ['0']
	j = 1
	while j < n + 1:
		if s[j] == '?':
			for x in 'abc':
				if x != s[j - 1] and x != s[j + 1]:
					s[j] = x
					break
		else:
			j += 1
	s = ''.join(s[1:len(s) - 1])
	print(-1 if 'aa' in s or 'bb' in s or 'cc' in s else s)


nums = int(input())
for i in range(0, nums):
	myStr = input()
	myStr = list(myStr)
	f = 1
	for j in range(0, len(myStr)):
		a = [0, 0, 0]
		if myStr[j] == '?':
			if j != len(myStr) - 1 and myStr[j + 1] == 'a' or (j != 0 and myStr[j - 1] == 'a'):
				a[0] = 1
			if j != len(myStr) - 1 and myStr[j + 1] == 'b' or (j != 0 and myStr[j - 1] == 'b'):
				a[1] = 1
			if j != len(myStr) - 1 and myStr[j + 1] == 'c' or (j != 0 and myStr[j - 1] == 'c'):
				a[2] = 1
			if a[0] == 0:
				myStr[j] = 'a'
			elif a[1] == 0:
				myStr[j] = 'b'
			elif a[2] == 0:
				myStr[j] = 'c'
		elif j != len(myStr) - 1 and myStr[j + 1] == myStr[j] or (j != 0 and myStr[j] == myStr[j - 1]):
			print('-1')
			f = 0
			break
	if f:
		print(''.join(myStr))


t = int(input())
for _ in range(t):
	s = list(input())
	if len(s) == 1 and s[0] == '?':
		print('a')
		continue
	L = ['a', 'b', 'c']
	flg = False
	for i in range(len(s)):
		if flg:
			break
		if i == 0:
			if s[i] == '?':
				for l in L:
					if l != s[i + 1]:
						s[i] = l
						break
		elif i == len(s) - 1:
			if s[i] == '?':
				for l in L:
					if l != s[i - 1]:
						s[i] = l
						break
			elif s[i] == s[i - 1]:
				print(-1)
				flg = True
		elif s[i] == '?':
			for l in L:
				if l != s[i - 1] and l != s[i + 1]:
					s[i] = l
					break
			if s[i] == '?':
				print(-1)
				flg = True
		elif s[i] == s[i - 1]:
			print(-1)
			flg = True
	if not flg:
		print(*s, sep='')


def f(s):
	for i in range(1, len(s)):
		if s[i] == s[i - 1] or s[i] == '?':
			return 0
	return 1
x = 'abc'
for i in range(int(input())):
	s = list(input())
	n = len(s)
	for i in range(n):
		if s[i] == '?':
			(l, r) = ('d', 'd')
			if i:
				l = s[i - 1]
			if i != n - 1:
				r = s[i + 1]
			for j in range(3):
				if l != x[j] and r != x[j]:
					s[i] = x[j]
					break
	if f(s) == 0:
		print(-1)
	else:
		print(''.join(s))


n = int(input())
for _ in range(n):
	bs = [c for c in input()]
	i = 0
	while i < len(bs):
		if bs[i] == '?':
			prev = 'd' if i == 0 else bs[i - 1]
			next = 'e' if i + 1 >= len(bs) else bs[i + 1]
			for x in ['a', 'b', 'c']:
				if x != prev and x != next:
					bs[i] = x
					break
		else:
			i += 1
	flag = True
	for (a, b) in zip(bs, bs[1:]):
		if a == b:
			flag = False
			break
	if flag:
		print(''.join(bs))
	else:
		print(-1)


def abc(s: str):
	if not s:
		return s
	l = len(s)
	if l == 1:
		if s == '?':
			return 'a'
		else:
			return s
	s = list(s)
	for i in range(l - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			return '-1'
	for i in range(l):
		if s[i] != '?':
			continue
		if i == 0:
			if s[1] == '?':
				s[0] = 'a'
			elif s[1] == 'a':
				s[0] = 'b'
			else:
				s[0] = 'a'
			continue
		if i == l - 1:
			if s[-2] == '?':
				s[-1] = 'a'
			elif s[-2] == 'a':
				s[-1] = 'b'
			else:
				s[-1] = 'a'
			continue
		for j in ['a', 'b', 'c']:
			if j != s[i - 1] and j != s[i + 1]:
				s[i] = j
				break
	return ''.join(s)
n = int(input())
out = []
for i in range(n):
	s = input()
	out.append(abc(s))
for i in out:
	print(i)


import sys, itertools
tc = int(sys.stdin.readline())
for _ in range(tc):
	s = list(sys.stdin.readline().rstrip())
	n = len(s)
	cut = False
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] != '?' and (s[i + 1] != '?'):
			cut = True
			break
	if cut:
		print(-1)
	elif s == ['?']:
		print('a')
	else:
		for i in range(n):
			if s[i] == '?':
				if i == 0:
					for j in ['a', 'b', 'c']:
						if s[i + 1] != j:
							s[i] = j
							break
				elif i == n - 1:
					for j in ['a', 'b', 'c']:
						if s[i - 1] != j:
							s[i] = j
							break
				else:
					for j in ['a', 'b', 'c']:
						if s[i + 1] != j and s[i - 1] != j:
							s[i] = j
							break
		print(''.join(s))


n = int(input())
s = [' '] * 1001
k = 0
for i in range(n):
	s[i] = input()
	s[i] = '0' + s[i] + '0'
for i in range(n):
	k = 0
	l = list(s[i])
	leng = len(s[i])
	for j in range(1, len(s[i]) - 1):
		if l[j] == '?':
			if l[j - 1] != 'a' and l[j + 1] != 'a':
				l[j] = 'a'
			elif l[j - 1] != 'b' and l[j + 1] != 'b':
				l[j] = 'b'
			elif l[j - 1] != 'c' and l[j + 1] != 'c':
				l[j] = 'c'
		elif l[j] != '?':
			if l[j - 1] == l[j] or l[j + 1] == l[j]:
				k = 1
	s[i] = l
	if k == 1:
		print(-1)
	else:
		for q in range(1, leng - 1):
			print(s[i][q], end='')
		print('')


T = int(input())
for _ in range(T):
	s = [i for i in input()]
	n = len(s)
	i = 0
	while i < n:
		if s[i] == '?':
			prv = 's' if i == 0 else s[i - 1]
			nxt = 'e' if i + 1 >= n else s[i + 1]
			for temp in ['a', 'b', 'c']:
				if prv != temp and nxt != temp:
					s[i] = temp
					break
		else:
			i += 1
	flag = True
	for i in range(n - 1):
		if s[i] == s[i + 1]:
			flag = False
			print('-1')
			break
	if flag:
		print(''.join(s))


t = int(input())
while t:
	s = input()
	flag = True
	for i in range(1, len(s)):
		if s[i] == s[i - 1] and s[i] != '?':
			flag = False
	a = []
	for i in range(len(s)):
		a.append(s[i])
	if flag:
		for i in range(len(a)):
			if a[i] == '?':
				ls = ['a', 'b', 'c']
				if i - 1 >= 0 and i + 1 <= len(a) - 1:
					if a[i - 1] != '?' and a[i + 1] != '?':
						if a[i - 1] == a[i + 1]:
							ls.remove(a[i - 1])
							a[i] = ls[0]
						else:
							ls.remove(a[i - 1])
							ls.remove(a[i + 1])
							a[i] = ls[0]
					else:
						ls.remove(a[i - 1])
						a[i] = ls[0]
				elif i - 1 >= 0:
					ls.remove(a[i - 1])
					a[i] = ls[0]
				elif i + 1 <= len(a) - 1:
					if a[i + 1] == '?':
						a[i] = ls[0]
					else:
						ls.remove(a[i + 1])
						a[i] = ls[0]
				else:
					a[i] = ls[0]
		print(''.join((str(x) for x in a)))
	else:
		print(-1)
	t -= 1


from sys import *
t = int(input())
for _ in range(t):
	s = input()
	ans = []
	flag = 0
	ln = len(s)
	if s[0] == '?' and ln > 1:
		if s[1] != 'a':
			ans += 'a'
		elif s[1] != 'b':
			ans += 'b'
		elif s[1] != 'c':
			ans += 'c'
	else:
		ans += s[0]
	for i in range(1, ln - 1):
		if s[i] == '?':
			if s[i + 1] != 'a' and ans[i - 1] != 'a':
				ans += 'a'
			elif s[i + 1] != 'b' and ans[i - 1] != 'b':
				ans += 'b'
			elif s[i + 1] != 'c' and ans[i - 1] != 'c':
				ans += 'c'
		else:
			ans += s[i]
	if s[ln - 1] == '?' and ln > 1:
		if ans[ln - 2] != 'a':
			ans += 'a'
		elif ans[ln - 2] != 'b':
			ans += 'b'
		elif ans[ln - 2] != 'c':
			ans += 'c'
	else:
		ans += s[ln - 1]
	for i in range(ln - 1):
		if ans[i] == ans[i + 1]:
			flag = 1
			break
	if flag == 1:
		print(-1)
	elif ln == 1 and flag == 0:
		if s[0] == '?':
			print('a')
		else:
			print(ans[0])
	else:
		print(*ans, sep='')


def solve(s):
	for (a, b) in [[s[i], s[i + 1]] for i in range(len(s) - 1)]:
		if a == '?':
			continue
		if a == b:
			return -1
	s = list('-' + s + '-')
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			set = {s[i - 1], s[i + 1]}
			for l in ['a', 'b', 'c']:
				if l not in set:
					s[i] = l
					break
	return ''.join(s[1:len(s) - 1])
t = int(input())
for i in range(t):
	print(solve(input()))


t = int(input())
lis = ['a', 'b', 'c']
for I in range(t):
	s = list(input())
	b = [0] + s + [0]
	poss = 1
	for i in range(1, len(b)):
		if b[i] == '?':
			if b[i - 1] != 'a' and b[i + 1] != 'a':
				b[i] = 'a'
			elif b[i - 1] != 'b' and b[i + 1] != 'b':
				b[i] = 'b'
			elif b[i - 1] != 'c' and b[i + 1] != 'c':
				b[i] = 'c'
		elif b[i] == b[i - 1]:
			poss = 0
			break
	if poss == 0:
		print(-1)
	else:
		print(''.join(b[1:-1]))


t = int(input())
for w in range(t):
	s = list(input())
	n = len(s)
	if n == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s[0])
	elif s.count('?') == n:
		print('ab' * (n // 2) + 'a' * (n % 2))
	else:
		ans = ''
		c = 0
		for i in range(n - 1):
			if i == 0 and s[i] == '?':
				nxt = s[i + 1]
				for j in ['a', 'b', 'c']:
					if j != nxt:
						s[i] = j
						break
			elif s[i] == '?':
				prev = s[i - 1]
				nxt = s[i + 1]
				for j in ['a', 'b', 'c']:
					if j != prev and j != nxt:
						s[i] = j
						break
			elif s[i] == s[i + 1]:
				c = -1
				break
		if c == -1:
			print(-1)
		else:
			prev = s[n - 2]
			if s[n - 1] == '?':
				for j in ['a', 'b', 'c']:
					if j != prev:
						s[n - 1] = j
						break
			print(''.join(s))


n = int(input())

def getOther(x, y):
	if x == 'a':
		if y != 'b':
			return 'b'
		else:
			return 'c'
	elif x == 'b':
		if y != 'a':
			return 'a'
		else:
			return 'c'
	elif y != 'a':
		return 'a'
	else:
		return 'b'

def getAns(s):
	curr = ''
	for x in s:
		if x == curr and x != '?':
			print(-1)
			return
		curr = x
	if len(s) == 1:
		if s[0] == '?':
			print('a')
			return
		else:
			print(s[0])
			return
	if s[0] == '?':
		if s[1] != 'a':
			s[0] = 'a'
		else:
			s[0] = 'b'
	for x in range(1, len(s) - 1):
		if s[x] == '?':
			if s[x + 1] == '?':
				if s[x - 1] == 'a':
					s[x] = 'b'
				else:
					s[x] = 'a'
			else:
				s[x] = getOther(s[x + 1], s[x - 1])
	if s[-1] == '?':
		if s[-2] == 'a':
			s[-1] = 'b'
		else:
			s[-1] = 'a'
	print(''.join(s))
for i in range(n):
	getAns(list(input()))


def f(s):
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			return True
	return False
t = int(input())
for zz in range(t):
	s = input().strip()
	if f(s):
		print(-1)
	else:
		a = list(s)
		for i in range(0, len(a)):
			if a[i] == '?':
				b = {97, 98, 99}
				if i > 0:
					if ord(a[i - 1]) >= 97:
						try:
							b.remove(ord(a[i - 1]))
						except:
							pass
				if i < len(a) - 1:
					if ord(a[i + 1]) >= 97:
						try:
							b.remove(ord(a[i + 1]))
						except:
							pass
				a[i] = chr(list(b)[0])
		print(''.join(a))


for _ in range(int(input())):
	x = input()
	if 'aa' in x or 'bb' in x or 'cc' in x:
		print(-1)
	elif len(x) == 1:
		print('a')
	else:
		for n in range(len(x)):
			if x[n] == '?' and n not in [0, len(x) - 1]:
				l = 'abc'
				if x[n - 1] != '?':
					l = l.replace(x[n - 1], '')
				if x[n + 1] != '?':
					l = l.replace(x[n + 1], '')
				x = x[:n] + l[0] + x[n + 1:]
			elif x[n] == '?' and n == 0:
				l = 'abc'
				if x[n + 1] != '?':
					l = l.replace(x[n + 1], '')
				x = l[0] + x[n + 1:]
			elif x[n] == '?' and n == len(x) - 1:
				l = 'abc'
				if x[n - 1] != '?':
					l = l.replace(x[n - 1], '')
				x = x[:n] + l[0]
		print(x)


t = int(input())
letters = ['a', 'b', 'c']
for iTest in range(t):
	s = list(input())
	valid = True
	prev = ''
	for c in s:
		if c == prev and c != '?':
			valid = False
			break
		prev = c
	if not valid:
		print(-1)
		continue
	for i in range(len(s)):
		if s[i] != '?':
			continue
		ns = set()
		if i > 0:
			ns.add(s[i - 1])
		if i < len(s) - 1:
			ns.add(s[i + 1])
		for l in letters:
			if l not in ns:
				s[i] = l
				break
	print(''.join(s))


for _ in range(int(input())):
	arr = list(input())
	nhi = 0
	for i in range(len(arr) - 1):
		if arr[i] == arr[i + 1] and arr[i] != '?':
			nhi = 1
	if nhi == 1:
		print('-1')
	else:
		for i in range(0, len(arr)):
			if arr[i] == '?':
				now = ['a', 'b', 'c']
				if i - 1 >= 0:
					if arr[i - 1] in now:
						now.remove(arr[i - 1])
				if i + 1 < len(arr):
					if arr[i + 1] in now:
						now.remove(arr[i + 1])
				if len(now) > 0:
					arr[i] = now[0]
				else:
					nhi = 1
					break
		if nhi == 1:
			print(-1)
		else:
			print(''.join(arr))


letters = 'abc'

def solve(s):
	n = len(s)
	k = list(s)
	for i in range(n):
		if i + 1 < n and k[i] == k[i + 1] and (k[i] != '?'):
			print('-1')
			return
		if k[i] == '?':
			for l in letters:
				if i > 0 and k[i - 1] == l:
					continue
				if i + 1 < n and k[i + 1] == l:
					continue
				k[i] = l
				break
	print(''.join(k))
t = int(input())
for tt in range(t):
	s = input()
	solve(s)


a = int(input())

def give(pr, po):
	arr = ['a', 'b', 'c', '?']
	for i in arr:
		if not (i == pr or i == po or i == '?'):
			return i

def giveOne(a):
	arr = ['a', 'b', 'c', '?']
	for i in arr:
		if not (i == a or i == '?'):
			return i
for i in range(0, a):
	s = input()
	arr = []
	brr = []
	for i in s:
		arr.append(i)
	if len(arr) == 1:
		if arr[0] == '?':
			brr.append('a')
		else:
			brr.append(arr[0])
	else:
		for i in range(0, len(arr)):
			if i == 0 and arr[i] == '?':
				brr.append(giveOne(arr[i + 1]))
			elif i == len(arr) - 1 and arr[i] == '?':
				brr.append(giveOne(brr[i - 1]))
			elif arr[i] == '?':
				brr.append(give(brr[i - 1], arr[i + 1]))
			else:
				brr.append(arr[i])
	k = 1
	for i in range(1, len(brr)):
		if brr[i] == brr[i - 1]:
			k = 0
			break
	if k == 1:
		print(''.join(brr))
	else:
		print(-1)


t = int(input())
li = [input() for i in range(t)]
for sen in li:
	if 'aa' in sen or 'bb' in sen or 'cc' in sen:
		print('-1')
	else:
		Li = ['d'] + [sen[i] for i in range(len(sen))] + ['d']
		for i in range(len(Li)):
			if Li[i] == '?':
				if Li[i - 1] != 'a' and Li[i + 1] != 'a':
					Li[i] = 'a'
				elif Li[i - 1] != 'b' and Li[i + 1] != 'b':
					Li[i] = 'b'
				elif Li[i - 1] != 'c' and Li[i + 1] != 'c':
					Li[i] = 'c'
		print(''.join(Li[1:-1]))


def symb(r, s, i):
	(c1, c2) = (get_symb(r, i - 1), get_symb(s, i + 1))
	if 'a' not in [c1, c2]:
		return 'a'
	elif 'b' not in [c1, c2]:
		return 'b'
	return 'c'

def get_symb(s, i):
	if i == -1 or i == len(s):
		return '.'
	return s[i]

def check(s, i):
	if i == 0:
		return True
	else:
		return s[i] != s[i - 1]
n = int(input())
for _ in range(n):
	fl = True
	r = []
	s = input()
	for i in range(len(s)):
		if s[i] == '?':
			r.append(symb(r, s, i))
		else:
			r.append(s[i])
			fl = fl and check(s, i)
	if fl:
		for c in r:
			print(c, end='')
		print()
	else:
		print(-1)


def solve():
	string = input()
	i = -1
	previous = 'x'
	word = ''
	for letter in string:
		i += 1
		if letter != '?' and letter == previous:
			print(-1)
			return
		if letter != '?':
			word += letter
			previous = letter
		else:
			for x in ['a', 'b', 'c']:
				if x != previous and (i == len(string) - 1 or x != string[i + 1]):
					word += x
					previous = x
					break
	print(word)

def main():
	for case in range(int(input())):
		solve()
main()


num = int(input())
List = []
mark = ['a', 'b', 'c']
for i in range(0, num):
	string = input()
	List.append(string)
for val in List:
	beauty = ''
	for i in range(0, len(val) - 1):
		if val[i] != '?' and val[i] == val[i + 1]:
			beauty = beauty + '-1'
			break
	if len(beauty) == 0:
		for i in range(0, len(val)):
			if i == 0:
				prev = '?'
			else:
				prev = beauty[i - 1]
			current = val[i]
			if i == len(val) - 1:
				nextStr = '?'
			else:
				nextStr = val[i + 1]
			if current != '?':
				beauty = beauty + current
			else:
				counts = [0, 0, 0]
				if prev != '?':
					counts[ord(prev) - ord('a')] += 1
				if nextStr != '?':
					counts[ord(nextStr) - ord('a')] += 1
				for j in range(0, 3):
					if counts[j] == 0:
						beauty = beauty + chr(ord('a') + j)
						break
	print(beauty)


n = int(input())
for i in range(0, n):
	s = input()
	s = '_' + s + '_'
	s = list(s)
	impossible = False
	for j in range(1, len(s) - 1):
		if s[j] == s[j - 1]:
			impossible = True
		possibilities = ['a', 'b', 'c']
		if s[j] == '?':
			if s[j - 1] in possibilities:
				possibilities.remove(s[j - 1])
			if s[j + 1] in possibilities:
				possibilities.remove(s[j + 1])
			s[j] = possibilities[0]
	print(-1) if impossible else print(''.join(s[1:len(s) - 1]))


T = int(input())
possible_chars = ['a', 'b', 'c']
for t in range(T):
	s = input()
	l = list(s)
	n = len(s)
	res = 0
	for i in range(n):
		char = l[i]
		if i > 0:
			if char != '?' and char == s[i - 1]:
				res = -1
				break
		if char == '?':
			impossible = set()
			if i > 0:
				impossible.add(l[i - 1])
			if i < n - 1:
				impossible.add(l[i + 1])
			for c in possible_chars:
				if c not in impossible:
					l[i] = c
					break
	if res == -1:
		print(res)
	else:
		print(''.join(l))


t = int(input())
for i in range(t):
	s = input()
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
	elif len(s) == 1 and s[0] == '?':
		print('a')
	else:
		s = list(s)
		for j in range(len(s)):
			if s[j] == '?':
				if j != 0 and j != len(s) - 1:
					if s[j - 1] != 'a' and s[j + 1] != 'a':
						s[j] = 'a'
					elif s[j - 1] != 'b' and s[j + 1] != 'b':
						s[j] = 'b'
					elif s[j - 1] != 'c' and s[j + 1] != 'c':
						s[j] = 'c'
				elif j == 0:
					if s[j + 1] != 'a':
						s[j] = 'a'
					elif s[j + 1] != 'b':
						s[j] = 'b'
					elif s[j + 1] != 'c':
						s[j] = 'c'
				elif j == len(s) - 1:
					if s[j - 1] != 'a':
						s[j] = 'a'
					elif s[j - 1] != 'b':
						s[j] = 'b'
					elif s[j - 1] != 'c':
						s[j] = 'c'
		print(*s, sep='')


for _ in range(int(input())):
	s = list(input())
	if len(s) == 1:
		print('a')
	else:
		if s[0] == '?':
			x = ['a', 'b', 'c', '?']
			x.remove(s[1])
			s[0] = x[0]
		for i in range(1, len(s) - 1):
			if s[i] == '?':
				x = ['a', 'b', 'c']
				if s[i - 1] in x:
					x.remove(s[i - 1])
				if s[i + 1] in x:
					x.remove(s[i + 1])
				s[i] = x[0]
		if s[-1] == '?':
			x = ['a', 'b', 'c', '?']
			x.remove(s[-2])
			s[-1] = x[0]
		print(-1 if any((s[i] == s[i + 1] and s[i] != '?' for i in range(len(s) - 1))) else ''.join(s))


import collections as cc
import sys
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	s = input()
	n = len(s)
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
		continue
	s = list(s)
	for i in range(n):
		if s[i] == '?':
			if True:
				if i == 0:
					p = 'z'
				else:
					p = s[i - 1]
				if i == n - 1:
					q = 'zz'
				else:
					q = s[i + 1]
				for j in 'abc':
					if j != p and j != q:
						s[i] = j
						break
	print(''.join(s))


import sys
Input = sys.stdin.readline
for i in range(int(Input())):
	s = ' '.join(Input()).split()
	n = len(s)
	s = ['0'] + s + ['0']
	j = 1
	while j < n + 1:
		if s[j] == '?':
			for x in 'abc':
				if x != s[j - 1] and x != s[j + 1]:
					s[j] = x
					break
		else:
			j += 1
	s = ''.join(s[1:len(s) - 1])
	print(-1 if 'aa' in s or 'bb' in s or 'cc' in s else s)