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".

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms

Constructive algorithms


Solutions:
t = int(input())
s = []
for kfnf in range(0, t):
	a = input()
	if 'aa' in a or 'bb' in a or 'cc' in a:
		s.append(-1)
	elif 'a' not in a and 'b' not in a and ('c' not in a):
		j = len(a)
		l = j % 3
		i = ''
		i += int(j // 3) * 'abc'
		if l <= 1:
			i += l * 'a'
		else:
			i += 'ab'
		s.append(i)
	else:
		u = list(a)
		b = len(u)
		if u[0] == '?' and u[1] == '?':
			u[0] = 'a'
		elif u[0] == '?' and u[1] != '?':
			if u[1] == 'a' or u[1] == 'c':
				u[0] = 'b'
			else:
				u[0] = 'a'
		if u[b - 1] == '?' and u[b - 2] == '?':
			u[b - 1] = 'a'
		elif u[b - 1] == '?' and u[b - 2] != '?':
			if u[b - 2] == 'a' or u[b - 2] == 'b':
				u[b - 1] = 'c'
			else:
				u[b - 1] = 'a'
		for i in range(1, b - 1):
			if u[i] == '?':
				if u[i + 1] == '?':
					if u[i - 1] == 'a':
						u[i] = 'b'
					elif u[i - 1] == 'b' or u[i - 1] == 'c':
						u[i] = 'a'
				else:
					p = [u[i - 1], u[i + 1]]
					p.sort()
					if p == ['a', 'b'] or p == ['b', 'b'] or p == ['a', 'a']:
						u[i] = 'c'
					elif p == ['a', 'c'] or p == ['a', 'a']:
						u[i] = 'b'
					else:
						u[i] = 'a'
		d = ''
		for i in u:
			d += i
		s.append(d)
for i in s:
	print(i)


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


for i in range(int(input())):
	s = input()
	l = len(s)
	aa = set(('a', 'b', 'c'))
	if l == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s)
		continue
	s = list(s)
	for i in range(l):
		if s[i] == '?':
			if i == 0:
				if s[1] == '?':
					s[i] = 'a'
				elif s[1] == 'a':
					s[i] = 'b'
				else:
					s[i] = 'a'
			elif i == l - 1:
				if s[i - 1] == 'a':
					s[i] = 'b'
				else:
					s[i] = 'a'
			elif s[i + 1] != '?':
				s[i] = list(aa.difference(set((s[i - 1], s[i + 1]))))[0]
			else:
				s[i] = list(aa.difference(set(s[i - 1])))[0]
	t = True
	for i in range(l - 1):
		if s[i] == s[i + 1]:
			t = False
	print(''.join(s) if t else -1)


n = int(input())
for i in range(n):
	s = str(input())
	s = list(s)
	S = ''
	for j in range(len(s)):
		if j < len(s) - 1:
			if s[j] != '?' and s[j] == s[j + 1]:
				S = '-1'
				break
			if 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'
				elif s[j + 1] != 'c' and s[j - 1] != 'c':
					s[j] = 'c'
		elif s[j] == '?':
			if s[j - 1] != 'a' and s[j - 1] != 'b':
				s[j] = 'a'
			else:
				s[j] = 'c'
		S = S + s[j]
	print(S)


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


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	string1 = [k for k in input()]
	broke = False
	for s in range(len(string1)):
		if string1[s] == '?':
			if s == 0 and s == len(string1) - 1:
				string1[s] = 'a'
			elif s == 0:
				after = string1[s + 1]
				if after != 'a':
					string1[s] = 'a'
				else:
					string1[s] = 'b'
			elif s == len(string1) - 1:
				before = string1[s - 1]
				if before != 'a':
					string1[s] = 'a'
				else:
					string1[s] = 'b'
			else:
				setty = ['a', 'b', 'c']
				after = string1[s + 1]
				before = string1[s - 1]
				if after != '?':
					if after in setty:
						setty.remove(after)
					if before in setty:
						setty.remove(before)
					string1[s] = setty.pop()
				else:
					setty.remove(before)
					string1[s] = setty.pop()
		elif s >= 1:
			if string1[s] == string1[s - 1]:
				broke = True
				break
	if broke == True:
		print(-1)
	else:
		print(''.join(string1))


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


def main():
	t = int(input())
	for i in range(t):
		solve()

def solve():
	arr = [i for i in input()]
	last_char = arr[0] if arr[0] != '?' else '?'
	if len(arr) == 1:
		if arr[0] == '?':
			print('a')
		else:
			print(arr[0])
		return
	l = 0
	r = len(arr) - 1
	while l <= r:
		if arr[l] == arr[l + 1] and arr[l] != '?' or (arr[r] == arr[r - 1] and arr[r] != '?'):
			print(-1)
			return
		if arr[l] == '?':
			letters = set()
			if l > 0:
				letters.add(arr[l - 1])
			letters.add(arr[l + 1])
			letter = ['a', 'b', 'c']
			choice = '-1'
			for i in letter:
				if i in letters:
					continue
				choice = i
			arr[l] = choice
		if arr[r] == '?':
			letters = set()
			if r < len(arr) - 1:
				letters.add(arr[r + 1])
			letters.add(arr[r - 1])
			letter = ['a', 'b', 'c']
			choice = '-1'
			for i in letter:
				if i in letters:
					continue
				choice = i
			arr[r] = choice
		l += 1
		r -= 1
	print(''.join(arr))
main()


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


def dec(x, z):
	s = {'a', 'b', 'c'}
	if x in s:
		s.remove(x)
	if z in s:
		s.remove(z)
	return s
for _ in range(int(input())):
	s = input()
	if s.find('aa') != -1 or s.find('bb') != -1 or s.find('cc') != -1:
		s = ['-1']
	if len(s) < 2:
		if s[0] == '?':
			s = ['a']
	else:
		s = list(s)
		if s[0] == '?':
			if s[1] == 'a':
				s[0] = 'b'
			elif s[1] == 'b':
				s[0] = 'c'
			else:
				s[0] = 'a'
		for i in range(1, len(s) - 1):
			if s[i] == '?':
				p = dec(s[i - 1], s[i + 1])
				s[i] = p.pop()
		if s[len(s) - 1] == '?':
			p = dec(s[len(s) - 2], '?')
			s.remove('?')
			s[len(s) - 1] += p.pop()
	print(''.join(s))


t = int(input())

def cng(x, y):
	if x == 'a' and y == 'b' or (x == 'b' and y == 'a'):
		return 'c'
	elif x == 'a' and y == 'c' or (x == 'c' and y == 'a'):
		return 'b'
	elif x == 'c' and y == 'b' or (x == 'b' and y == 'c'):
		return 'a'
	elif x == 'a' and (y == '?' or y == '') or ((x == '?' or x == '') and y == 'a'):
		return 'b'
	elif x == 'b' and (y == '?' or y == '') or ((x == '?' or x == '') and y == 'b'):
		return 'c'
	elif x == 'c' and (y == '?' or y == '') or ((x == '?' or x == '') and y == 'c'):
		return 'a'
	elif x + y == 'aa':
		return 'b'
	elif x + y == 'bb':
		return 'c'
	elif x + y == 'cc':
		return 'a'
	else:
		return 'a'
for j in range(t):
	s = list(input())
	f = 0
	for i in range(len(s) - 1):
		if s[i] != '?' and s[i] == s[i + 1]:
			f = 1
			break
	if f == 1:
		print(-1)
	else:
		if len(s) == 1:
			print('a')
			continue
		for i in range(len(s)):
			if s[i] == '?':
				if i == 0:
					s[i] = cng('', s[i + 1])
				elif i == len(s) - 1:
					s[i] = cng(s[i - 1], '')
				else:
					s[i] = cng(s[i - 1], s[i + 1])
		print(''.join(s))


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


t = int(input())
for _ in range(t):
	s = list(input())
	flag = False
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			flag = True
	if flag:
		print(-1)
		continue
	for i in range(len(s)):
		if s[i] == '?':
			c = {'a', 'b', 'c'}
			c.discard(s[i - 1])
			c.discard(s[(i + 1) % len(s)])
			s[i] = c.pop()
	print(''.join(s))


def nt(a):
	if a == 'c':
		return 'a'
	return chr(ord(a) + 1)
n = int(input())
for _ in range(n):
	s = input()
	s = '?' + s + '?'
	s = list(s)
	flag = False
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			if s[i - 1] == s[i + 1]:
				if s[i - 1] == 'a':
					s[i] = 'b'
				else:
					s[i] = 'a'
			elif s[i - 1] == '?':
				s[i] = nt(s[i + 1])
			elif s[i + 1] == '?':
				s[i] = nt(s[i - 1])
			else:
				s[i] = chr(ord('a') + ord('b') + ord('c') - ord(s[i - 1]) - ord(s[i + 1]))
		elif s[i] == s[i + 1] or s[i - 1] == s[i]:
			flag = True
			break
	if flag:
		print(-1)
	else:
		print(''.join(s[1:-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 i in range(0, t):
	a = input()
	for i in range(1, len(a) - 1):
		if a[i] == '?':
			if a[i - 1] != 'a' and a[i + 1] != 'a':
				a = a[0:i] + 'a' + a[i + 1:]
			elif a[i - 1] != 'b' and a[i + 1] != 'b':
				a = a[0:i] + 'b' + a[i + 1:]
			else:
				a = a[0:i] + 'c' + a[i + 1:]
	e = 1
	if a[0] == '?':
		if len(a) > 1:
			if a[1] == 'a':
				a = 'b' + a[1:]
			elif a[1] == 'b':
				a = 'a' + a[1:]
			else:
				a = 'a' + a[1:]
		else:
			a = 'c'
	if a[len(a) - 1] == '?':
		if len(a) > 1:
			if a[len(a) - 2] == 'a':
				a = a[0:len(a) - 1] + 'b'
			elif a[len(a) - 2] == 'b':
				a = a[0:len(a) - 1] + 'c'
			else:
				a = a[0:len(a) - 1] + 'a'
		else:
			a = 'c'
	for i in range(1, len(a) - 1):
		if a[i + 1] == a[i] or a[i] == a[i - 1]:
			e = 0
			break
	if e == 0:
		print(-1)
	else:
		print(a)


t = int(input())
for i in range(t):
	check = 0
	string = input()
	for b in range(len(string) - 1):
		if string[b] == string[b + 1] != '?':
			check = 1
			break
	if len(string) == 1:
		if string == '?':
			print('a')
		else:
			print(string)
	else:
		string = [m for m in string]
		for j in range(len(string)):
			if string[j] == '?':
				if j == 0:
					if string[j + 1] == 'a' or string[j + 1] == 'b':
						string[j] = 'c'
					else:
						string[j] = 'a'
				elif j == len(string) - 1:
					if string[j - 1] == 'a' or string[j - 1] == 'b':
						string[j] = 'c'
					else:
						string[j] = 'a'
				else:
					lista = [string[j - 1], string[j + 1]]
					for k in ['a', 'b', 'c']:
						if k not in lista:
							break
					string[j] = k
		if check == 1:
			print(-1)
		else:
			result = ''
			for l in string:
				result += l
			print(result)


t = int(input())
for z in range(t):
	s = list(input())
	flag = 0
	for i in range(len(s) - 1):
		if s[i] != '?' and s[i] == s[i + 1]:
			print('-1')
			flag = 1
			break
	if flag == 1:
		continue
	p = ' '
	n = ' '
	for i in range(0, len(s)):
		if i == len(s) - 1:
			n = ' '
		else:
			n = s[i + 1]
		if s[i] == '?':
			for k in ['a', 'b', 'c']:
				if k != p and k != n:
					s[i] = k
		p = s[i]
	flag = 0
	for i in s:
		if i == '?':
			flag = 1
			break
	if flag == 1:
		print('-1')
	else:
		print(''.join(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)


import sys
input = sys.stdin.readline

def main():
	x = ['a', 'b', 'c']
	t = int(input())
	for _ in range(t):
		ans = []
		S = input().strip()
		if len(S) == 1:
			if S[0] == '?':
				print('a')
			else:
				print(S[0])
			continue
		if len(S) == S.count('?'):
			for i in range(len(S)):
				ans.append(x[i % 3])
			print(''.join(ans))
			continue
		is_beautiful = True
		for i in range(len(S)):
			if S[i] == '?':
				if i == 0:
					if S[i + 1] == '?':
						ans.append('a')
					else:
						ans.append(x[(x.index(S[i + 1]) + 1) % 3])
				elif i == len(S) - 1:
					ans.append(x[(x.index(ans[i - 1]) + 1) % 3])
				elif S[i + 1] == '?':
					ans.append(x[(x.index(ans[i - 1]) + 1) % 3])
				elif 'b' != S[i + 1] and 'b' != ans[i - 1]:
					ans.append('b')
				elif 'a' != S[i + 1] and 'a' != ans[i - 1]:
					ans.append('a')
				elif 'c' != S[i + 1] and 'c' != ans[i - 1]:
					ans.append('c')
			else:
				if i != len(S) - 1 and S[i] == S[i + 1]:
					is_beautiful = False
					break
				ans.append(S[i])
		if is_beautiful:
			print(''.join(ans))
		else:
			print(-1)
main()


import sys

def beautiful_string(string):
	start = string[0]
	answer = -1
	for i in range(1, len(string)):
		if string[i] != '?' and string[i - 1] != '?' and (string[i] == string[i - 1]):
			return answer
	if len(string) == 1 and string == '?':
		string = 'a'
	possible = ['a', 'b', 'c']
	temp = string
	string = list(string)
	if len(string) > 2:
		for i in range(1, len(string) - 1):
			if string[i] == '?':
				for j in possible:
					string[i] = j
					if string[i] != string[i + 1] and string[i] != string[i - 1]:
						break
	if string[0] == '?':
		for j in possible:
			string[0] = j
			if string[0] != string[1]:
				break
	i = len(string) - 1
	if string[len(string) - 1] == '?':
		for j in possible:
			string[i] = j
			if string[i] != string[i - 1]:
				break
	string = ''.join(string)
	return string

def main():
	store = []
	for line in sys.stdin.readlines():
		store.append(line)
	for i in range(len(store)):
		store[i] = store[i].rstrip()
	for string in range(1, len(store)):
		print(beautiful_string(store[string]))
main()


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)


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


for _ in [0] * int(input()):
	s = input()
	a = [0, *s]
	i = 0
	if any((x * 2 in s for x in 'abc')):
		print(-1)
		continue
	for x in a:
		if x == '?':
			a[i] = set('abc').difference(a[i - 1:i + 2]).pop()
		i += 1
	print(''.join(a[1:]))


def beautiful_string(s):
	abc = {'a', 'b', 'c'}
	s.append('?')
	for i in range(len(s) - 1):
		if s[i] == '?':
			c = abc.difference(s[i - 1], s[i + 1])
			s[i] = c.pop()
	return ''.join((c for c in s[:-1]))
for _ in range(int(input())):
	s = list(input().strip())
	s = beautiful_string(s)
	if any((x * 2 in s for x in 'abc')):
		print(-1)
		continue
	print(s)


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)


comp = {'a': ['b', 'c'], 'b': ['a', 'c'], 'c': ['b', 'a'], 'x': ['a', 'c', 'b']}
for _ in range(int(input())):
	s = ['?'] + list(input()) + ['?']
	n = len(s)
	last = 'x'
	chk = True
	for i in range(1, n - 1):
		if last == s[i]:
			chk = False
			break
		if s[i] == '?':
			nxt = s[i + 1]
			if nxt == '?':
				s[i] = comp[last][0]
			else:
				s[i] = comp[last][0] if nxt != comp[last][0] else comp[last][1]
		last = s[i]
	if chk:
		print(''.join(s[1:-1]))
	else:
		print(-1)


T = int(input().strip())

def c(a):
	if a == 'a':
		return 'b'
	if a == 'b':
		return 'c'
	return 'a'

def c1(a, b):
	t = ['a', 'b', 'c']
	for i in t:
		if a not in [i] and b not in [i]:
			return i
for _ in range(T):
	s = input().strip()
	ans = []
	pre = s[0]
	has = True
	for i in range(1, len(s)):
		if s[i] == '?':
			pre = '?'
			continue
		if s[i] == pre:
			has = False
			break
		else:
			pre = s[i]
	if not has:
		print(-1)
	else:
		for i in range(len(s)):
			if s[i] == '?':
				if i == 0:
					if len(s) == 1:
						ans.append('a')
					else:
						ans.append(c(s[i + 1]))
				elif i == len(s) - 1:
					ans.append(c(ans[i - 1]))
				else:
					ans.append(c1(ans[i - 1], s[i + 1]))
			else:
				ans.append(s[i])
		print(''.join(ans))


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


ws = set('abc')
t = int(input())
for _ in range(t):
	s = list(input())
	w = ''
	valid = True
	for a in range(len(s)):
		if w == s[a]:
			valid = False
			break
		if s[a] == '?':
			if a < len(s) - 1:
				w += s[a + 1]
			temp = ws - set(w)
			if len(temp) == 1:
				s[a] = temp.pop()
			else:
				s[a] = temp.pop()
		w = s[a]
	if valid:
		print(''.join(s))
	else:
		print(-1)


def bet(l):
	if l.count('aa') > 0 or l.count('bb') > 0 or l.count('cc') > 0:
		print(-1)
		return
	s = list(l)
	if len(s) == 1 and s[0] == '?':
		print('a')
		return
	q = []
	a = ['a', 'b', 'c']
	for i in range(len(s)):
		if i == 0 and s[i] == '?':
			if s[i + 1] == '?':
				s[i] = 'a'
			else:
				p = list(set(a) - set(s[i + 1]))
				s[0] = p[0]
		elif i < len(s) - 1:
			if s[i] == '?':
				if s[i + 1] == '?':
					p = list(set(a) - set(s[i - 1]))
					s[i] = p[0]
				else:
					b = [s[i - 1], s[i + 1]]
					p = list(set(a) - set(b))
					s[i] = p[0]
		elif i == len(s) - 1:
			if s[i] == '?':
				p = list(set(a) - set(s[i - 1]))
				s[i] = p[0]
	print(*s, sep='')
	return
n = int(input())
for i in range(n):
	t = input()
	bet(t)


def solve():
	s = list(input())
	for (i, c) in enumerate(s):
		if c == '?':
			cs = {'a', 'b', 'c'}
			if i > 0:
				cs.discard(s[i - 1])
			if i < len(s) - 1:
				cs.discard(s[i + 1])
			s[i] = cs.pop()
	ans = True
	for i in range(1, len(s)):
		if s[i - 1] == s[i]:
			break
	else:
		ans = False
	print(''.join(s) if not ans else -1)
n = int(input())
for i in range(n):
	solve()


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


import sys
ip = lambda : sys.stdin.readline().rstrip()
for _ in range(int(ip())):
	s = list(ip())
	d = {'a', 'b', 'c'}
	for i in range(len(s)):
		if i + 1 < len(s) and s[i] == s[i + 1] and (s[i] != '?') and (s[i + 1] != '?'):
			s = ['']
			break
		if s[i] == '?':
			e = set()
			if i - 1 >= 0 and s[i - 1] != '?':
				e.add(s[i - 1])
			if i + 1 < len(s) and s[i + 1] != '?':
				e.add(s[i + 1])
			s[i] = next(iter(d - e))
	if s == ['']:
		print(-1)
	else:
		print(''.join(s))


import sys
t = int(input())
for i in range(t):
	a = list(sys.stdin.readline().strip())
	x = [0, 0, 0]
	f = 1
	fs = 0
	fe = 0
	if a[0] == '?':
		a = ['a'] + a
		fs = 1
	if a[-1] == '?':
		fe = 1
		a.append('c')
	i = 0
	while i < len(a) - 1:
		if a[i + 1] == a[i] and a[i] != '?':
			f = 0
			break
		if a[i + 1] == '?':
			xx = i
			mark = [0] * 3
			if a[xx] in ['a', 'b', 'c']:
				mark[ord(a[xx]) - ord('a')] = 1
			c = 0
			while a[i + 1] == '?':
				c += 1
				i += 1
			yy = i + 1
			if a[yy] in ['a', 'b', 'c']:
				mark[ord(a[yy]) - ord('a')] = 1
			use = []
			if c % 2 == 0:
				if a[yy] == a[xx]:
					for k in range(3):
						if mark[k] == 0:
							use.append(chr(ord('a') + k))
				else:
					use = [a[yy], a[xx]]
			else:
				for k in range(3):
					if mark[k] == 0:
						use.append(chr(ord('a') + k))
				use.append(a[xx])
			z = 0
			for k in range(xx + 1, yy):
				a[k] = use[z % 2]
				z += 1
		i += 1
	if f:
		print(''.join(a[fs:len(a) - fe]))
	else:
		print(-1)


import sys
import collections
from collections import Counter
import itertools
import math
import timeit

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

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

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

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

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

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

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
t = ii()
for _ in range(t):
	s = f'?{input()}?'
	s = [x for x in s]
	f = 1
	for i in range(1, len(s) - 1):
		if s[i] != '?' and (s[i - 1] == s[i] or s[i] == s[i + 1]):
			f = 0
			break
		elif s[i] == '?':
			pojiloi_setik = {'a', 'b', 'c'} - {s[i - 1], s[i + 1]}
			s[i] = pojiloi_setik.pop()
	prr(s[1:-1], '') if f else print(-1)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))
import random
l = ['a', 'b', 'c']
for _ in range(ii()):
	s = list(input())
	n = len(s)
	if n == 1:
		print(s if s[0] != '?' else 'a')
	elif n == 2:
		if s[0] == '?':
			x = random.choice(l)
			while x == s[1]:
				x = random.choice(l)
			s[0] = x
		if s[-1] == '?':
			xxx = random.choice(l)
			while xxx == s[-2]:
				xxx = random.choice(l)
			s[-1] = xxx
		s = ''.join(s)
		print(s)
	else:
		if s[0] == '?':
			x = random.choice(l)
			while x == s[1]:
				x = random.choice(l)
			s[0] = x
		if s[-1] == '?':
			xxx = random.choice(l)
			while xxx == s[-2]:
				xxx = random.choice(l)
			s[-1] = xxx
		for i in range(1, n - 1):
			if s[i] == '?':
				xx = random.choice(l)
				while xx == s[i - 1] or xx == s[i + 1]:
					xx = random.choice(l)
				s[i] = xx
		s = ''.join(s)
		found = True
		for i in range(n - 1):
			if s[i] == s[i + 1]:
				found = False
		print(s if found else '-1')


for _ in ' ' * int(input()):
	n = 0
	a = ['.'] + [i for i in input().replace('', ' ').split()] + ['.']
	i = 1
	while i < len(a):
		if a[i] == '?':
			k = i
			while a[k] == '?':
				if k >= len(a) - 1:
					break
				k += 1
			for j in range(i, k - 1):
				a[j] = list({'a', 'b', 'c'}.difference(set(a[j - 1])))[0]
			k -= 1
			a[k] = list({'a', 'b', 'c'}.difference({a[k - 1], a[k + 1]}))[0]
			i = k
		elif a[i] == a[i - 1]:
			n = 1
		i += 1
	print(*([-1] if n else a[1:len(a) - 1]), sep='')


for _ in [0] * int(input()):
	s = input()
	a = ['', *s]
	i = 0
	if any((x * 2 in s for x in 'abc')):
		print(-1)
	else:
		for x in s:
			i += 1
			a[i] = x < 'a' and ({*'abc'} - {*a[i - 1:i + 2]}).pop() or x
		print(''.join(a))


import os
from math import *
t = int(input())
while t:
	t -= 1
	s = input()
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print('-1')
	elif len(s) == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s[0])
	else:
		y = {'a', 'b', 'c'}
		s = list(s)
		for i in range(len(s)):
			if i == 0:
				if s[i] == '?':
					if s[i + 1] == 'a':
						s[i] = 'b'
						print('b', end='')
					else:
						s[i] = 'a'
						print('a', end='')
				else:
					print(s[i], end='')
			elif i == len(s) - 1:
				if s[i] == '?':
					if s[i - 1] == 'a':
						s[i] = 'b'
						print('b')
					else:
						s[i] = 'a'
						print('a')
				else:
					print(s[i])
			elif s[i] == '?':
				if s[i + 1] == '?':
					if s[i - 1] == 'a':
						s[i] = 'b'
						print('b', end='')
					else:
						s[i] = 'a'
						print('a', end='')
				else:
					zzz = [s[i - 1], s[i + 1]]
					z = list(y.difference(zzz))
					print(z[0], end='')
					s[i] = z[0]
			else:
				print(s[i], end='')


def check(s):
	res = True
	l = len(s)
	while l > 1:
		l -= 1
		if s[l] == s[l - 1]:
			res = False
			break
	return s if res else -1

def main():
	for _ in range(int(input())):
		s = input()
		l = len(s)
		s = 'a' + s
		s += 'c'
		s = list(s)
		d = {'a': 'b', 'b': 'c', 'c': 'a', 'aa': 'b', 'bb': 'c', 'cc': 'a', 'ab': 'c', 'ba': 'c', 'bc': 'a', 'cb': 'a', 'ac': 'b', 'ca': 'b'}
		r = ''
		for i in range(1, l + 1):
			if s[i] == '?':
				if s[i + 1] != '?':
					s[i] = d[s[i - 1] + s[i + 1]]
				else:
					s[i] = d[s[i - 1]]
				r += s[i]
			else:
				r += s[i]
		print(check(r))
main()


n = int(input())
for i in range(n):
	s = input()
	s = list(s)
	c = 0
	if len(s) == 1:
		if s[0] == '?':
			s[0] = 'a'
	else:
		for i in range(len(s)):
			if i < len(s) - 1:
				if s[i] == s[i + 1] and s[i] != '?' and (s[i + 1] != '?'):
					c = 1
					break
			if s[i] == '?':
				if i == 0:
					if s[i + 1] == 'a':
						s[i] = 'c'
					elif s[i + 1] == 'b':
						s[i] = 'a'
					elif s[i + 1] == 'c':
						s[i] = 'b'
					elif s[i + 1] == '?':
						s[i] = 'a'
				if i == len(s) - 1:
					if s[i - 1] == 'a':
						s[i] = 'b'
					elif s[i - 1] == 'b':
						s[i] = 'c'
					elif s[i - 1] == 'c':
						s[i] = 'a'
				if i >= 1 and i < len(s) - 1:
					if s[i - 1] == 'a' and s[i + 1] == 'a':
						s[i] = 'b'
					if s[i - 1] == 'b' and s[i + 1] == 'b':
						s[i] = 'c'
					if s[i - 1] == 'c' and s[i + 1] == 'c':
						s[i] = 'a'
					if (s[i - 1] == 'a' or s[i - 1] == 'b') and (s[i + 1] == 'b' or s[i + 1] == 'a'):
						s[i] = 'c'
					if (s[i - 1] == 'b' or s[i - 1] == 'c') and (s[i + 1] == 'c' or s[i + 1] == 'b'):
						s[i] = 'a'
					if (s[i - 1] == 'a' or s[i - 1] == 'c') and (s[i + 1] == 'c' or s[i + 1] == 'a'):
						s[i] = 'b'
					if (s[i - 1] == 'a' or s[i - 1] == 'b' or s[i - 1] == 'c') and s[i + 1] == '?':
						if s[i - 1] == 'a':
							s[i] = 'b'
						elif s[i - 1] == 'b':
							s[i] = 'c'
						elif s[i - 1] == 'c':
							s[i] = 'a'
	if c == 0:
		print(''.join(s))
	else:
		print('-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())


import sys

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

def out(var):
	sys.stdout.write(str(var))
for i in range(int(inp())):
	s = inp()
	a = 0
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			a = 1
			break
	h = 0
	for i in range(len(s)):
		if s[i] == '?':
			h += 1
	b = []
	c = ['a', 'b', 'c']
	if a == 1:
		print(-1)
	elif len(s) == 1:
		print(c[0])
	elif h == len(s):
		b = h * c
		while len(b) > len(s):
			b.pop()
		b = ''.join(map(str, b))
		print(b)
	else:
		for i in range(len(s)):
			if s[i] != '?':
				b.append(s[i])
			elif len(b) != 0:
				d = b[-1]
				e = i
				while s[e] == '?':
					e += 1
					if e == len(s):
						break
				if e == len(s) and s[e - 1] == '?':
					g = 0
				else:
					g = s[e]
				c.remove(d)
				if g in c:
					c.remove(g)
				b.append(c[0])
				c.append(d)
				if g not in c:
					c.append(g)
			else:
				e = i
				while s[e] == '?':
					e += 1
				g = s[e]
				c.remove(g)
				b.append(c[0])
				c.append(g)
		b = ''.join(map(str, b))
		print(b)


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


def solve(p):
	if not p:
		return []
	if len(p) == 1:
		if p[0] == '?':
			return ['a']
		else:
			return p
	s = set()
	s.add('a')
	s.add('b')
	s.add('c')
	for i in range(1, len(p) - 1):
		if p[i] == '?':
			rem = list(s.difference(set([p[i - 1], p[i + 1], '?'])))
			if not rem:
				return -1
			else:
				p[i] = rem[0]
	if p[0] == '?':
		p[0] = list(s.difference(set([p[1], '?'])))[0]
	if p[-1] == '?':
		p[-1] = list(s.difference(set([p[-2], '?'])))[0]
	for i in range(1, len(p)):
		if p[i] == p[i - 1]:
			return -1
	return p
problems = []
for i in range(int(input())):
	problems += [list(input())]
for p in problems:
	p = solve(p)
	if p != -1:
		p = ''.join(p)
	print(p)


for _ in range(int(input())):
	s = input()
	if len(s) == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s[0])
		continue
	for (i, x) in enumerate(s[:-1]):
		if x != '?':
			if x == s[i + 1]:
				print(-1)
				break
	if x != '?' and x == s[i + 1]:
		continue
	s = list(s)
	for (i, x) in enumerate(s):
		if s[i] == '?':
			SET = set('abc')
			for j in (1, -1):
				k = i + j
				if k >= 0 and k < len(s):
					SET.discard(s[k])
			s[i] = SET.pop()
	print(''.join(s))


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


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input()
t = I()
for i in range(0, t):
	a = ['a', 'b', 'c']
	s = S()
	f = 0
	s = s.rstrip()
	s = list(s)
	for i in range(1, len(s) - 1):
		if (s[i] == s[i - 1] or s[i] == s[i + 1]) and s[i] != '?':
			print(-1)
			f = 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'
			elif s[i - 1] != 'c' and s[i + 1] != 'c':
				s[i] = 'c'
	if len(s) == 2:
		if s[0] == s[1] and s[0] != '?':
			print(-1)
			f = 1
	if s[0] == '?' and len(s) > 1:
		if str(s[1]) != str('a'):
			s[0] = 'a'
		elif s[1] != 'b':
			s[0] = 'b'
		elif s[1] != 'c':
			s[0] = 'c'
	if s[len(s) - 1] == '?' and len(s) > 1:
		if s[len(s) - 2] != 'a':
			s[len(s) - 1] = 'a'
		elif s[len(s) - 2] != 'b':
			s[len(s) - 1] = 'b'
		elif s[len(s) - 2] != 'c':
			s[len(s) - 1] = 'c'
	if len(s) == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s[0])
	elif f == 0:
		print(''.join(map(str, 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


q = {'a', 'b', 'c'}
for i in range(int(input())):
	a = input()
	a = list(a)
	p = 2
	for j in range(len(a)):
		if j == 0:
			pre = 'd'
		else:
			pre = a[j - 1]
		if j == len(a) - 1:
			nxt = 'e'
		else:
			nxt = a[j + 1]
		if a[j] != '?':
			if a[j] == pre or a[j] == nxt:
				print(-1)
				p = 1
				break
		else:
			x = q - {pre, nxt}
			a[j] = x.pop()
	if p == 2:
		print(''.join((str(x) for x in a)))


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 j in range(t):
	s = input()
	l = len(s)
	x = 1
	for i in range(l):
		if l == 1:
			if s[0] == '?':
				s = s[:i] + 'a' + s[i + 1:]
		elif i == 0:
			if s[i] == '?':
				if s[i + 1] == 'a' or s[i + 1] == 'c':
					s = s[:i] + 'b' + s[i + 1:]
				else:
					s = s[:i] + 'a' + s[i + 1:]
			elif s[i] == s[i + 1]:
				print('-1')
				x = 0
				break
		elif i == l - 1:
			if s[i] == '?':
				if s[i - 1] == 'a' or s[i - 1] == 'c':
					s = s[:i] + 'b' + s[i + 1:]
				else:
					s = s[:i] + 'a' + s[i + 1:]
			elif s[i] == s[i - 1]:
				print('-1')
				x = 0
				break
		elif s[i] == '?':
			if s[i - 1] == 'a' and s[i + 1] == 'c' or (s[i - 1] == 'c' and s[i + 1] == 'a') or (s[i - 1] == 'a' and s[i + 1] == 'a') or (s[i - 1] == 'c' and s[i + 1] == 'c') or (s[i - 1] == 'a' and s[i + 1] == '?'):
				s = s[:i] + 'b' + s[i + 1:]
			elif s[i - 1] == 'a' and s[i + 1] == 'b' or (s[i - 1] == 'b' and s[i + 1] == 'a') or (s[i - 1] == 'b' and s[i + 1] == 'b') or (s[i - 1] == 'b' and s[i + 1] == '?'):
				s = s[:i] + 'c' + s[i + 1:]
			else:
				s = s[:i] + 'a' + s[i + 1:]
		elif s[i] == s[i - 1] or s[i] == s[i + 1]:
			print('-1')
			x = 0
			break
	if x == 1:
		print(s)


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


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


from sys import stdin, stdout
n = input()
full = ['a', 'b', 'c']
for temp in range(int(n)):
	s = stdin.readline()
	flag = True
	length = len(s)
	s = list(s)
	for i in range(1, length - 1):
		if s[i] == s[i - 1] and s[i] != '?':
			print(-1)
			flag = False
			break
		if s[i] == '?':
			for each in full:
				if each != s[i - 1] and each != s[i + 1]:
					s[i] = each
					break
	if flag:
		if s[0] == '?':
			for each in full:
				if each != s[1]:
					s[0] = each
					break
		if s[length - 1] == '?':
			for each in full:
				if each != s[length - 2]:
					s[length - 1] = each
					break
		print(''.join(s))


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)


def main():
	t = int(input())
	for i in range(t):
		s = input()
		if len(s) == 1:
			print('a')
			continue
		if 'aa' in s or 'bb' in s or 'cc' in s:
			print(-1)
			continue
		x = []
		for i in range(len(s)):
			x.append(s[i])
		for i in range(len(x)):
			if x[i] == '?':
				if i == 0:
					if x[i + 1] != 'a':
						x[i] = 'a'
					elif x[i + 1] != 'b':
						x[i] = 'b'
					else:
						x[i] = 'c'
				elif i == len(x) - 1:
					if x[i - 1] == 'a':
						x[i] = 'b'
					elif x[i - 1] == 'b':
						x[i] = 'c'
					else:
						x[i] = 'a'
					break
				elif x[i - 1] == 'a' and x[i + 1] != 'b':
					x[i] = 'b'
				elif x[i - 1] == 'a' and x[i + 1] == 'b':
					x[i] = 'c'
				elif x[i - 1] == 'b' and x[i + 1] != 'c':
					x[i] = 'c'
				elif x[i - 1] == 'b' and x[i + 1] == 'c':
					x[i] = 'a'
				elif x[i - 1] == 'c' and x[i + 1] != 'a':
					x[i] = 'a'
				elif x[i - 1] == 'c' and x[i + 1] == 'a':
					x[i] = 'b'
				else:
					print(-1)
					break
		x = ''.join(x)
		print(x)
main()


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


t = int(input())
while t:
	s1 = input()
	s = list(s1)
	a = 0
	count = 0
	for i in range(0, len(s)):
		if s[i] == '?':
			count += 1
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			continue
		elif s[i] != s[i + 1] and s[i] != s[i - 1]:
			a = 0
		else:
			a = 1
			print('-1')
			break
	if count == len(s):
		for i in range(0, len(s)):
			if i % 3 == 0:
				s[i] = 'a'
			elif i % 3 == 1:
				s[i] = 'b'
			else:
				s[i] = 'c'
	elif a == 0:
		for i in range(0, len(s)):
			if s[i] != '?':
				continue
			elif i == 0 or i == len(s) - 1:
				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'
				elif i == len(s) - 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 - 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'
			else:
				print('-1')
				a = 1
				break
	if a == 0:
		print(''.join(s))
	t = t - 1


def nextval(x):
	l = ['a', 'b', 'c', '?']
	z = l.index(x)
	return z + 1
x = int(input(''))
for i in range(x):
	s = str(input(''))
	l = ['a', 'b', 'c']
	if s.count('aa') > 0 or s.count('bb') > 0 or s.count('cc') > 0:
		print(-1)
	else:
		s = list(s)
		for i in range(len(s)):
			if i > 0 and s[i] == '?' and (i != len(s) - 1):
				s[i] = l[nextval(s[i - 1]) % 3]
				if i < len(s):
					if s[i] == s[i + 1]:
						s[i] = l[nextval(s[i]) % 3]
			elif i == 0 and s[i] == '?' and (len(s) >= 2):
				s[i] = l[nextval(s[i + 1]) % 3]
			elif i == 0 and s[i] == '?' and (len(s) < 2):
				s[i] = 'a'
			elif i == len(s) - 1 and s[i] == '?':
				s[i] = l[nextval(s[i - 1]) % 3]
		print(''.join(s))


for i in range(int(input())):
	s = input()
	arr = [i for i in s]
	st = set(['a', 'b', 'c'])
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
	else:
		for i in range(len(s)):
			if s[i] == '?':
				arr[i] = list(st - set([arr[min(len(s) - 1, i + 1)], arr[max(0, i - 1)]]))[0]
			else:
				arr[i] = s[i]
		print(''.join(arr))


def main():
	noTest = int(input())
	cases = []
	for i in range(0, noTest):
		case = input()
		cases.append(case)
	for j in range(0, noTest):
		currentCase = cases[j]
		lenCase = len(currentCase)
		for i in range(0, lenCase):
			if i != lenCase - 1:
				if currentCase[i] == currentCase[i + 1] and currentCase[i] != '?':
					cases[j] = -1
					break
			if currentCase[i] == '?':
				if i == 0:
					if i == lenCase - 1:
						currentCase = 'a'
					else:
						nextChar = currentCase[i + 1]
						if nextChar == 'a' or nextChar == 'b':
							currentCase = 'c' + currentCase[i + 1:]
						else:
							currentCase = 'a' + currentCase[i + 1:]
				elif i == lenCase - 1:
					previousChar = currentCase[i - 1]
					if previousChar == 'a' or previousChar == 'b':
						currentCase = currentCase[:i] + 'c'
					else:
						currentCase = currentCase[:i] + 'a'
				else:
					nextChar = currentCase[i + 1]
					previousChar = currentCase[i - 1]
					if previousChar == 'a' and nextChar != 'c' or (previousChar == 'b' and nextChar != 'c'):
						currentCase = currentCase[:i] + 'c' + currentCase[i + 1:]
					elif previousChar == 'b' and nextChar != 'a' or (previousChar == 'c' and nextChar != 'a'):
						currentCase = currentCase[:i] + 'a' + currentCase[i + 1:]
					elif previousChar == 'a' and nextChar != 'b' or (previousChar == 'c' and nextChar != 'b'):
						currentCase = currentCase[:i] + 'b' + currentCase[i + 1:]
			cases[j] = currentCase
	for case in cases:
		print(case)
main()


for i in range(int(input())):
	a = list(input())
	d = 0
	u = ['a', 'b', 'c']
	if len(a) <= 2:
		if len(a) == 1:
			if a[0] == '?':
				print('a')
			else:
				print(a[0])
		elif a[0] == '?' and a[1] != '?':
			for m in u:
				if m != a[1]:
					a[0] = m
					print(''.join(a))
					break
		elif a[1] == '?' and a[0] != '?':
			for z in u:
				if z != a[0]:
					a[1] = z
					print(''.join(a))
					break
		else:
			print('ab')
	else:
		for s in range(1, len(a) - 1):
			if a[s] == '?':
				for k in u:
					if k != a[s - 1] and k != a[s + 1]:
						a[s] = k
						break
					else:
						pass
				if a[s] == '?':
					print(-1)
					d += 1
					break
			elif a[s] == a[s + 1] or a[s - 1] == a[s]:
				print(-1)
				d += 1
				break
			if d == 1:
				break
		if a[0] == '?':
			for b in u:
				if b != a[1]:
					a[0] = b
					break
		if a[-1] == '?':
			for y in u:
				if y != a[-2]:
					a[-1] = y
					break
		if d == 0:
			print(''.join(a))


for i in range(int(input())):
	X = input()
	Temp = X[0]
	Check = False
	for j in 'abc':
		if j * 2 in X:
			Check = True
			break
	if Check:
		print(-1)
	else:
		if len(X) == 1:
			print('a' if X[0] == '?' else X[0])
			continue
		if X[0] == '?':
			if X[1] in 'a?':
				X = 'b' + X[1:]
			else:
				X = 'a' + X[1:]
		for j in range(1, len(X) - 1):
			if X[j] == '?':
				if X[j - 1] + X[j + 1] in ['aa', 'ac', 'ca', 'cc', 'a?', 'c?']:
					X = X[:j] + 'b' + X[j + 1:]
				elif X[j - 1] + X[j + 1] in ['ab', 'ba', 'bb']:
					X = X[:j] + 'c' + X[j + 1:]
				else:
					X = X[:j] + 'a' + X[j + 1:]
		if X[-1] == '?':
			if X[-2] in 'ab':
				print(X[:-1] + 'c')
			else:
				print(X[:-1] + 'a')
		else:
			print(X)


for _ in [0] * int(input()):
	tmp = input()
	ans = ['', *tmp]
	i = 0
	cur = ''
	for x in tmp:
		i += 1
		if x == '?':
			ans[i] = ({*'abc'} - {*ans[i - 1:i + 2]}).pop()
			cur = ''
		else:
			if not cur == '?' and cur == x:
				ans = [*'-1']
				break
			cur = x
			ans[i] = x
	print(''.join(ans))


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


t = int(input())
alp = {'a', 'b', 'c'}
for _ in range(t):
	s = list(input().strip())
	bad = False
	for i in range(len(s)):
		used = set()
		if i > 0:
			used.add(s[i - 1])
			if s[i - 1] == s[i]:
				bad = True
				break
		if i < len(s) - 1:
			used.add(s[i + 1])
		if s[i] == '?':
			s[i] = list(alp - used)[0]
	if not bad:
		print(''.join(s))
	else:
		print(-1)


def ok(x):
	for i in range(0, len(x) - 1):
		if x[i] == x[i + 1]:
			return 0
	return 1
n = int(input())
for i in range(0, n):
	s = input()
	s = list(s)
	t = []
	for j in range(0, len(s)):
		if s[j] == '?':
			lst = 'c'
			if j > 0:
				lst = s[j - 1]
			dif = 'a'
			if lst == dif:
				dif = 'b'
			curr = dif
			while j < len(s) and s[j] == '?':
				s[j] = curr
				if curr == dif:
					curr = lst
				else:
					curr = dif
				j = j + 1
			if j < len(s) and s[j] == s[j - 1]:
				if s[j - 1] == dif:
					s[j - 1] = lst
				else:
					s[j - 1] = dif
				if j >= 2 and s[j - 1] == s[j - 2]:
					ult = 'a'
					if ult == lst or ult == dif:
						ult = 'b'
					if ult == lst or ult == dif:
						ult = 'c'
					s[j - 1] = ult
	if ok(s):
		ret = ''
		for x in s:
			ret += x
		print(ret)
	else:
		print(-1)


import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda : sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10 ** 8)
inf = float('inf')
mod = 10 ** 9 + 7
ans = 0
count = 0
pro = 1
n = int(input())
data = ['a', 'b', 'c']

def solve():
	s = list(input())
	for i in range(len(s) - 1):
		if s[i] == '?':
			if i != 0:
				for di in data:
					if di != s[i - 1] and di != s[i + 1]:
						s[i] = di
			else:
				for di in data:
					if di != s[i + 1]:
						s[i] = di
		if s[i] == s[i + 1]:
			print(-1)
			return
	if s == ['?']:
		s[0] = 'a'
	elif s[-1] == '?':
		for di in data:
			if di != s[-2]:
				s[-1] = di
	print(*s, sep='')
for i in range(n):
	solve()


from itertools import cycle
c = cycle('abc')
things = [input() for _ in range(int(input()))]
for thing in things:
	stuff = ''
	if len(thing) == 0:
		print('')
	elif len(thing) == 1:
		if thing[0] == '?':
			print(next(c))
		else:
			print(thing)
	else:
		asdf = False
		for i in range(len(thing) - 1):
			if thing[i] != '?' and thing[i] == thing[i + 1]:
				print(-1)
				asdf = True
				break
		if asdf:
			continue
		thing = list(thing)
		for i in range(len(thing)):
			if thing[i] == '?':
				if i == 0:
					thing[0] = next(c)
					if thing[0] == thing[1]:
						thing[0] = next(c)
				elif i == len(thing) - 1:
					thing[-1] = next(c)
					if thing[-2] == thing[-1]:
						thing[-1] = next(c)
				else:
					thing[i] = next(c)
					while thing[i - 1] == thing[i] or thing[i + 1] == thing[i]:
						thing[i] = next(c)
		thing = ''.join(thing)
		print(thing)


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


d = {'a', 'b', 'c'}
for _ in range(int(input())):
	s = input()
	if s.find('aa') != -1 or s.find('bb') != -1 or s.find('cc') != -1:
		print(-1)
	elif s == '?':
		print('a')
	else:
		s = list(s)
		if s[0] == '?':
			if s[1] in d:
				for c in d:
					if c != s[1]:
						s[0] = c
						break
			else:
				s[0] = 'a'
		if s[-1] == '?':
			if s[-2] in d:
				for c in d:
					if c != s[-2]:
						s[-1] = c
						break
			else:
				s[-1] = 'a'
		for i in range(1, len(s) - 1):
			if s[i] == '?':
				if s[i + 1] == '?':
					for c in d:
						if c != s[i - 1]:
							s[i] = c
				else:
					s[i] = (d ^ set([s[i - 1], s[i + 1]])).pop()
		print(''.join(s))


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


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	S = input()
	N = len(S)
	ans = []
	for (i, s) in enumerate(S):
		if s == '?':
			if N == 1:
				ans += ['a']
			elif i == 0:
				if S[i + 1] == 'a':
					ans += ['b']
				elif S[i + 1] == 'b':
					ans += ['c']
				else:
					ans += ['a']
			elif i == N - 1:
				if S[i - 1] == 'a':
					ans += ['b']
				elif S[i - 1] == 'b':
					ans += ['c']
				elif S[i - 1] == 'c':
					ans += ['a']
				else:
					ans += [chr((ord(ans[i - 1]) - 97 + 1) % 3 + 97)]
			elif (ans[i - 1] == 'a' or ans[i - 1] == 'b') and (S[i + 1] == 'a' or S[i + 1] == 'b'):
				ans += ['c']
			elif (ans[i - 1] == 'b' or ans[i - 1] == 'c') and (S[i + 1] == 'b' or S[i + 1] == 'c'):
				ans += ['a']
			elif (ans[i - 1] == 'c' or ans[i - 1] == 'a') and (S[i + 1] == 'c' or S[i + 1] == 'a'):
				ans += ['b']
			else:
				ans += [chr((ord(ans[i - 1]) - 97 + 1) % 3 + 97)]
		else:
			ans += [S[i]]
	ans = ''.join(ans)
	for (i, s) in enumerate(ans[1:], 1):
		if s == S[i - 1]:
			print(-1)
			break
	else:
		print(ans)


q = int(input())
for i in range(q):
	s1 = input()
	s2 = ''
	g = len(s1)
	check = True
	for i in range(g):
		if s1[i] == '?':
			a = '?'
			b = '?'
			if i != 0:
				a = s2[i - 1]
			if i != g - 1:
				b = s1[i + 1]
			if a != 'b' and b != 'b':
				s2 += 'b'
			elif a != 'c' and b != 'c':
				s2 += 'c'
			else:
				s2 += 'a'
		else:
			s2 += s1[i]
			if i != 0:
				if s1[i] == s1[i - 1]:
					check = False
	if check:
		print(s2)
	else:
		print(-1)


a = ['a', 'b', 'c']
for i in range(int(input())):
	s = list(input())
	q = True
	for i in range(len(s)):
		if i + 1 != len(s) and s[i] == s[i + 1] and (s[i] != '?'):
			print(-1)
			q = False
			break
		if s[i] == '?':
			if i:
				s[i] = a[(a.index(s[i - 1]) + 1) % 3]
			else:
				s[i] = 'a'
			if i + 1 != len(s) and s[i] == s[i + 1]:
				s[i] = a[(a.index(s[i]) + 1) % 3]
	if q:
		print(*s, sep='')


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)


def check(s):
	n = len(s)
	flag = 0
	for i in range(n - 1):
		if s[i] == s[i + 1]:
			flag = -1
			break
	if flag == -1:
		print('-1')
	else:
		ans = ''
		for i in range(n):
			ans += s[i]
		print(ans)
t = int(input())
for T in range(t):
	s = input()
	n = len(s)
	ans = s
	s = list(s)
	if n == 1:
		if s[0] == '?':
			s[0] = 'a'
		print(*s)
	elif s.count('?') == n:
		ans = 'abc' * (n // 3)
		for i in range(n - len(ans)):
			if i % 3 == 0:
				ans += 'a'
			elif i % 3 == 1:
				ans += 'b'
			else:
				ans += 'c'
		print(ans)
	else:
		for i in range(n):
			if s[i] != '?':
				continue
			if i == 0:
				if s[i + 1] == '?':
					s[i] = 'a'
				elif s[i + 1] == 'a':
					s[i] = 'b'
				elif s[i + 1] == 'b':
					s[i] = 'c'
				else:
					s[i] = 'a'
			elif i == n - 1:
				if s[i - 1] == 'a':
					s[i] = 'b'
				elif s[i - 1] == 'b':
					s[i] = 'c'
				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] == 'b':
				s[i] = 'a'
			else:
				s[i] = 'b'
		check(s)


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


for _ in range(int(input())):
	st = input()
	flag = 0
	for i in range(len(st) - 1):
		if st[i] != '?' and st[i] == st[i + 1]:
			flag = 1
			break
	if flag:
		print(-1)
		continue
	dt = {'ab': 'c', 'ac': 'b', 'ba': 'c', 'bc': 'a', 'ca': 'b', 'cb': 'a', 'aa': 'b', 'bb': 'a', 'cc': 'a', '?': 'a', 'a': 'b', 'b': 'a', 'c': 'b', '??': 'a'}
	i = 0
	st = list(st)
	if len(st) == 1 and st == '?':
		print('a')
		continue
	while i < len(st) - 1:
		try:
			if st[i] != '?':
				i += 1
				continue
			if st[i] == '?' and i == 0:
				if st[i + 1] == '?':
					st[i] = dt['?']
				else:
					st[i] = dt[st[i + 1]]
			elif st[i] == '?' and st[i + 1] != '?':
				st[i] = dt[st[i - 1] + st[i + 1]]
			elif st[i] == '?' and st[i + 1] == '?':
				st[i] = dt[st[i - 1]]
		except:
			pass
		i += 1
	if st[-1] == '?' and len(st) >= 2:
		st[-1] = dt[st[-2]]
	elif st[-1] == '?':
		st[-1] = dt[st[-1]]
	print(''.join(st))


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)


def solution(s):
	n = len(s)
	abc = 'abc'
	res = list(s)
	if n == 1 and s[0] in abc:
		return s
	if n == 1 and s[0] == '?':
		return 'a'
	if 'aa' in s or 'bb' in s or 'cc' in s:
		return -1
	indices = [i for (i, c) in enumerate(res) if c == '?']
	if 0 in indices:
		indices.remove(0)
	if n - 1 in indices:
		indices.remove(n - 1)
	for i in indices:
		tmp = abc.replace(res[i - 1], '')
		tmp = tmp.replace(res[i + 1], '')
		res[i] = tmp[0]
	if res[0] == '?':
		tmp = abc.replace(res[1], '')
		res[0] = tmp[0]
	if res[n - 1] == '?':
		tmp = abc.replace(res[n - 2], '')
		res[n - 1] = tmp[0]
	return ''.join(res)
for _ in range(int(input())):
	s = input()
	print(solution(s))


let = ['a', 'b', 'c']
val = [0, 2, 1]
for _ in range(int(input())):
	c = input()
	if len(c) == 1:
		if c == '?':
			print('a')
			continue
		else:
			print(c)
			continue
	imp = False
	s = ''
	if c[0] == '?':
		if c[1] == '?':
			s += 'a'
		else:
			s += let[(let.index(c[1]) + 1) % 3]
	else:
		s += c[0]
	for j in range(1, len(c) - 1):
		if s[j - 1] == c[j]:
			imp = True
			break
		elif c[j] != '?':
			s += c[j]
		elif c[j + 1] != '?':
			if s[j - 1] == c[j + 1]:
				s += let[(let.index(s[j - 1]) + 1) % 3]
			else:
				s += let[(val[let.index(s[j - 1])] + val[let.index(c[j + 1])]) % 3]
		else:
			s += let[(let.index(s[j - 1]) + 1) % 3]
	if imp == True:
		print(-1)
		continue
	if c[len(c) - 1] != '?':
		if s[len(s) - 1] == c[len(c) - 1]:
			imp = True
		else:
			s += c[len(c) - 1]
	else:
		s += let[(let.index(s[len(s) - 1]) + 1) % 3]
	if imp == True:
		print(-1)
	else:
		print(s)


def solve(w):
	for i in range(1, len(w)):
		if w[i] == w[i - 1] != '?':
			return -1
	w = ['t'] + list(w) + ['t']
	options = set(['a', 'b', 'c'])
	for i in range(1, len(w)):
		if w[i] == '?' and w[i + 1] != '?':
			remove = set([w[i - 1], w[i + 1]])
		elif w[i] == '?':
			remove = set(w[i - 1])
		else:
			continue
		x = options - remove
		w[i] = x.pop()
	return ''.join(w[1:-1])

def main():
	for _ in range(int(input())):
		print(solve(input()))
main()


for i in range(int(input())):
	s = input()
	a = 0
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			a = 1
			break
	h = 0
	for i in range(len(s)):
		if s[i] == '?':
			h += 1
	b = []
	c = ['a', 'b', 'c']
	if a == 1:
		print(-1)
	elif len(s) == 1:
		print(c[0])
	elif h == len(s):
		b = h * c
		while len(b) > len(s):
			b.pop()
		b = ''.join(map(str, b))
		print(b)
	else:
		for i in range(len(s)):
			if s[i] != '?':
				b.append(s[i])
			elif len(b) != 0:
				d = b[-1]
				e = i
				while s[e] == '?':
					e += 1
					if e == len(s):
						break
				if e == len(s) and s[e - 1] == '?':
					g = 0
				else:
					g = s[e]
				c.remove(d)
				if g in c:
					c.remove(g)
				b.append(c[0])
				c.append(d)
				if g not in c:
					c.append(g)
			else:
				e = i
				while s[e] == '?':
					e += 1
				g = s[e]
				c.remove(g)
				b.append(c[0])
				c.append(g)
		b = ''.join(map(str, b))
		print(b)


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


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__

def fill(s):
	s = s.copy()
	if len(s) == 1:
		if s[0] == '?':
			return ['a']
		else:
			return s
	if s[0] == '?':
		s[0] = 'a' if s[1] != 'a' else 'b'
	if s[-1] == '?':
		s[-1] = 'a' if s[-2] != 'a' else 'b'
	options = ['a', 'b', 'c']
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			s[i] = [opt for opt in options if opt != s[i - 1] and opt != s[i + 1]][0]
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			return None
	return s
t = int(input())
for _ in range(t):
	s = list(input())
	ans = fill(s)
	if ans is None:
		print(-1)
	else:
		print(''.join(ans))


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


n = eval(input(''))
inputs = []
answer = []
letters = ['a', 'b', 'c', '?']
for i in range(n):
	inputs.append(input())
for i in range(len(inputs)):
	word = inputs[i]
	theWord = ''
	for j in range(len(word)):
		left = None
		right = None
		if word[j] == '?':
			if j != 0:
				left = theWord[-1]
			if j + 1 < len(word):
				right = word[j + 1]
			if left != None:
				letters.pop(letters.index(left))
			if right != None and left != right:
				letters.pop(letters.index(right))
			theWord += letters[0]
		else:
			theWord += word[j]
			if j != 0:
				left = theWord[j - 1]
			if j + 1 < len(word):
				right = word[j + 1]
			if word[j] == left or word[j] == right:
				theWord = -1
				break
		letters = ['a', 'b', 'c', '?']
	answer.append(theWord)
for j in answer:
	print(j)


t = int(input())
answers = []
for ti in range(t):
	str = input()
	chars = []
	chars.extend(str)
	cnt = 0
	while cnt < len(chars):
		if chars[cnt] != '?':
			cnt += 1
			continue
		can = ['a', 'b', 'c']
		if cnt > 0 and chars[cnt - 1] != '?':
			can.remove(chars[cnt - 1])
		if cnt < len(chars) - 1:
			for j in range(len(can)):
				if can[j] == chars[cnt + 1]:
					can.pop(j)
					break
		if len(can) > 0:
			chars[cnt] = can[0]
		cnt += 1
	is_beautiful = True
	for i in range(1, len(chars)):
		if chars[i] == chars[i - 1]:
			is_beautiful = False
			break
	if is_beautiful:
		answers.append(''.join(chars))
	else:
		answers.append('-1')
for i in range(len(answers)):
	print(answers[i])


read = lambda : map(int, input().split())
I = lambda : int(input())

def isbeautiful(i):
	return (s[i - 1] == '?' or s[i - 1] != s[i]) and (s[i + 1] == '?' or s[i] != s[i + 1])

def makebeautiful(i):
	poss = {'a', 'b', 'c'}
	if s[i - 1] != '?':
		poss.discard(s[i - 1])
	if s[i + 1] != '?':
		poss.discard(s[i + 1])
	s[i] = poss.pop()
for _ in range(I()):
	s = ['?'] + list(input()) + ['?']
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			makebeautiful(i)
		elif not isbeautiful(i):
			print(-1)
			break
	else:
		print(''.join(s[1:-1]))


n = int(input())
array = ['a', 'b', 'c']
for i in range(n):
	t = 1
	a = list(input())
	if len(a) == 1:
		print('a')
		continue
	for i in range(len(a) - 1):
		if a[i] == '?':
			if i == 0:
				for k in range(3):
					if array[k] != a[i + 1]:
						a[i] = array[k]
			for k in range(3):
				if array[k] != a[i + 1] and array[k] != a[i - 1]:
					a[i] = array[k]
		elif a[i + 1] == a[i] and a[i] != '?':
			print(-1)
			t = 0
			break
	if t == 0:
		continue
	else:
		if a[-1] == '?':
			for k in range(3):
				if array[k] != a[-2]:
					a[-1] = array[k]
		print(*a, sep='')


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


for _ in range(int(input())):
	a = list(input())
	i = 0
	while i < len(a):
		if a[i] == '?':
			c = 0
			st = i
			f = 'a'
			l = 'b'
			ff = False
			if i - 1 >= 0:
				f = a[i - 1]
				ff = True
			while a[i] == '?':
				i += 1
				c += 1
				if i >= len(a):
					break
			ll = False
			if i < len(a):
				l = a[i]
				ll = True
			if not ff:
				x = ['a', 'b', 'c']
				if not ll:
					l = 'b'
					ll = True
				x.remove(l)
				f = x[0]
			if not ll:
				x = ['a', 'b', 'c']
				x.remove(f)
				l = x[0]
			(f, l) = (l, f)
			if st - 1 >= 0 and i < len(a) and (a[st - 1] == a[i]):
				x = ['a', 'b', 'c']
				x.remove(a[st - 1])
				f = x[0]
				l = x[1]
				for j in range(st, i, 2):
					if j < len(a) and j < i:
						a[j] = f
					if j + 1 < len(a) and j + 1 < i:
						a[j + 1] = l
			else:
				if c % 2 == 0:
					pass
				else:
					x = ['a', 'b', 'c']
					if f in x:
						x.remove(f)
					if l in x:
						x.remove(l)
					f = x[0]
				for j in range(st, i, 2):
					if j < len(a) and j < i:
						a[j] = f
					if j + 1 < len(a) and j + 1 < i:
						a[j + 1] = l
		i += 1
	for i in range(1, len(a)):
		if a[i] == a[i - 1]:
			print(-1)
			break
	else:
		print(''.join(a))


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)


import sys
t = int(sys.stdin.readline())
for i in range(t):
	s = input()
	lg = len(s)
	ans = ['z'] * lg
	g = ['a', 'b', 'c']
	temp = 0
	for j in range(lg):
		if s[j] == '?':
			if j >= 1 and j < lg - 1:
				if s[j + 1] == '?':
					if ans[j - 1] == 'a':
						ans[j] = 'b'
					elif ans[j - 1] == 'b':
						ans[j] = 'c'
					else:
						ans[j] = 'a'
				elif s[j + 1] != '?':
					if ans[j - 1] == 'a':
						if s[j + 1] == 'a':
							ans[j] = 'b'
						elif s[j + 1] == 'b':
							ans[j] = 'c'
						elif s[j + 1] == 'c':
							ans[j] = 'b'
						else:
							ans[j] = 'b'
					if ans[j - 1] == 'b':
						if s[j + 1] == 'a':
							ans[j] = 'c'
						elif s[j + 1] == 'b':
							ans[j] = 'c'
						elif s[j + 1] == 'c':
							ans[j] = 'a'
						else:
							ans[j] = 'c'
					if ans[j - 1] == 'c':
						if s[j + 1] == 'a':
							ans[j] = 'b'
						elif s[j + 1] == 'b':
							ans[j] = 'a'
						elif s[j + 1] == 'c':
							ans[j] = 'a'
						else:
							ans[j] = 'a'
			elif j == 0:
				if j + 1 < lg and s[j + 1] == '?':
					ans[j] = 'a'
				elif j + 1 < lg and s[j + 1] != '?':
					if s[j + 1] == 'a':
						ans[j] = 'b'
					elif s[j + 1] == 'b':
						ans[j] = 'c'
					else:
						ans[j] = 'a'
				else:
					ans[j] = 'a'
			elif j == lg - 1:
				if ans[j - 1] == 'a':
					ans[j] = 'b'
				elif ans[j - 1] == 'b':
					ans[j] = 'c'
				else:
					ans[j] = 'a'
		else:
			if j != lg - 1:
				if s[j] == s[j + 1]:
					print('-1')
					temp = 1
					break
			ans[j] = s[j]
	if temp != 1:
		sys.stdout.write(''.join(ans) + '\n')


t = int(input())
for i in range(t):
	s = input()
	(l, f) = ([], 0)
	for i in s:
		l.append(i)
	for i in range(len(s) - 1):
		if l[i] == l[i + 1] and l[i] != '?':
			f = 1
	if f == 1:
		print(-1)
		continue
	n = len(l)
	for i in range(1, n - 1):
		l1 = ['a', 'b', 'c']
		if l[i] == '?':
			if l[i + 1] != '?':
				if l[i + 1] in l1:
					l1.remove(l[i + 1])
			if l[i - 1] != '?':
				if l[i - 1] in l1:
					l1.remove(l[i - 1])
			l[i] = l1[0]
	if l[0] == '?' and n > 1:
		if l[1] != 'c':
			l[0] = 'c'
		if l[1] != 'b':
			l[0] = 'b'
		if l[1] != 'a':
			l[0] = 'a'
	if l[n - 1] == '?':
		if l[n - 2] == 'a' or l[n - 2] == 'b':
			l[n - 1] = 'c'
		if l[n - 2] == 'a' or l[n - 2] == 'c':
			l[n - 1] = 'b'
		if l[n - 2] == 'c' or l[n - 2] == 'b':
			l[n - 1] = 'a'
	if n == 1 and l[0] == '?':
		l[0] = 'a'
	print(*l, sep='')


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 t in range(int(input())):
	s = list(input())
	flag = True
	for i in range(len(s) - 1):
		if i + 1 < len(s):
			if s[i] == s[i + 1] and s[i] != '?':
				print(-1)
				flag = False
				break
			elif s[i] == '?':
				if i - 1 < 0:
					if s[i + 1] != '?':
						if s[i + 1] == 'a':
							s[i] = 'b'
						elif s[i + 1] == 'b':
							s[i] = 'a'
						else:
							s[i] = 'a'
					else:
						s[i] = 'a'
				elif s[i + 1] != '?':
					x = s[i + 1]
					y = s[i - 1]
					if x == 'a' and y == 'b' or (x == 'b' and y == 'a'):
						s[i] = 'c'
					elif x == 'a' and y == 'c' or (x == 'c' and y == 'a'):
						s[i] = 'b'
					elif x == 'b' and y == 'c' or (x == 'c' or y == 'b'):
						s[i] = 'a'
					elif x == y:
						if x == 'a':
							s[i] = 'b'
						elif x == 'b':
							s[i] = 'a'
						else:
							s[i] = 'b'
				elif s[i - 1] == 'a':
					s[i] = 'b'
				elif s[i - 1] == 'b':
					s[i] = 'c'
				else:
					s[i] = 'a'
	if flag:
		i = len(s) - 1
		if s[i] == '?':
			if s[i - 1] == 'a':
				s[i] = 'b'
			elif s[i - 1] == 'b':
				s[i] = 'c'
			else:
				s[i] = 'a'
		for i in s:
			print(i, end='')
		print()


def beautifulstring(s):
	abc = {'a', 'b', 'c'}
	s += '?'
	s = list(s)
	for i in range(len(s) - 1):
		if s[i] == '?':
			c = abc.difference(s[i - 1], s[i + 1])
			c = c.pop()
			s[i] = c
	s.pop(len(s) - 1)
	return ''.join(s)
for _ in range(int(input())):
	string = input()
	string = beautifulstring(string)
	ans = string
	for i in range(len(string) - 1):
		if string[i] == string[i + 1]:
			ans = -1
	print(ans)


t = int(input())
while t:
	s = input()
	ans = ''
	chk = 0
	l = []
	l = list(s)
	for i in range(0, len(l) - 1):
		if l[i] == '?':
			continue
		if l[i] == l[i + 1]:
			print(-1)
			chk = 1
			break
	if chk == 1:
		t = t - 1
	elif len(l) == 1:
		t = t - 1
		if l[0] == '?':
			print('a')
		else:
			print(s)
	else:
		if l[0] == '?':
			if l[1] == 'a':
				l[0] = 'b'
			elif l[1] == 'b':
				l[0] = 'c'
			elif l[1] == 'c':
				l[0] = 'a'
			else:
				l[0] = 'a'
		for i in range(1, len(l) - 1):
			if l[i] == '?':
				if l[i - 1] == 'a':
					if l[i + 1] == 'a':
						l[i] = 'b'
					elif l[i + 1] == 'b':
						l[i] = 'c'
					elif l[i + 1] == 'c':
						l[i] = 'b'
					else:
						l[i] = 'b'
				if l[i - 1] == 'b':
					if l[i + 1] == 'b':
						l[i] = 'c'
					elif l[i + 1] == 'c':
						l[i] = 'a'
					elif l[i + 1] == 'a':
						l[i] = 'c'
					else:
						l[i] = 'c'
				if l[i - 1] == 'c':
					if l[i + 1] == 'c':
						l[i] = 'a'
					elif l[i + 1] == 'a':
						l[i] = 'b'
					elif l[i + 1] == 'b':
						l[i] = 'a'
					else:
						l[i] = 'a'
		if l[len(l) - 1] == '?':
			if l[len(l) - 2] == 'a':
				l[len(l) - 1] = 'b'
			elif l[len(l) - 2] == 'b':
				l[len(l) - 1] = 'c'
			else:
				l[len(l) - 1] = 'a'
		ans = ''.join(l)
		print(ans)
		t = t - 1


t = int(input())
for ii in range(t):
	s = input().rstrip()
	c = ['a', 'b', 'c']
	s = [i for i in s]
	if len(s) == 1:
		if s[0] != '?':
			print(''.join(s))
		else:
			print('a')
		continue
	elif len(s) == 2:
		if s[0] == '?' and s[1] == '?':
			print('ab')
		elif s[0] == '?' and s[1] != '?':
			c = ['a', 'b', 'c']
			for i in c:
				if i != s[1]:
					print(i + s[1])
					break
		elif s[0] != '?' and s[1] == '?':
			c = ['a', 'b', 'c']
			for i in c:
				if i != s[0]:
					print(s[0] + i)
					break
		else:
			print(''.join(s))
		continue
	for i in range(1, len(s) - 1):
		c = ['a', 'b', 'c']
		if s[i] == '?':
			if s[i - 1] == s[i + 1]:
				if s[i - 1] in c:
					c.pop(c.index(s[i - 1]))
				s[i] = c[0]
			else:
				if s[i - 1] in c:
					c.pop(c.index(s[i - 1]))
				if s[i + 1] in c:
					c.pop(c.index(s[i + 1]))
				s[i] = c[0]
	if s[-1] == '?':
		c = ['a', 'b', 'c']
		for i in c:
			if i != s[-2]:
				s[-1] = i
				break
	if s[0] == '?':
		c = ['a', 'b', 'c']
		for i in c:
			if i != s[1]:
				s[0] = i
				break
	flag = 0
	for i in range(1, len(s)):
		if s[i - 1] == s[i]:
			flag = 1
			break
	if flag == 1:
		print(-1)
	else:
		print(''.join(s))


t = int(input())
while t > 0:
	t -= 1
	a = [x for x in input()]
	if len(a) == 1:
		if a[0] == '?':
			print('a')
		else:
			print(a[0])
		continue
	for i in range(len(a)):
		if a[i] == '?':
			if i == 0:
				a[i] = chr(97 + (ord(a[i + 1]) + 1) % 97 % 3)
			elif i == len(a) - 1:
				a[i] = chr(97 + (ord(a[i - 1]) + 1) % 97 % 3)
			elif a[i + 1] == '?':
				a[i] = chr(97 + (ord(a[i - 1]) + 1) % 97 % 3)
			elif a[i - 1] == a[i + 1]:
				a[i] = chr(97 + (ord(a[i - 1]) + 1) % 97 % 3)
			else:
				a[i] = chr(294 - (ord(a[i - 1]) + ord(a[i + 1])))
	p = ord(a[0])
	f = False
	for i in range(1, len(a)):
		if p ^ ord(a[i]) == 0:
			f = True
			break
		p = ord(a[i])
	if f:
		print(-1)
	else:
		print(''.join(a))


def solve(s):
	u = [k for k in s]
	set1 = {'a', 'b', 'c'}
	for (idx, e) in enumerate(u):
		if 0 <= idx + 1 < len(u) and u[idx] != '?' and (u[idx + 1] != '?') and (u[idx] == u[idx + 1]):
			return -1
		if e == '?':
			set2 = {u[k] for k in [idx + 1, idx - 1] if 0 <= k < len(u) and u[k] != '?'}
			intersection = set1 - set2
			u[idx] = [j for j in intersection][0]
	return ''.join(list(map(str, u)))
for _ in range(int(input())):
	print(solve(input()))


def check_beauty(arr):
	itoc = {0: 'a', 1: 'b', 2: 'c'}
	ctoi = {'a': 0, 'b': 1, 'c': 2}
	arr = [i for i in arr]
	n = len(arr)
	current_element = '?'
	for (i, element) in enumerate(arr):
		if arr[i] == '?':
			if current_element == '?':
				current_element = 0
			else:
				current_element = (current_element + 1) % 3
			if i <= n - 2 and arr[i + 1] != '?' and (current_element == ctoi[arr[i + 1]]):
				current_element = (current_element + 1) % 3
			arr[i] = itoc[current_element]
		else:
			i_element = ctoi[arr[i]]
			if i_element == current_element:
				return -1
			current_element = i_element
	return ''.join(arr)
n = int(input())
for _ in range(n):
	print(check_beauty(input()))


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


x = int(input())
for i in range(x):
	y = list(input())
	if len(y) > 1:
		if y[0] == '?' and y[1] != 'c':
			y[0] = 'c'
		elif y[0] == '?':
			y[0] = 'a'
	q = True
	for j in range(1, len(y) - 1):
		if y[j] == '?' and y[j - 1] != 'a' and (y[j + 1] != 'a'):
			y[j] = 'a'
		if y[j] == '?' and y[j - 1] != 'b' and (y[j + 1] != 'b'):
			y[j] = 'b'
		if y[j] == '?' and y[j - 1] != 'c' and (y[j + 1] != 'c'):
			y[j] = 'c'
	if len(y) > 1:
		if y[len(y) - 1] == '?' and y[len(y) - 2] != 'c':
			y[len(y) - 1] = 'c'
		elif y[len(y) - 1] == '?':
			y[len(y) - 1] = 'a'
	elif y[0] == '?':
		y[0] = 'a'
	for j in range(len(y) - 1):
		if y[j] == y[j + 1]:
			q = False
	if q:
		print(''.join(y))
	else:
		print('-1')


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 beautiful(s):
	for i in range(1, len(s)):
		if s[i] == s[i - 1] and s[i] != '?':
			print(-1)
			return
	s = list(s)
	for i in range(1, len(s)):
		v = ['?', 'a', 'b', 'c']
		if s[i] == '?':
			v.remove(s[i - 1])
			if i < len(s) - 1 and s[i + 1] in v:
				v.remove(s[i + 1])
			s[i] = v.pop()
	if s[0] == '?':
		v = ['?', 'a', 'b', 'c']
		if len(s) > 1:
			v.remove(s[1])
		s[0] = v.pop()
	for i in s:
		print(i, end='')
	print()

def main():
	t = int(input())
	while t > 0:
		a = input()
		beautiful(a)
		t -= 1
main()


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)


n = int(input())
for i in range(n):
	s = input()
	l1 = list(s)
	c = 0
	if s == '?':
		print('a')
		continue
	for i in range(len(l1) - 1):
		if l1[i] == l1[i + 1] and l1[i] != '?':
			c = 1
			print(-1)
			break
	if c == 1:
		continue
	elif l1[0] == '?':
		if l1[1] == '?':
			l1[0] = 'a'
		elif l1[1] == 'a' or l1[1] == 'b':
			l1[0] = 'c'
		elif l1[1] == 'b' or l1[1] == 'c':
			l1[0] = 'a'
		elif l1[1] == 'a' or l1[1] == 'c':
			l1[0] = 'b'
	for i in range(len(l1) - 1):
		if l1[i] == '?':
			if l1[i + 1] == '?' and l1[i - 1] != '?':
				if l1[i - 1] == 'a' or l1[i - 1] == 'b':
					l1[i] = 'c'
				elif l1[i - 1] == 'b' or l1[i - 1] == 'c':
					l1[i] = 'a'
				elif l1[i - 1] == 'a' or l1[i - 1] == 'c':
					l1[i] = 'b'
			if l1[i - 1] != '?' and l1[i + 1] != '?':
				if (l1[i - 1] == 'a' or l1[i - 1] == 'b') and (l1[i + 1] == 'a' or l1[i + 1] == 'b'):
					l1[i] = 'c'
				elif (l1[i - 1] == 'c' or l1[i - 1] == 'b') and (l1[i + 1] == 'c' or l1[i + 1] == 'b'):
					l1[i] = 'a'
				elif (l1[i - 1] == 'c' or l1[i - 1] == 'a') and (l1[i + 1] == 'c' or l1[i + 1] == 'a'):
					l1[i] = 'b'
	if l1[len(l1) - 1] == '?':
		if l1[len(l1) - 2] == 'a' or l1[len(l1) - 2] == 'b':
			l1[len(l1) - 1] = 'c'
		elif l1[len(l1) - 2] == 'b' or l1[len(l1) - 2] == 'c':
			l1[len(l1) - 1] = 'a'
		elif l1[len(l1) - 2] == 'a' or l1[len(l1) - 2] == 'c':
			l1[len(l1) - 1] = 'b'
	st1r = ''
	for i in l1:
		st1r += str(i)
	print(st1r)


for i in ' ' * int(input()):
	s = input()
	news = [''] * len(s)
	breaked = False
	if len(s) == 1:
		if s == '?':
			print('a')
		else:
			print(s)
	else:
		for j in range(len(s) - 1):
			if s[j] != '?' and s[j] == s[j + 1]:
				print(-1)
				breaked = True
				break
			elif s[j] != '?':
				news[j] = s[j]
			else:
				L = ['a', 'b', 'c']
				if j > 0:
					L.remove(news[j - 1])
				if s[j + 1] != '?':
					if s[j + 1] in L:
						L.remove(s[j + 1])
				news[j] = L[0]
		if not breaked:
			if s[-1] != '?':
				news[-1] = s[-1]
			else:
				L = ['a', 'b', 'c']
				L.remove(news[-2])
				news[-1] = L[0]
			for i in news:
				print(i, end='')
			print()


t = int(input())
lis = ['a', 'b', 'c']
for _ in range(t):
	f = 0
	s = list(input())
	i = 0
	if len(s) == 1 and s[0] == '?':
		print('a')
		continue
	if s[0] == '?':
		for k in range(0, 3):
			if s[1] != lis[k]:
				s[0] = lis[k]
			else:
				i = i + 1
	if len(s) == 1:
		ss = ''
		print(ss.join(s))
		continue
	i = 0
	for ind in range(0, len(s) - 1):
		if s[ind] == s[ind + 1] and s[ind] != '?' and (s[ind + 1] != '?'):
			print(-1)
			f = 1
			break
		elif s[ind] == '?':
			i = 0
			for k in range(0, 3):
				if lis[k] != s[ind - 1] and lis[k] != s[ind + 1]:
					s[ind] = lis[k]
				else:
					i = i + 1
	if f == 1:
		f = 0
		continue
	else:
		if s[len(s) - 1] == '?':
			i = 0
			for k in range(0, 3):
				if s[len(s) - 2] != lis[k]:
					s[len(s) - 1] = lis[k]
				else:
					i = i + 1
		ss = ''
		print(ss.join(s))


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


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


from collections import Counter
for t in range(int(input())):
	s = list(input())
	b = True
	for i in range(len(s)):
		c = Counter(s[max(i - 1, 0):min(i + 1, len(s) - 1) + 1])
		if s[i] == '?':
			for e in ['a', 'b', 'c']:
				if e not in c.keys():
					s[i] = e
		if i > 0 and s[i] == s[i - 1]:
			print(-1)
			b = False
			break
	if b:
		print(''.join(s))


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):
	f = 0
	s = input()
	s = list(s)
	l = ['a', 'b', 'c']
	for i in range(len(s) - 1):
		if s[i] == '?':
			for j in range(len(l)):
				if s[i + 1] != l[j] and s[i - 1] != l[j]:
					s[i] = l[j]
	if s[-1] == '?':
		if len(s) > 1:
			if s[-2] == 'a':
				s[-1] = 'b' or 'c'
			if s[-2] == 'b':
				s[-1] = 'a' or 'c'
			if s[-2] == 'c':
				s[-1] = 'b' or 'a'
		else:
			s[-1] = 'a'
	s = ''.join(s)
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			f = 1
	if f == 1:
		print(-1)
	if f == 0:
		print(s)


from math import ceil
from math import factorial
import collections
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
t = ii()
for i in range(t):
	s = list(input())
	n = len(s)
	flag = 1
	if n > 1:
		if s[0] == '?' and (s[1] == 'b' or s[1] == '?'):
			s[0] = 'a'
		elif s[0] == '?' and (s[1] == 'a' or s[1] == '?'):
			s[0] = 'c'
		elif s[0] == '?' and (s[1] == 'c' or s[1] == '?'):
			s[0] = 'a'
	else:
		s[0] = 'a'
	for i in range(n):
		if i < n - 1 and s[i] != '?' and (s[i] == s[i + 1]):
			flag = 0
			break
		elif s[i] == '?' and i > 0 and (s[i - 1] == 'a' or s[i - 1] == 'b') and (i < n - 1) and (s[i + 1] == 'b' or s[i + 1] == 'a') or (s[i] == '?' and i > 0 and (s[i - 1] == 'a') and (i < n - 1) and (s[i + 1] == '?')) or (s[i] == '?' and i > 0 and (s[i - 1] == 'a') and (i == n - 1)):
			s[i] = 'c'
		elif s[i] == '?' and i > 0 and (s[i - 1] == 'a' or s[i - 1] == 'b') and (i < n - 1) and (s[i + 1] == 'b' or s[i + 1] == 'a') or (s[i] == '?' and i > 0 and (s[i - 1] == 'b') and (i < n - 1) and (s[i + 1] == '?')) or (s[i] == '?' and i > 0 and (s[i - 1] == 'b') and (i == n - 1)):
			s[i] = 'c'
		elif s[i] == '?' and i > 0 and (s[i - 1] == 'c' or s[i - 1] == 'b') and (i < n - 1) and (s[i + 1] == 'b' or s[i + 1] == 'c') or (s[i] == '?' and i > 0 and (s[i - 1] == 'b') and (i < n - 1) and (s[i + 1] == '?')) or (s[i] == '?' and i > 0 and (s[i - 1] == 'b') and (i == n - 1)):
			s[i] = 'a'
		elif s[i] == '?' and i > 0 and (s[i - 1] == 'c' or s[i - 1] == 'b') and (i < n - 1) and (s[i + 1] == 'b' or s[i + 1] == 'c') or (s[i] == '?' and i > 0 and (s[i - 1] == 'c') and (i < n - 1) and (s[i + 1] == '?')) or (s[i] == '?' and i > 0 and (s[i - 1] == 'c') and (i == n - 1)):
			s[i] = 'a'
		elif s[i] == '?' and i > 0 and (s[i - 1] == 'c' or s[i - 1] == 'a') and (i < n - 1) and (s[i + 1] == 'a' or s[i + 1] == 'c') or (s[i] == '?' and i > 0 and (s[i - 1] == 'c') and (i < n - 1) and (s[i + 1] == '?')) or (s[i] == '?' and i > 0 and (s[i - 1] == 'c') and (i == n - 1)):
			s[i] = 'b'
		elif s[i] == '?' and i > 0 and (s[i - 1] == 'c' or s[i - 1] == 'a') and (i < n - 1) and (s[i + 1] == 'a' or s[i + 1] == 'c') or (s[i] == '?' and i > 0 and (s[i - 1] == 'a') and (i < n - 1) and (s[i + 1] == '?')) or (s[i] == '?' and i > 0 and (s[i - 1] == 'a') and (i == n - 1)):
			s[i] = 'b'
	if flag == 0:
		print(-1)
	else:
		print(''.join(s))


for _ in range(int(input())):
	s = input()
	st = {'a', 'b', 'c'}
	l = len(s)
	ans = ''
	flag = 0
	for i in range(l):
		if s[i] != '?':
			if i < l - 1:
				if s[i] == s[i + 1]:
					flag = 1
			ans += s[i]
		else:
			k = set()
			if i > 0:
				k.add(ans[i - 1])
			if i < l - 1:
				k.add(s[i + 1])
			p = st - k
			put = p.pop()
			ans += put
		if flag:
			break
	if flag:
		print(-1)
	else:
		print(ans)


def get_char(prev, nxt):
	q = {'a', 'b', 'c'}
	if prev and prev != '?':
		q.remove(prev)
	if nxt and nxt != prev and (nxt != '?'):
		q.remove(nxt)
	return q.pop()
n = int(input())
while n > 0:
	s = input()
	a = ''
	good = True
	for (i, k) in enumerate(s):
		try:
			prev = a[i - 1]
		except Exception:
			prev = None
		try:
			nxt = s[i + 1]
		except Exception:
			nxt = None
		if nxt is not None and k != '?' and (k == nxt):
			good = False
		if not good:
			print(-1)
			break
		if k == '?':
			z = get_char(prev, nxt)
			a += z
			continue
		else:
			if prev and i == prev:
				good = False
			if nxt and nxt != '?' and (i == nxt):
				good = False
			if good:
				a += k
			else:
				break
	if good:
		print(a)
	n -= 1


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


for _ in range(int(input())):
	s = list('_' + input() + '_')
	for (i, j) in enumerate(s):
		if s[i] == '?':
			d = {'a', 'b', 'c'}
			if s[i - 1] in d:
				d.remove(s[i - 1])
			if s[i + 1] in d:
				d.remove(s[i + 1])
			s[i] = list(d)[0]
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			print(-1)
			break
	else:
		print(''.join(s[1:-1]))


t = int(input())
ans = []
d = {'?': 0, 'a': 1, 'b': 2, 'c': 4}
for _ in range(t):
	s = list(input())
	flag = False
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			ans.append(-1)
			flag = True
			break
	if flag:
		continue
	a = [0] + [d[c] for c in s] + [0]
	for i in range(1, len(s) + 1):
		if a[i]:
			continue
		b = a[i - 1] | a[i + 1]
		if b & 1 == 0:
			a[i] = 1
			s[i - 1] = 'a'
		elif b & 2 == 0:
			a[i] = 2
			s[i - 1] = 'b'
		else:
			a[i] = 4
			s[i - 1] = 'c'
	ans.append(''.join(s))
print(*ans, sep='\n')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 9 + 7
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	s = input()
	n = len(s)
	ans = []
	ok = True
	i = 0
	prev = 'a'
	agla = 'a'
	while i < n:
		if s[i] == '?':
			if i - 1 >= 0:
				prev = s[i - 1]
			i += 1
			c = 1
			while i < n and s[i] == '?':
				i += 1
				c += 1
			if i < n:
				agla = s[i]
			ans.append((prev, agla, c))
		else:
			ans.append(s[i])
			i += 1
			while i < n and s[i] != '?':
				if s[i] == s[i - 1]:
					ok = False
				ans.append(s[i])
				i += 1
	if not ok:
		print(-1)
	else:
		for i in ans:
			if len(i) == 1:
				print(i, end='')
			else:
				(prev, agla, c) = i
				here = [i for i in 'abc' if i not in (prev, agla)]
				if agla == prev:
					here = here[0] + here[1]
				else:
					here = here[0] + prev
				ind = 0
				for i in range(c):
					print(here[ind], end='')
					ind = (ind + 1) % 2
		print()


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


s = []
t = int(input())
for j in range(t):
	s.append(input())
output = []
for i in range(len(s)):
	t = list(s[i])
	if len(t) == 1 and t[0] == '?':
		t[0] = 'a'
	if t[0] == '?' and t[1] == 'a':
		t[0] = 'b' or 'c'
	elif t[0] == '?' and t[1] == 'b':
		t[0] = 'a' or 'c'
	elif t[0] == '?' and t[1] == 'c':
		t[0] = 'b' or 'a'
	elif t[0] == '?' and t[1] == '?':
		t[0] = 'a'
	if t[len(t) - 1] == '?' and t[len(t) - 2] == 'a':
		t[len(t) - 1] = 'b' or 'c'
	elif t[len(t) - 1] == '?' and t[len(t) - 2] == 'b':
		t[len(t) - 1] = 'a' or 'c'
	elif t[len(t) - 1] == '?' and t[len(t) - 2] == 'c':
		t[len(t) - 1] = 'b' or 'a'
	elif t[len(t) - 1] == '?' and t[len(t) - 2] == '?':
		t[len(t) - 1] = 'b' or 'a'
	for j in range(1, len(t) - 1):
		if t[j - 1] == 'a' and t[j] == '?' and (t[j + 1] == 'b'):
			t[j] = 'c'
		elif t[j - 1] == 'a' and t[j] == '?' and (t[j + 1] == 'c'):
			t[j] = 'b'
		elif t[j - 1] == 'a' and t[j] == '?' and (t[j + 1] == '?'):
			t[j] = 'b' or 'c'
		elif t[j - 1] == 'b' and t[j] == '?' and (t[j + 1] == 'a'):
			t[j] = 'c'
		elif t[j - 1] == 'b' and t[j] == '?' and (t[j + 1] == 'c'):
			t[j] = 'a'
		elif t[j - 1] == 'b' and t[j] == '?' and (t[j + 1] == '?'):
			t[j] = 'c' or 'a'
		elif t[j - 1] == 'c' and t[j] == '?' and (t[j + 1] == 'a'):
			t[j] = 'b'
		elif t[j - 1] == 'c' and t[j] == '?' and (t[j + 1] == 'b'):
			t[j] = 'a'
		elif t[j - 1] == 'c' and t[j] == '?' and (t[j + 1] == '?'):
			t[j] = 'a' or 'b'
		elif t[j - 1] == 'c' and t[j] == '?' and (t[j + 1] == 'c'):
			t[j] = 'a' or 'b'
		elif t[j - 1] == 'a' and t[j] == '?' and (t[j + 1] == 'a'):
			t[j] = 'c' or 'b'
		elif t[j - 1] == 'b' and t[j] == '?' and (t[j + 1] == 'b'):
			t[j] = 'c' or 'a'
		elif t[j - 1] == '?' and t[j] == '?' and (t[j + 1] == '?'):
			t[j] = 'a' or 'b' or 'c'
	output.append(t)
L = []
for i in range(len(output)):
	str1 = ''.join((str(e) for e in output[i]))
	L.append(str1)
a = ''
for i in range(len(L)):
	if 'aa' in L[i] or 'bb' in L[i] or 'cc' in L[i]:
		a += '-1\n'
	else:
		a += str(L[i]) + '\n'
print(a)


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


t = int(input())
for _ in range(t):
	string = list(input())
	string.insert(0, '?')
	string.append('?')
	l = len(string)
	a = True
	for i in range(1, l - 1):
		if string[i] == '?':
			for j in ['a', 'b', 'c']:
				if string[i - 1] != j and string[i + 1] != j:
					string[i] = j
		elif string[i] == string[i + 1]:
			print(-1)
			a = False
			break
	string = ''.join(string)[1:l - 1]
	if a:
		print(string)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
qwe = dict()
alb = 'abc?'
for a in alb:
	for b in alb:
		for c in alb:
			cnt = [0, 0, 0]
			for d in range(3):
				if a == alb[d]:
					cnt[d] += 1
				if b == alb[d]:
					cnt[d] += 1
				if c == alb[d]:
					cnt[d] += 1
			qwe[a + b + c] = chr(ord('a') + cnt.index(min(cnt)))

def solve():
	s = list(minp())
	if len(s) == 1:
		print('a')
	elif len(s) == 2:
		if s[0] == '?':
			s[0] = qwe[s[0] + s[1] + '?']
		if s[1] == '?':
			s[1] = qwe[s[0] + s[1] + '?']
		print(''.join(s))
	else:
		if s[0] == '?':
			s[0] = qwe[s[0] + s[1] + s[2]]
		for i in range(1, len(s) - 1):
			if s[i] == '?':
				s[i] = qwe[s[i - 1] + s[i] + s[i + 1]]
		if s[-1] == '?':
			s[-1] = qwe[s[-3] + s[-2] + s[-1]]
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				print(-1)
				return
		print(''.join(s))
for t in range(mint()):
	solve()


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


from collections import defaultdict

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

def main():
	N = int(input())
	for i in range(N):
		s = list(input())
		M = len(s)
		if M == 1:
			if s[0] == '?':
				print('a')
			else:
				print(s[0])
		else:
			judge = 'Yes'
			if s[0] == '?':
				if s[1] == 'a':
					s[0] = 'b'
				elif s[1] == 'b':
					s[0] = 'c'
				else:
					s[0] = 'a'
			for j in range(1, M - 1):
				if s[j] == '?':
					if s[j + 1] == '?':
						if s[j - 1] == 'a':
							s[j] = 'b'
						elif s[j - 1] == 'b':
							s[j] = 'c'
						else:
							s[j] = 'a'
					else:
						l = [1, 1, 1]
						x = ord(s[j - 1]) - 97
						y = ord(s[j + 1]) - 97
						l[x] = 0
						l[y] = 0
						if l[0] == 1:
							s[j] = 'a'
						elif l[1] == 1:
							s[j] = 'b'
						else:
							s[j] = 'c'
			if s[M - 1] == '?':
				if s[M - 2] == 'a':
					s[M - 1] = 'b'
				elif s[M - 2] == 'b':
					s[M - 1] = 'c'
				else:
					s[M - 1] = 'a'
			for j in range(M - 1):
				if s[j] == s[j + 1]:
					judge = 'No'
			if judge == 'No':
				print(-1)
			else:
				print(''.join(s))
L = [chr(i) for i in range(97, 123)]
main()


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())
for i in range(int(t)):
	e = input()
	e = list(e)
	u = len(e)
	rt = 0
	if e[0] == '?':
		if len(e) >= 2:
			y1 = ['a', 'b', 'c', '?']
			y1.remove(e[1])
			e[0] = y1[0]
		else:
			e = ['a']
	for j in range(1, u):
		if e[j] == e[j - 1]:
			print('-1')
			rt = 1
			break
		elif e[j] == '?':
			y = ['a', 'b', 'c', '?', 'a', 'b', 'c', '?']
			y.remove(e[j - 1])
			try:
				y.remove(e[j + 1])
			except:
				wer = 0
			e[j] = y[0]
	if rt == 0:
		print(*e, sep='')


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	s = list(input())
	s = [-1] + s + [-1]
	for i in range(1, len(s) - 1):
		s1 = {'a', 'b', 'c'}
		if s[i] == '?':
			k = {s[i - 1], s[i + 1]}
			ans = list(s1 - k)
			s[i] = ans[0]
	s = s[1:-1]
	f = 1
	for i in range(0, len(s) - 1):
		if s[i] == s[i + 1]:
			f = 0
			break
	if f:
		g = ''.join(s)
		print(g)
	else:
		print(-1)


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)


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


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)


def solve(s):
	if 'aa' in s or 'bb' in s or 'cc' in s:
		return '-1'
	s = list(s)
	if s[0] == '?':
		if len(s) > 1:
			if s[1] == 'a':
				s[0] = 'b'
			else:
				s[0] = 'a'
		else:
			s[0] = 'a'
	for i in range(1, len(s)):
		if s[i] == '?':
			if i < len(s) - 1 and s[i + 1] != '?':
				if 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] == 'b':
					s[i] = 'a'
				else:
					s[i] = 'b'
			elif s[i - 1] == 'a':
				s[i] = 'b'
			else:
				s[i] = 'a'
	return ''.join(s)
tests = int(input())
res = []
for i in range(tests):
	res.append(solve(input()))
print('\n'.join(res))


n = int(input())
for _ in range(n):
	string = input()
	output = ['', *string]
	if 'aa' in string or 'bb' in string or 'cc' in string:
		print(-1)
	else:
		i = 0
		for x in string:
			i = i + 1
			if x == '?':
				output[i] = ({*'abc'} - {*output[i - 1:i + 2]}).pop()
		print(''.join(output))


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)


import math
for _ in range(int(input())):
	s = list(input())
	n = len(s)
	ans = 0
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			ans = -1
			break
	for i in range(n):
		if s[i] == '?':
			if n == 1:
				s[i] = 'a'
			elif i + 1 < n and i - 1 > -1:
				if s[i + 1] == 'a' and s[i - 1] == 'b' or (s[i + 1] == 'b' and s[i - 1] == 'a'):
					s[i] = 'c'
				elif s[i + 1] == 'b' and s[i - 1] == 'c' or (s[i + 1] == 'c' and s[i - 1] == 'b'):
					s[i] = 'a'
				elif s[i + 1] == 'a' and s[i - 1] == 'c' or (s[i + 1] == 'c' and s[i - 1] == 'a'):
					s[i] = 'b'
				elif s[i + 1] == '?' and s[i - 1] == 'a':
					s[i] = 'c'
				elif s[i + 1] == '?' and s[i - 1] == 'b':
					s[i] = 'a'
				elif s[i + 1] == '?' and s[i - 1] == 'c':
					s[i] = 'b'
				elif s[i + 1] == 'a' and s[i - 1] == 'a':
					s[i] = 'c'
				elif s[i + 1] == 'b' and s[i - 1] == 'b':
					s[i] = 'a'
				elif s[i + 1] == 'c' and s[i - 1] == 'c':
					s[i] = 'b'
			elif i == 0:
				if s[i + 1] == 'a':
					s[i] = 'b'
				elif s[i + 1] == 'b':
					s[i] = 'a'
				elif s[i + 1] == 'c':
					s[i] = 'b'
				else:
					s[i] = 'a'
			elif i == n - 1:
				if s[i - 1] == 'a':
					s[i] = 'b'
				elif s[i - 1] == 'b':
					s[i] = 'a'
				elif s[i - 1] == 'c':
					s[i] = 'b'
				else:
					s[i] = 'a'
	if ans == -1:
		print(-1)
	else:
		print(''.join((str(p) for p in s)))


for _ in range(int(input())):
	a = [x for x in input()]
	n = len(a) - 1
	str1 = ''
	r = 1
	for i in range(n, -1, -1):
		if a[i] == '?':
			if i + 1 <= n and a[i + 1] == 'b':
				if i - 1 >= 0 and a[i - 1] == 'a':
					a[i] = 'c'
				elif i - 1 >= 0 and a[i - 1] == 'b':
					a[i] = 'c'
				elif i - 1 >= 0 and a[i - 1] == 'c':
					a[i] = 'a'
				else:
					a[i] = 'a'
			elif i + 1 <= n and a[i + 1] == 'a':
				if i - 1 >= 0 and a[i - 1] == 'a':
					a[i] = 'b'
				elif i - 1 >= 0 and a[i - 1] == 'b':
					a[i] = 'c'
				elif i - 1 >= 0 and a[i - 1] == 'c':
					a[i] = 'b'
				else:
					a[i] = 'b'
			elif i + 1 <= n and a[i + 1] == 'c':
				if i - 1 >= 0 and a[i - 1] == 'a':
					a[i] = 'b'
				elif i - 1 >= 0 and a[i - 1] == 'b':
					a[i] = 'a'
				elif i - 1 >= 0 and a[i - 1] == 'c':
					a[i] = 'b'
				else:
					a[i] = 'b'
			elif i - 1 >= 0 and a[i - 1] == 'a':
				a[i] = 'b'
			elif i - 1 >= 0 and a[i - 1] == 'b':
				a[i] = 'c'
			elif i - 1 >= 0 and a[i - 1] == 'c':
				a[i] = 'b'
			else:
				a[i] = 'b'
	for i in range(n + 1):
		if i != n and a[i] == a[i + 1]:
			r = 0
			break
		str1 += a[i]
	print('-1' if r == 0 else str1)


for _ in range(int(input())):
	s = list(input())
	if len(s) == 1:
		if s[0] == '?':
			print('a')
	else:
		for i in range(len(s)):
			if s[i] == '?':
				if i == 0:
					if s[i + 1] == '?' or s[i + 1] == 'c':
						s[i] = 'a'
					elif s[i + 1] == 'a' or s[i + 1] == 'b':
						s[i] = 'c'
				if i == len(s) - 1:
					if s[i - 1] == '?' or s[i - 1] == 'c':
						s[i] = 'a'
					elif s[i - 1] == 'a' or s[i - 1] == 'b':
						s[i] = 'c'
				elif s[i - 1] == 'a' and s[i + 1] == 'b' or (s[i - 1] == 'b' and s[i + 1] == 'a') or (s[i - 1] == 'a' and s[i + 1] == '?'):
					s[i] = 'c'
				elif s[i - 1] == 'b' and s[i + 1] == 'c' or (s[i - 1] == 'c' and s[i + 1] == 'b') or (s[i - 1] == 'b' and s[i + 1] == '?'):
					s[i] = 'a'
				elif s[i - 1] == 'a' and s[i + 1] == 'c' or (s[i - 1] == 'c' and s[i + 1] == 'a') or (s[i - 1] == 'c' and s[i + 1] == '?'):
					s[i] = 'b'
				elif s[i - 1] == 'a' and s[i + 1] == 'a' or (s[i - 1] == 'b' and s[i + 1] == 'b'):
					s[i] = 'c'
				elif s[i - 1] == 'c' and s[i + 1] == 'c':
					s[i] = 'b'
		signal = 1
		for i in range(len(s) - 1):
			if s[i] == s[i + 1]:
				signal = 0
				break
		if signal == 0:
			print(-1)
		else:
			for i in s:
				print(i, end='')
			print()


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

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

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
t = oint()
for _ in range(t):
	s = list(input())
	flag = 0
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			flag = 1
			break
	if flag:
		print(-1)
		continue
	s = ['d'] + s + ['d']
	for i in range(1, len(s)):
		if s[i] != '?':
			continue
		next1 = s[i + 1]
		if next1 == '?':
			next2 = s[i + 2]
			if next2 == '?':
				if s[i - 1] == 'd':
					s[i] = 'a'
				else:
					s[i] = chr((ord(s[i - 1]) - ord('a') + 1) % 3 + ord('a'))
			else:
				s[i] = chr((ord(s[i - 1]) - ord('a') + 1) % 3 + ord('a'))
		else:
			s[i] = chr((ord(s[i - 1]) - ord('a') + 1) % 3 + ord('a'))
			if s[i] == s[i + 1]:
				s[i] = chr((ord(s[i]) - ord('a') + 1) % 3 + ord('a'))
	print(''.join(s[1:-1]))


t = int(input())
V = set(['a', 'b', 'c'])

def solve():
	s = input()
	res = [None] * len(s)
	res[0] = s[0]
	if s[0] == '?':
		if len(s) < 2:
			res[0] = 'a'
		elif s[1] == 'a' or s[1] == 'c':
			res[0] = 'b'
		else:
			res[0] = 'a'
	cnt = 0
	for i in range(1, len(s)):
		if s[i] == '?':
			cnt += 1
		else:
			res[i] = s[i]
			if res[i] == res[i - 1]:
				return -1
			if cnt > 0:
				if cnt > 1:
					for j in range(i - cnt, i - 1):
						v = V.copy()
						v.discard(res[j - 1])
						res[j] = v.pop()
					cnt = 1
				if cnt == 1:
					v = V.copy()
					v.discard(s[i])
					v.discard(res[i - 2])
					res[i - 1] = v.pop()
			cnt = 0
	i = len(s)
	if cnt > 0:
		if cnt > 1:
			for j in range(i - cnt, i - 1):
				v = V.copy()
				v.discard(res[j - 1])
				res[j] = v.pop()
			cnt = 1
		if cnt == 1:
			v = V.copy()
			v.discard(res[i - 2])
			res[i - 1] = v.pop()
	return ''.join(res)
for _ in range(t):
	print(solve())


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


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


def bt(words):
	lst = []
	for word in words:
		chars = []
		if len(word) == 1:
			if word[0] == '?':
				chars.append('a')
			else:
				chars.append(word[0])
			lst.append(chars)
			continue
		un = []
		flag = False
		for i in range(len(word) - 1):
			if word[i] != '?' and word[i + 1] != '?':
				if word[i] == word[i + 1]:
					lst.append(-1)
					flag = True
					break
		if flag:
			falg = False
			continue
		for j in range(len(word)):
			if word[j] == '?':
				un.append(j)
			chars.append(word[j])
		for i in un:
			if i == 0:
				pos = chars[i + 1]
				if pos == 'a' or pos == 'b':
					chars[i] = 'c'
				else:
					chars[i] = 'a'
			elif i == len(word) - 1:
				pre = chars[i - 1]
				if pre == 'a' or pre == 'b':
					chars[i] = 'c'
				else:
					chars[i] = 'a'
			else:
				pre = chars[i - 1]
				pos = chars[i + 1]
				if pre == 'a' and pos == 'b' or (pre == 'b' and pos == 'a'):
					chars[i] = 'c'
				elif pre == 'a' and pos == 'c' or (pre == 'c' and pos == 'a'):
					chars[i] = 'b'
				elif pre == 'c' and pos == 'b' or (pre == 'b' and pos == 'c'):
					chars[i] = 'a'
				elif pre == 'a' or pre == 'b':
					chars[i] = 'c'
				else:
					chars[i] = 'a'
		lst.append(chars)
	return lst
numWords = eval(input())
words = []
for i in range(numWords):
	word = input()
	words.append(word)
lst = bt(words)
an = []
for j in lst:
	if j == -1:
		an.append(j)
	else:
		st = ''
		for k in j:
			st = st + k
		an.append(st)
for j in an:
	print(j)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

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

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

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

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		s = list(si())
		flag = 1
		for i in range(len(s) - 1):
			if s[i] == s[i + 1] and s[i] != '?':
				print(-1)
				flag = 0
				break
		if flag == 0:
			continue
		for i in range(1, len(s) - 1):
			if s[i] == '?':
				if s[i - 1] == 'a' and s[i + 1] == 'b':
					s[i] = 'c'
				elif s[i - 1] == 'a' and s[i + 1] == 'c':
					s[i] = 'b'
				elif s[i - 1] == 'c' and s[i + 1] == 'b':
					s[i] = 'a'
				elif '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'
				elif 'c' != s[i - 1] and 'c' != s[i + 1]:
					s[i] = 'c'
		if len(s) == 1:
			if s[0] == '?':
				s[0] = 'a'
		else:
			if s[0] == '?':
				if s[1] != 'a':
					s[0] = 'a'
				elif s[1] != 'b':
					s[0] = 'b'
				elif s[1] != 'b':
					s[0] = 'b'
			x = len(s) - 1
			if s[x] == '?':
				if s[x - 1] != 'a':
					s[x] = 'a'
				elif s[x - 1] != 'b':
					s[x] = 'b'
				elif s[x - 1] != 'b':
					s[x] = 'b'
		for i in s:
			print(i, end='')
		print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def main():
	q = int(input())
	for _ in range(q):
		a = input()
		rv = list(a)
		prev_char = ''
		exit_early = False
		for i in range(len(a)):
			if a[i] == '?':
				if prev_char == 'a':
					rv[i] = 'b'
				else:
					rv[i] = 'a'
			elif a[i] == 'a' and prev_char == 'a':
				if a[i - 1] == '?':
					rv[i - 1] = 'c'
					if i > 1:
						if rv[i - 2] == 'c':
							rv[i - 1] = 'b'
				else:
					print(-1)
					exit_early = True
					break
			elif a[i] == 'b' and prev_char == 'b':
				if a[i - 1] == '?':
					rv[i - 1] = 'c'
					if i > 1:
						if rv[i - 2] == 'c':
							rv[i - 1] = 'b'
				else:
					print(-1)
					exit_early = True
					break
			elif a[i] == 'c' and prev_char == 'c':
				exit_early = True
				print(-1)
				break
			prev_char = rv[i]
		if exit_early:
			continue
		print(''.join(rv))
		for i in range(1, len(rv)):
			if rv[i - 1] == rv[i]:
				print('error')
main()


t = int(input())
for _ in range(t):
	s = list(input())
	s.append('d')
	cs = set('abc')
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			s[i] = (cs - {s[i - 1], s[i + 1]}).pop()
		elif s[i] == s[i - 1]:
			print(-1)
			break
	else:
		if len(s) == 1:
			if s[0] == '?':
				print('a')
			else:
				print(s[0])
			continue
		if s[0] == '?':
			s[0] = (cs - {s[1]}).pop()
		print(''.join(s[:-1]))


t = int(input())
for i in range(t):
	s = list(input())
	flag = 1
	if s[0] == '?' and len(s) == 1:
		print('a')
		continue
	for j in range(len(s)):
		if j != len(s) - 1:
			if s[j] == s[j + 1] and s[j] != '?':
				print(-1)
				flag = 0
				break
		if s[j] == '?':
			if j == 0:
				if s[j + 1] == 'a' or s[j + 1] == 'c':
					s[j] = 'b'
				else:
					s[j] = 'a'
			elif j == len(s) - 1:
				if s[j - 1] == 'a' or s[j - 1] == 'c':
					s[j] = 'b'
				elif s[j - 1] == 'b':
					s[j] = 'a'
			else:
				s[j] = list({'a', 'b', 'c'}.difference({s[j - 1], s[j + 1]}))[0]
	if flag:
		for j in s:
			print(j, end='')
		print()


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)


t = int(input())
for _ in range(t):
	a = list(input())
	n = len(a)
	if n == 1 and a[0] == '?':
		print('a')
		continue
	i = 0
	b = {'a', 'b', 'c'}
	flag = 1
	while i < n:
		if i == 0 and a[i] == '?':
			if i + 1 < n:
				if a[i + 1] == 'a':
					a[i] = 'b'
				else:
					a[i] = 'a'
		elif i == n - 1 and a[i] == '?':
			if i - 1 >= 0 and a[i - 1] == 'a':
				a[i] = 'b'
			else:
				a[i] = 'a'
		elif a[i] == '?' and i + 1 < n and (a[i + 1] == '?'):
			if a[i - 1] == 'a':
				a[i] = 'b'
			else:
				a[i] = 'a'
		elif a[i] == '?' and i + 1 < n and (i - 1 >= 0):
			x = {a[i - 1], a[i + 1]}
			x = list(b - x)
			a[i] = x[0]
		if i + 1 < n and a[i] == a[i + 1] or (i - 1 >= 0 and a[i - 1] == a[i]):
			flag = 0
			break
		i += 1
	if flag:
		print(''.join(a))
	else:
		print(-1)


n = int(input())
f = 'abc'
p = '8'
for i in range(n):
	s = list(str(input()))
	if len(s) == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s[0])
	else:
		for t in range(len(s) - 1):
			if s[t] == '?':
				for j in f:
					if j != p and j != s[t + 1]:
						s[t] = j
						break
			p = s[t]
		if s[-1] == '?':
			if s[-2] == 'a':
				s[-1] = 'b'
			else:
				s[-1] = 'a'
		p = ''
		flag = False
		for t in range(len(s)):
			if s[t] == p:
				flag = True
				break
			p = s[t]
		if s.count('?') == 0 and (not flag):
			for t in range(len(s)):
				print(s[t], end='')
			print()
		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)


def main():

	def solve():
		last = None
		ss = list(input())
		i = 0
		while i < len(ss):
			s = ss[i]
			if s != '?' and s == last:
				print('-1')
				return
			if s == '?':
				for j in range(i + 1, len(ss)):
					if ss[j] != '?':
						break
				else:
					for j in range(i, len(ss)):
						if last == 'a':
							ss[j] = 'b'
						else:
							ss[j] = 'a'
						last = ss[j]
					break
				next = ss[j]
				chars = [x for x in ['a', 'b', 'c'] if x != last and x != next]
				if (j - i) % 2 == 1:
					ss[i] = chars[0]
					i += 1
				for k in range(i, j, 2):
					if next == last or i == 0:
						ss[k] = chars[1]
						ss[k + 1] = chars[0]
					else:
						ss[k] = next
						ss[k + 1] = chars[0]
				i = j + 1
				last = ss[j]
			else:
				last = s
				i += 1
		print(''.join(ss))
	q = int(input())
	for _ in range(q):
		solve()
main()


for _ in range(int(input())):
	s = str(input())
	l = list(s)
	l1 = [0] * len(s)
	f = 0
	if len(l) == 1:
		if l[0] == '?':
			print('a')
		else:
			print(l[0])
	elif len(l) > 1:
		if l[0] == '?':
			if l[1] == 'a':
				l[0] = 'b'
			else:
				l[0] = 'a'
		for i in range(1, len(l)):
			if l[i] != '?':
				if l[i] == l[i - 1]:
					f = 1
					break
			elif i != len(l) - 1:
				if l[i - 1] == 'a':
					if l[i + 1] == 'a':
						l[i] = 'c'
					elif l[i + 1] == 'b':
						l[i] = 'c'
					elif l[i + 1] == 'c':
						l[i] = 'b'
					else:
						l[i] = 'b'
				elif l[i - 1] == 'b':
					if l[i + 1] == 'a':
						l[i] = 'c'
					elif l[i + 1] == 'b':
						l[i] = 'c'
					elif l[i + 1] == 'c':
						l[i] = 'a'
					else:
						l[i] = 'a'
				elif l[i - 1] == 'c':
					if l[i + 1] == 'a':
						l[i] = 'b'
					elif l[i + 1] == 'b':
						l[i] = 'a'
					elif l[i + 1] == 'c':
						l[i] = 'a'
					else:
						l[i] = 'a'
			elif l[i - 1] == 'a':
				l[i] = 'c'
			else:
				l[i] = 'a'
		if f == 1:
			print('-1')
		else:
			for i in l:
				print(i, end='')
			print()


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


import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

def solve():
	S = 'e' + input()[:-1] + 'e'
	ans = ''
	prev = ''
	prev_alphabet = ''
	seq = 0
	CAND = {'a', 'b', 'c'}
	for c in S:
		if c != '?':
			if seq != 0:
				last_alphabet = c
				if last_alphabet != prev_alphabet:
					not_used = list(CAND - ({last_alphabet} | {prev_alphabet}))
					if len(not_used) > 1:
						p1 = not_used[1]
						p2 = not_used[0]
						ans += (p1 + p2) * (seq // 2) + p1 * (seq % 2)
					elif len(not_used) == 1:
						p1 = last_alphabet
						p2 = prev_alphabet
						ans += (last_alphabet + prev_alphabet) * (seq // 2) + not_used[0] * (seq % 2)
				else:
					not_used = list(CAND - {last_alphabet})
					(not_used1, not_used2) = (not_used[0], not_used[1])
					ans += (not_used1 + not_used2) * (seq // 2) + not_used1 * (seq % 2)
			ans += c
			seq = 0
			prev_alphabet = ''
			last_alphabet = ''
			prev = c
		else:
			prev_alphabet = prev
			seq += 1
	ans = ans[1:-1]
	if any((v * 2 in ans for v in CAND)):
		print(-1)
	else:
		print(ans)
N = int(input())
for _ in range(N):
	solve()


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


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


for _ in [0] * int(input()):
	s = input()
	if any((x + x in s for x in 'abc')):
		print(-1)
	else:
		s = [0, *s, 0]
		for i in range(len(s)):
			if s[i] == '?':
				s[i] = (set('abc') - {s[i - 1], s[i + 1]}).pop()
		print(''.join(s[1:-1]))


def check(s):
	chec = True
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			chec = False
			break
	return chec
T = int(input())
for _ in range(T):
	s = list(input())
	for i in range(len(s)):
		if s[i] == '?':
			if i == 0:
				if len(s) > 1:
					if s[i + 1] == 'a':
						s[i] = 'b'
					elif s[i + 1] == 'b':
						s[i] = 'c'
					elif s[i + 1] == 'c':
						s[i] = 'a'
					else:
						s[i] = 'a'
				else:
					s[i] = 'a'
				continue
			if i == len(s) - 1:
				if s[i - 1] == 'a':
					s[i] = 'b'
				elif s[i - 1] == 'b':
					s[i] = 'c'
				elif s[i - 1] == 'c':
					s[i] = 'a'
				continue
			rep = [s[i - 1], s[i + 1]]
			rep.sort()
			if rep == ['a', 'b']:
				s[i] = 'c'
			elif rep == ['a', 'c']:
				s[i] = 'b'
			elif rep == ['b', 'c']:
				s[i] = 'a'
			elif s[i - 1] == 'a':
				s[i] = 'b'
			elif s[i - 1] == 'b':
				s[i] = 'c'
			elif s[i - 1] == 'c':
				s[i] = 'a'
	if check(s):
		print(''.join(s))
	else:
		print('-1')


t = int(input())

def worker(l, S):
	l += 1
	for j in range(l):
		if S[j] == '?':
			if j != 0 and j != l - 1:
				if S[j - 1] == 'a':
					if S[j + 1] == 'b':
						S[j] = 'c'
					else:
						S[j] = 'b'
				if S[j - 1] == 'b':
					if S[j + 1] == 'a':
						S[j] = 'c'
					else:
						S[j] = 'a'
				if S[j - 1] == 'c':
					if S[j + 1] == 'b':
						S[j] = 'a'
					else:
						S[j] = 'b'
			elif j == l - 1:
				if S[j - 1] == 'a':
					S[j] = 'b'
				else:
					S[j] = 'a'
			elif S[j + 1] == '?':
				S[j] = 'a'
			elif S[j + 1] == 'a':
				S[j] = 'b'
			else:
				S[j] = 'a'
	print(''.join(S))
for i in range(t):
	flag = 0
	S = list(input())
	l = len(S) - 1
	for j in range(l):
		if S[j] != '?' and S[j + 1] != '?':
			if S[j] == S[j + 1]:
				print(-1)
				flag = 1
				break
	if flag == 0:
		worker(l, S)


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


t = int(input())
for t1 in range(t):
	a = list(input())
	f = 0
	for i in range(len(a) - 1):
		if a[i] != '?' and a[i + 1] != '?' and (a[i] == a[i + 1]):
			f = 1
			break
	if f == 1:
		print('-1')
	else:
		f = 0
		pre = 0
		for i in range(len(a)):
			if i == 0 and a[i] == '?':
				s = ['a', 'b', 'c']
				if i != len(a) - 1 and a[i + 1] in s:
					s.remove(a[i + 1])
				a[i] = s[0]
				pre = a[i]
			elif i == len(a) - 1 and a[i] == '?':
				s = ['a', 'b', 'c']
				if pre in s:
					s.remove(pre)
				a[i] = s[0]
			elif a[i] == '?' and a[i + 1] == '?':
				if pre == 'c':
					a[i] = 'a'
					pre = a[i]
				else:
					a[i] = chr(ord(pre) + 1)
					pre = a[i]
			elif a[i] == '?' and a[i + 1] != '?':
				s = ['a', 'b', 'c']
				if pre in s:
					s.remove(pre)
				if a[i + 1] in s:
					s.remove(a[i + 1])
				a[i] = s[0]
				pre = a[i]
			else:
				pre = a[i]
		print(*a, sep='')


t = int(input())
for _ in range(t):
	s = input()
	flag = 0
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] in ['a', 'b', 'c']:
			flag = 1
			break
	if flag == 1:
		print(-1)
		continue
	arr = []
	s = list(s)
	flag = 0
	s = ['~'] + s + ['~']
	temp = []
	for i in range(len(s) - 1):
		if s[i + 1] == '?' and flag == 0:
			temp += [s[i]]
			flag = 1
			continue
		if flag == 1:
			temp += [i]
		if flag == 1 and s[i + 1] != '?':
			temp += [s[i + 1]]
			arr += [temp[:]]
			temp = []
			flag = 0
	for x in arr:
		for y in ['a', 'b', 'c']:
			if y not in x:
				one = y
		for y in ['a', 'b', 'c']:
			if y != one and y != x[len(x) - 1]:
				two = y
		lol = one
		for y in range(1, len(x) - 1):
			s[x[y]] = lol
			if lol == one:
				lol = two
			else:
				lol = one
	for i in range(1, len(s) - 1):
		print(s[i], end='')
	print('')


for _ in range(int(input())):
	s = [i for i in input()]
	f = 0
	c = 0
	i = 0
	n = len(s)
	k = ''
	while i < len(s):
		if s[i] == '?':
			a = '' if i == 0 else s[i - 1]
			c = 0
			while i < len(s) and s[i] == '?':
				c += 1
				i += 1
			b = s[i] if i != n else ' '
			if c == n:
				y = ''.join(list(set(['a', 'b', 'c']) - set(['a'])))
				k = k + y * (c // 2) + y[0] * (c % 2)
				break
			if a != b:
				x = ''.join(list(set(['a', 'b', 'c']) - set([a, b])))
				y = (x + a) * (c // len(x + a)) + x[:c % len(x + a)]
				k = k + y
			else:
				y = ''.join(list(set(['a', 'b', 'c']) - set([a])))
				k = k + y * (c // 2) + y[0] * (c % 2)
		elif i != n - 1 and s[i] == s[i + 1]:
			f = 1
			break
		else:
			k += s[i]
			i += 1
	if f:
		print(-1)
	else:
		print(k)


for t in range(int(input())):
	s = list(input())
	do_print = True
	for i in range(len(s)):
		if s[i] == '?':
			choose = ['a', 'b', 'c']
			if s[(i - 1) % len(s)] in choose:
				choose.remove(s[(i - 1) % len(s)])
			if s[(i + 1) % len(s)] in choose:
				choose.remove(s[(i + 1) % len(s)])
			s[i] = choose[0]
		if i > 0:
			if s[i] == s[i - 1]:
				print(-1)
				do_print = False
				break
	if do_print:
		print(''.join(s))


from collections import defaultdict
for _ in range(int(input())):
	s = input()
	s = '#' + s + '#'
	n = len(s)
	for i in range(1, n - 1):
		if s[i] != '?':
			continue
		st = set('abc?')
		st.discard(s[i - 1])
		st.discard(s[i + 1])
		s = s[:i] + sorted(list(st))[-1] + s[i + 1:]
	s = s[1:-1]
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			print(-1)
			break
	else:
		print(s)


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 next_let(c):
	if c == 'a':
		return 'b'
	if c == 'b':
		return 'c'
	return 'a'
t = int(input())
for _ in range(t):
	s = [i for i in input()]
	n = len(s)
	if n == 1 and s[0] != '?':
		print(''.join(s))
	elif n == 1:
		print('a')
	else:
		flag = 0
		for i in range(n):
			if i == 0 and s[i] == '?':
				if s[i + 1] != '?':
					s[i] = next_let(s[i + 1])
				else:
					s[i] = 'a'
			elif s[i] == '?':
				s[i] = next_let(s[i - 1])
				if i < n - 1 and s[i + 1] == s[i]:
					s[i] = next_let(s[i])
			if i > 0 and s[i] == s[i - 1]:
				flag = -1
				break
		print(flag if flag else ''.join(s))


for _ in range(int(input())):
	s = input()
	a = ''
	x = 0
	y = 0
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print(-1)
			x = 1
			break
	for i in s:
		if i != '?':
			y = 1
			break
	if x == 1:
		continue
	if y == 0:
		a = 'a'
		for i in range(len(s)):
			if a == 'a':
				print('b', end='')
				a = 'b'
			else:
				print('a', end='')
				a = 'a'
		print()
		continue
	j = 0
	a = ''
	b = 'l'
	k = ['a', 'b', 'c']
	for i in range(len(s)):
		if s[i] == '?':
			j = j + 1
		else:
			if b == 'l':
				b = s[i]
			if j == 0:
				b = s[i]
			elif b == s[i]:
				k.remove(b)
				m = k[0]
				n = k[1]
				for l in range(j):
					if a == '':
						a = a + n
					elif a[-1] == m:
						a = a + n
					else:
						a = a + m
				k = ['a', 'b', 'c']
				j = 0
			else:
				k.remove(b)
				k.remove(s[i])
				m = k[0]
				for l in range(j):
					if a[-1] == b:
						a = a + m
					else:
						a = a + b
				k = ['a', 'b', 'c']
				j = 0
			a = a + s[i]
	if j != 0:
		k.remove(b)
		m = k[0]
		n = k[1]
		for l in range(j):
			if a == '':
				a = a + n
			elif a[-1] == m:
				a = a + n
			else:
				a = a + m
	print(a)


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


t = int(input())
for _ in range(t):
	a = list(input())
	n = len(a)
	if n == 1:
		if a[0] == '?':
			a[0] = 'a'
		print(''.join(a))
		continue
	for i in range(n):
		q = ['a', 'b', 'c']
		p = set(q)
		if i == 0:
			if a[i] == '?':
				if a[i + 1] == '?':
					a[i] = p.pop()
				else:
					p.discard(a[i + 1])
					a[i] = p.pop()
			elif a[i] == a[i + 1]:
				print(-1)
				break
		elif i == n - 1:
			if a[i] == '?':
				p.discard(a[i - 1])
				a[i] = p.pop()
			else:
				pass
		elif a[i] == '?':
			if a[i + 1] == '?':
				p.discard(a[i - 1])
				a[i] = p.pop()
			else:
				p.discard(a[i - 1])
				p.discard(a[i + 1])
				a[i] = p.pop()
		elif a[i] == a[i + 1]:
			print(-1)
			break
		else:
			pass
	else:
		print(''.join(a))


def prev(word, i, letter):
	if letter == '?':
		return True
	if i == 0:
		return True
	if i - 1 >= 0 and word[i - 1] is not letter:
		return True
	return False

def next(word, i, letter):
	if letter == '?':
		return True
	if i == len(word) - 1:
		return True
	if i + 1 <= len(word) and word[i + 1] is not letter:
		return True
	return False

def solve(word):
	pool = ['a', 'b', 'c']
	for i in range(len(word)):
		if word[i] == '?':
			for j in range(len(pool)):
				if prev(word, i, pool[j]) and next(word, i, pool[j]):
					word[i] = pool[j]
		if i < len(word) - 1 and word[i] == word[i + 1]:
			print(-1)
			return
	print(''.join(word))
n = int(input())
a = []
for i in range(n):
	a.append(list(input()))
pool = ['a', 'b', 'c']
for i in range(len(a)):
	solve(a[i])


for _ in range(int(input())):
	a = list(input())
	k = 0
	p = len(a) - 1
	if p > 1:
		if a[0] == '?':
			if a[1] == '?':
				a[0] = 'a'
			elif a[1] == 'a' or a[1] == 'b':
				a[0] = 'c'
			elif a[1] == 'c':
				a[0] = 'a'
		for i in range(1, len(a) - 1):
			if a[i] == '?':
				if a[i - 1] == 'a' and a[i + 1] == 'b':
					a[i] = 'c'
				elif a[i - 1] == 'a' and a[i + 1] == 'a':
					a[i] = 'b'
				elif a[i - 1] == 'a' and a[i + 1] == 'c':
					a[i] = 'b'
				elif a[i - 1] == 'a' and a[i + 1] == '?':
					a[i] = 'b'
				elif a[i - 1] == 'b' and a[i + 1] == 'b':
					a[i] = 'c'
				elif a[i - 1] == 'b' and a[i + 1] == 'a':
					a[i] = 'c'
				elif a[i - 1] == 'b' and a[i + 1] == 'c':
					a[i] = 'a'
				elif a[i - 1] == 'b' and a[i + 1] == '?':
					a[i] = 'c'
				elif a[i - 1] == 'c' and a[i + 1] == 'c':
					a[i] = 'a'
				elif a[i - 1] == 'c' and a[i + 1] == 'b':
					a[i] = 'a'
				elif a[i - 1] == 'c' and a[i + 1] == 'a':
					a[i] = 'b'
				elif a[i - 1] == 'c' and a[i + 1] == '?':
					a[i] = 'b'
			elif a[i] == a[i - 1] or a[i] == a[i + 1]:
				k += 1
		if a[p] == '?':
			if a[p - 1] == 'a' or a[p - 1] == 'b':
				a[p] = 'c'
			elif a[p - 1] == 'c':
				a[p] = 'a'
		r = ''.join([str(i) for i in a])
		if k > 0:
			print(-1)
		else:
			print(r)
	elif p == 1:
		if a[0] == '?':
			if a[1] == 'a' or a[1] == 'b':
				a[0] = 'c'
			elif a[1] == 'c':
				a[0] = 'a'
			elif a[1] == '?':
				a[0] = 'a'
				a[1] = 'b'
			r = ''.join([str(i) for i in a])
			print(r)
		elif a[0] == a[1]:
			print(-1)
		elif a[1] == '?':
			if a[0] == 'a' or a[0] == 'b':
				a[1] = 'c'
			else:
				a[1] = 'a'
			r = ''.join([str(i) for i in a])
			print(r)
		else:
			r = ''.join([str(i) for i in a])
			print(r)
	elif a[0] == '?':
		print('a')
	else:
		print(a[0])


import sys
input = lambda : sys.stdin.readline()[:-1]
print = lambda s: sys.stdout.write(f'{s}\n')
for _ in range(int(input())):
	npt = input()
	if 'aa' in npt or 'bb' in npt or 'cc' in npt:
		print('-1')
	else:
		npt = list(npt)
		start_index = -1
		for (i, n) in enumerate(npt):
			if start_index >= 0:
				if n == '?':
					continue
				else:
					start_char = npt[start_index - 1] if start_index > 0 else ''
					end_char = n
					choose_chars = [c for c in ('a', 'b', 'c') if c not in (start_char, end_char)]
					choose_chars += [start_char]
					for inner_i in range(start_index, i):
						npt[inner_i] = choose_chars[(inner_i - start_index) % 2]
					start_index = -1
			elif n == '?':
				start_index = i
		if start_index >= 0:
			start_char = npt[start_index - 1]
			choose_chars = [c for c in ('a', 'b', 'c') if c not in (start_char, 'a')]
			choose_chars += [start_char]
			for inner_i in range(start_index, len(npt)):
				npt[inner_i] = choose_chars[(inner_i - start_index) % 2]
		print(''.join(npt))
sys.stdout.flush()


def change_let(letters):
	let_set = set(['a', 'b', 'c'])
	if letters[0] == '?':
		if len(letters) == 1:
			letters[0] = 'a'
		else:
			letters[0] = (let_set - set(letters[1])).pop()
	elif letters[0] == letters[1]:
		return ['-1']
	for i in range(1, len(letters) - 1):
		if letters[i] == letters[i + 1] and letters[i] != '?':
			return ['-1']
		elif letters[i] == '?':
			letters[i] = (let_set - set(letters[i - 1]) - set(letters[i + 1])).pop()
	if letters[-1] == '?':
		letters[-1] = (let_set - set(letters[-2])).pop()
	return letters
for _ in range(int(input())):
	letters = list(input())
	print(''.join(change_let(letters)))


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


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)


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


n = int(input())
for i in range(n):
	string = str(input())
	newstr = ''
	if len(string) == 1:
		if string == '?':
			print('a')
		else:
			print(string)
	for i in range(len(string) - 1):
		flag = 1
		if string[i] == string[i + 1] and string[i] != '?':
			flag = 0
			print('-1')
			break
		if i == 0:
			if string[0] == '?':
				if string[i + 1] == 'a':
					newstr += 'b'
				elif string[i + 1] == 'b':
					newstr += 'c'
				elif string[i + 1] == 'c':
					newstr += 'a'
				else:
					newstr += 'a'
			else:
				newstr += string[0]
		elif string[i] == '?':
			if newstr[i - 1] == 'a':
				if string[i + 1] == 'a':
					newstr += 'b'
				elif string[i + 1] == 'b':
					newstr += 'c'
				elif string[i + 1] == 'c':
					newstr += 'b'
				else:
					newstr += 'b'
			elif newstr[i - 1] == 'b':
				if string[i + 1] == 'a':
					newstr += 'c'
				elif string[i + 1] == 'b':
					newstr += 'c'
				elif string[i + 1] == 'c':
					newstr += 'a'
				else:
					newstr += 'a'
			elif newstr[i - 1] == 'c':
				if string[i + 1] == 'a':
					newstr += 'b'
				elif string[i + 1] == 'b':
					newstr += 'a'
				elif string[i + 1] == 'c':
					newstr += 'b'
				else:
					newstr += 'a'
		else:
			newstr += string[i]
	if len(string) != 1:
		if string[i + 1] == '?':
			if newstr[i] == 'a':
				newstr += 'b'
			elif newstr[i] == 'b':
				newstr += 'c'
			elif newstr[i] == 'c':
				newstr += 'a'
		else:
			newstr += string[i + 1]
		if flag:
			print(newstr)


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


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


t = int(input())
for _ in range(t):
	s = ['a'] + list(input()) + ['a']
	wrong = False
	for i in range(1, len(s) - 1):
		if s[i] != '?' and (s[i] == s[i + 1] and i < len(s) - 2):
			print(-1)
			wrong = True
			break
		if s[i] == '?':
			c = ord(s[i - 1]) - ord('a')
			c2 = ord(s[i + 1]) - ord('a')
			if s[i + 1] == '?':
				s[i] = chr((c + 1) % 3 + ord('a'))
			elif c == c2:
				s[i] = chr((c + 1) % 3 + ord('a'))
			else:
				s[i] = chr(2 * (c + c2) % 3 + ord('a'))
	if not wrong:
		print(''.join(s[1:-1]))


import random
from sys import stdin

def input():
	return stdin.buffer.readline()
t = int(input())
for _ in range(t):
	txt = list(str(input(), 'utf-8')[:-1])
	for i in range(len(txt)):
		chars = ['a', 'b', 'c']
		if i < len(txt) - 1 and txt[i] != '?' and (txt[i] == txt[i + 1]):
			print(-1)
			break
		if txt[i] == '?':
			if i > 0 and txt[i - 1] != '?':
				chars.remove(txt[i - 1])
			if i < len(txt) - 1 and txt[i + 1] != '?' and (txt[i + 1] in chars):
				chars.remove(txt[i + 1])
			txt[i] = chars[0]
	else:
		print(*txt, sep='')


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)


for kkk in range(int(input())):
	s = input()
	n = len(s)
	s = list(s)
	if n == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s[0])
		continue
	flag = False
	if s[0] == '?':
		if s[1] == 'a':
			s[0] = 'b'
		elif s[1] == 'b':
			s[0] = 'c'
		else:
			s[0] = 'a'
	for i in range(1, n - 1):
		if s[i] == '?':
			if 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] == 'c':
					s[i] = 'a'
				else:
					s[i] = 'c'
			elif s[i - 1] == 'c':
				if s[i + 1] == 'b':
					s[i] = 'a'
				else:
					s[i] = 'b'
		else:
			if s[i] == s[i - 1]:
				flag = True
				break
			if s[i] == s[i + 1]:
				flag = True
				break
	if s[n - 1] == '?':
		if s[n - 2] == 'a':
			s[n - 1] = 'b'
		elif s[n - 2] == 'b':
			s[n - 1] = 'c'
		else:
			s[n - 1] = 'a'
	elif s[n - 2] == s[n - 1]:
		flag = True
	if flag:
		print(-1)
	else:
		print(''.join(s))


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 sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))

def get_element(s, lst):
	for i in s.difference(lst):
		return i
for i in range(get_int()):
	s = '0' + get_string() + '0'
	result = ''
	allowed = {'a', 'b', 'c'}
	for i in range(len(s) - 1):
		if s[i] == '?':
			result += get_element(allowed, [result[-1], s[i + 1]])
		else:
			result += s[i]
	flag = True
	result = result.strip('0')
	for i in range(len(result) - 1):
		if result[i] == result[i + 1]:
			flag = False
	if flag:
		print(result)
	else:
		print(-1)


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


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
chars = 'abc'
for _ in range(INT()):
	S = list('x' + input() + 'x')
	ans = ['x']
	for (i, s) in enumerate(S[1:-1], 1):
		if s == '?':
			if ans[i - 1] in 'abx' and S[i + 1] in 'abx':
				ans += ['c']
			elif ans[i - 1] in 'bcx' and S[i + 1] in 'bcx':
				ans += ['a']
			elif ans[i - 1] in 'cax' and S[i + 1] in 'cax':
				ans += ['b']
			else:
				idx = (chars.find(ans[i - 1]) + 1) % 3
				ans += [chars[idx]]
		else:
			ans += [s]
	ans = ''.join(ans[1:])
	for (i, s) in enumerate(ans[1:], 1):
		if s == ans[i - 1]:
			print(-1)
			break
	else:
		print(ans)


for test_case in range(int(input())):
	string = list(input())
	ans = ''
	choices = ['a', 'b', 'c']
	for letter in range(len(string) - 1):
		if string[letter] == string[letter + 1] != '?':
			print(-1)
			break
	else:
		if len(string) == 1:
			string[0] = 'a'
		else:
			if string[0] == '?':
				if string[1] == 'b':
					string[0] = 'a'
				else:
					string[0] = 'b'
			if string[-1] == '?':
				if string[-2] == 'a':
					string[-1] = 'b'
				else:
					string[-1] = 'a'
			for letter in range(len(string)):
				if string[letter] == '?':
					try:
						choices.remove(string[letter - 1])
						choices.remove(string[letter + 1])
					except ValueError:
						pass
					string[letter] = choices[0]
					choices = ['a', 'b', 'c']
		print(*string, sep='')


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


q = ['a', 'b', 'c']
for i in range(int(input())):
	e = list(input())
	w = []
	if e[0] == '?':
		if len(e) != 1:
			if e[1] == 'a':
				w.append('b')
			else:
				w.append('a')
		else:
			w = ['a']
	else:
		w.append(e[0])
	fl = False
	for i in range(len(e) - 1):
		if w[-1] == e[i + 1]:
			fl = True
			break
		if e[i + 1] == '?':
			for j in q:
				if w[-1] != j and j != e[(i + 2) % len(e)]:
					w.append(j)
					break
		else:
			w.append(e[i + 1])
	if fl:
		print(-1)
	else:
		print(''.join(w))


from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	s = input()
	flag = 0
	n = len(s)
	a = list(s)
	for i in range(n - 1):
		if a[i] == a[i + 1] and a[i] != '?':
			flag = 1
			break
	if flag:
		print(-1)
	else:
		for i in range(n - 1):
			if a[i] == '?':
				if i == 0:
					if a[i + 1] == 'a':
						a[i] = 'b'
					elif a[i + 1] == 'b':
						a[i] = 'a'
					else:
						a[i] = 'a'
				elif a[i - 1] == 'a':
					if a[i + 1] == 'b':
						a[i] = 'c'
					else:
						a[i] = 'b'
				elif a[i - 1] == 'b':
					if a[i + 1] == 'a':
						a[i] = 'c'
					else:
						a[i] = 'a'
				elif a[i - 1] == 'c':
					if a[i + 1] == 'b':
						a[i] = 'a'
					else:
						a[i] = 'b'
		if a[-1] == '?':
			if n == 1:
				a[-1] = 'a'
			elif a[-2] == 'a':
				a[-1] = 'b'
			else:
				a[-1] = 'a'
		for i in range(n):
			print(a[i], end='')
		print()


def calc(a, b, c):
	if a == 'a':
		if c != 'b':
			return 'b'
		else:
			return 'c'
	elif a == 'b':
		if c == 'c':
			return 'a'
		else:
			return 'c'
	elif c != 'a':
		return 'a'
	else:
		return 'b'
t = int(input())
for nt in range(t):
	s = input()
	ans = ''
	if len(s) == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s)
		continue
	flag = 0
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print(-1)
			flag = 1
			break
	if flag == 1:
		continue
	if s[0] == '?':
		if s[1] == 'a':
			ans += 'b'
		else:
			ans += 'a'
	else:
		ans += s[0]
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			ans += calc(ans[-1], '?', s[i + 1])
		else:
			ans += s[i]
	if s[-1] == '?':
		if ans[-1] == 'a':
			ans += 'b'
		else:
			ans += 'a'
	else:
		ans += s[-1]
	print(ans)


for _ in range(int(input())):
	string = input()
	s = [str(i) for i in string]
	n = len(s)
	flag = True
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print('-1')
			flag = False
			break
	d = [97, 98, 99]
	if flag:
		if s[0] == '?':
			i = 0
			a = 'a'
			while i + 1 < n and s[i + 1] == '?':
				s[i] = chr(d[(d.index(ord(a)) + 1) % 3])
				a = s[i]
				i += 1
			if i == 0 and i + 1 < n:
				s[i] = chr(d[(d.index(ord(s[i + 1])) + 1) % 3])
			elif s[i] == '?' and i == n - 1:
				s[i] = chr(d[(d.index(ord(a)) + 1) % 3])
			else:
				k = d[:]
				b = s[i + 1]
				if a != b:
					k.pop(k.index(ord(a)))
					k.pop(k.index(ord(b)))
					s[i] = chr(k[0])
				else:
					s[i] = chr(d[(d.index(ord(a)) + 1) % 3])
		if s[0] != '?':
			a = s[0]
			for i in range(1, n):
				if s[i] == '?' and i + 1 < n and (s[i + 1] == '?'):
					s[i] = chr(d[(d.index(ord(a)) + 1) % 3])
					a = s[i]
				elif s[i] == '?' and i + 1 < n and (s[i + 1] != '?'):
					k = d[:]
					b = s[i + 1]
					if a != b:
						k.pop(k.index(ord(a)))
						k.pop(k.index(ord(b)))
						s[i] = chr(k[0])
					else:
						s[i] = chr(d[(d.index(ord(a)) + 1) % 3])
					a = s[i]
				elif s[i] == '?' and i == n - 1:
					s[i] = chr(d[(d.index(ord(a)) + 1) % 3])
				elif s[i] != '?':
					a = s[i]
		ss = ''.join(s)
		print(ss)


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)


from itertools import cycle
import re

def main():
	abc = iter(cycle('abc'))
	for _ in range(int(input())):
		(s, r) = (input(), [])
		if re.search('aa|bb|cc', s):
			print(-1)
			continue
		a = ''
		(b, *l) = s
		for c in l + ['?']:
			while b in (a, c, '?'):
				b = next(abc)
			r.append(b)
			(a, b) = (b, c)
		print(''.join(r))
main()


t = int(input())
for _ in range(t):
	s = input()
	if 'cc' in s or 'aa' in s or 'bb' in s:
		print(-1)
	else:
		s = list(s)
		n = len(s)
		i = 0
		while i < n:
			if s[i] == '?':
				if i == 0:
					x = 'f'
				else:
					x = s[i - 1]
				if i + 1 >= n:
					y = 'f'
				else:
					y = s[i + 1]
				A = ['a', 'b', 'c']
				for j in A:
					if j != x and j != y:
						s[i] = j
			else:
				i += 1
		print(''.join(map(str, 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())
ans = []
for i in range(t):
	a = input()
	a = [i for i in a]
	ans.append(0)
	w = ['a', 'b', 'c']
	for j in range(len(a) - 1):
		if a[j] == a[j + 1] and a[j] != '?':
			ans[i] = -1
			break
		if a[j] == '?' and (j == 0 or j == len(a) - 1):
			if j == 0:
				if a[j + 1] == 'a':
					a[j] = 'b'
				else:
					a[j] = 'a'
			elif a[-2] == 'a':
				a[-1] = 'b'
			else:
				a[-1] = 'a'
		elif a[j] == '?':
			for z in range(3):
				if a[j - 1] != w[z] and a[j + 1] != w[z]:
					a[j] = w[z]
	if ans[i] != -1:
		if len(a) == 1:
			if a[-1] == '?':
				a[-1] = 'a'
		elif a[-1] == '?':
			if a[-2] == 'a':
				a[-1] = 'c'
			else:
				a[-1] = 'a'
		ans[i] = ''.join(a)
for i in ans:
	print(i)


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)


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


li = ['a', 'b', 'c']
di = {}
di['a'] = 0
di['b'] = 1
di['c'] = 2
for k in range(int(input())):
	p = input()
	if p == '?':
		print('a')
		continue
	s = list(p)
	n = len(s)
	x = 0
	for j in range(1, n):
		if s[j] != '?' and s[j] == s[j - 1]:
			print(-1)
			x = x + 1
			break
	if x > 0:
		continue
	for i in range(n):
		if i == 0:
			if s[i] == '?':
				if s[i + 1] == '?':
					s[i] = 'a'
				else:
					s[i] = li[(di[s[i + 1]] + 1) % 3]
			else:
				continue
		elif i == n - 1:
			if s[i] == '?':
				s[i] = li[(di[s[i - 1]] + 1) % 3]
			else:
				continue
		elif s[i] == '?':
			s[i] = li[(di[s[i - 1]] + 1) % 3]
			if s[i] == s[i + 1]:
				s[i] = li[(di[s[i + 1]] + 1) % 3]
		else:
			continue
	print(''.join(s))


test_cases = int(input())
for x in range(test_cases):
	text = input()
	text = [char for char in text]
	can_be_beautiful = True
	for i in range(len(text)):
		available_right = {'a': True, 'b': True, 'c': True}
		available_left = {'a': True, 'b': True, 'c': True}
		if len(text) - 1 >= i + 1:
			if text[i + 1] == 'a':
				available_right['a'] = False
			elif text[i + 1] == 'b':
				available_right['b'] = False
			elif text[i + 1] == 'c':
				available_right['c'] = False
		if i > 0:
			if text[i - 1] == 'a':
				available_left['a'] = False
			elif text[i - 1] == 'b':
				available_left['b'] = False
			elif text[i - 1] == 'c':
				available_left['c'] = False
		if text[i] != '?':
			if not available_left[text[i]] or not available_right[text[i]]:
				can_be_beautiful = False
				break
			else:
				continue
		if available_left['a'] and available_right['a']:
			text[i] = 'a'
		elif available_left['b'] and available_right['b']:
			text[i] = 'b'
		elif available_left['c'] and available_right['c']:
			text[i] = 'c'
		else:
			can_be_beautiful = False
			break
	if can_be_beautiful:
		print(''.join(text))
	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())


def recur(s1, s2):
	if s1 == 'a' and s2 == 'a':
		return 'b'
	if s1 == 'b' and s2 == 'b':
		return 'a'
	if s1 == 'c' and s2 == 'c':
		return 'a'
	if s1 == 'a' and s2 == 'c':
		return 'b'
	if s1 == 'c' and s2 == 'a':
		return 'b'
	if s1 == 'a' and s2 == 'b':
		return 'c'
	if s1 == 'b' and s2 == 'a':
		return 'c'
	if s1 == 'c' and s2 == 'b':
		return 'a'
	if s1 == 'b' and s2 == 'c':
		return 'a'
for _ in range(int(input())):
	bol = True
	bol2 = True
	ar = input()
	s = []
	if len(ar) == 1:
		if ar != '?':
			print(ar)
			bol = False
		if ar == '?':
			print('a')
			bol = False
	for j in ar:
		s.append(j)
	if bol:
		for i in range(len(s) - 1):
			if s[i] == s[i + 1] and s[i] != '?':
				if bol2:
					print('-1')
					bol = False
					bol2 = False
		if bol:
			for i in range(len(s) - 1):
				if i == 0:
					if s[i] == '?':
						if s[i + 1] == 'a':
							s[i] = 'b'
						if s[i + 1] == 'b':
							s[i] = 'a'
						if s[i + 1] == 'c':
							s[i] = 'b'
						if s[i + 1] == '?':
							s[i] = 'a'
					else:
						pass
				elif s[i] == '?' and s[i + 1] != '?':
					s[i] = recur(s[i - 1], s[i + 1])
				elif s[i] != '?' and s[i + 1] != '?' or (s[i] != '?' and s[i + 1] == '?'):
					pass
				elif s[i] == '?' and s[i + 1] == '?':
					if s[i - 1] == 'a':
						s[i] = 'b'
					elif s[i - 1] == 'b':
						s[i] = 'a'
					elif s[i - 1] == 'c':
						s[i] = 'b'
			if s[-1] == '?':
				if s[-2] == 'a':
					s[-1] = 'b'
				elif s[-2] == 'b':
					s[-1] = 'a'
				elif s[-2] == 'c':
					s[-1] = 'b'
	if bol:
		print(''.join(s))


q = int(input())
for i in range(q):
	s = list(input())
	ans = []
	i = 0
	last = ' '
	fl = True
	while fl and i < len(s):
		while i < len(s) and s[i] != '?':
			if i > 0 and s[i] == ans[-1]:
				fl = False
			ans.append(s[i])
			last = s[i]
			i += 1
		if fl and i < len(s):
			count = 1
		else:
			count = 0
		while fl and i + 1 < len(s) and (s[i + 1] == '?'):
			count += 1
			i += 1
		if i + 1 < len(s):
			this = s[i + 1]
		else:
			this = ' '
		for j in range(count):
			pos = set()
			pos.add('a')
			pos.add('b')
			pos.add('c')
			if len(ans) > 0 and ans[-1] in pos:
				pos.discard(ans[-1])
			if j == count - 1:
				if this in pos:
					pos.discard(this)
			ans.append(pos.pop())
		i += 1
	if fl:
		print(*ans, sep='')
	else:
		print(-1)


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


t = int(input())
for _ in range(t):
	s = list(input())
	possible = bool(1)
	characters = {'a', 'b', 'c'}
	if len(s) == 1 and s[0] == '?':
		s[0] = 'a'
	for i in range(len(s)):
		if s[i] == '?':
			if i == 0:
				for c in characters:
					if c != s[i + 1]:
						s[i] = c
						break
			elif i == len(s) - 1:
				for c in characters:
					if c != s[i - 1]:
						s[i] = c
						break
			else:
				for c in characters:
					if c != s[i - 1] and c != s[i + 1]:
						s[i] = c
						break
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			possible = 0
			break
	if possible:
		print(*s, sep='')
	else:
		print('-1')


for _ in range(int(input())):
	s = list(input())
	can = ['a', 'b', 'c']
	if len(s) == 1:
		print('a')
		continue
	if s[0] == '?' and len(s) >= 2:
		if s[1] == '?':
			s[0] = 'a'
		else:
			can.remove(s[1])
			s[0] = can[0]
			can = ['a', 'b', 'c']
	if s[-1] == '?' and len(s) >= 2:
		if s[-2] == '?':
			s[-1] = 'a'
		else:
			can.remove(s[-2])
			s[-1] = can[0]
			can = ['a', 'b', 'c']
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			can.remove(s[i - 1])
			try:
				can.remove(s[i + 1])
			except:
				pass
			s[i] = can[0]
			can = ['a', 'b', 'c']
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			print(-1)
			break
	else:
		print(''.join(s))


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


def check(x, y, l):
	if l[x - 1] != y and l[x + 1] != y:
		return True
	return False
t = int(input())
for _ in range(t):
	s = input()
	l = []
	l.append(0)
	for i in range(len(s)):
		if s[i] == '?':
			l.append(4)
		elif s[i] == 'a':
			l.append(1)
		elif s[i] == 'b':
			l.append(2)
		else:
			l.append(3)
	l.append(0)
	flag = 0
	for i in range(1, len(l) - 1):
		if l[i] == 4:
			for j in range(1, 4):
				if check(i, j, l):
					l[i] = j
		if l[i] == 4:
			flag = 1
	for i in range(1, len(l) - 1):
		if l[i] == l[i + 1]:
			flag = 1
	if flag == 1:
		print(-1)
		continue
	for i in range(1, len(l) - 1):
		print(chr(l[i] + 96), end='')
	print()


for _ in range(int(input())):
	s = list(input())
	f = 1
	n = len(s)
	for i in range(n):
		if i != n - 1 and s[i] == s[i + 1] and (s[i] != '?'):
			print(-1)
			f = 0
			break
		elif s[i] == '?':
			s[i] = list({'a', 'b', 'c'}.difference({s[max(0, i - 1)], s[min(n - 1, i + 1)]}))[0]
	if f:
		print(''.join(s))


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)


t = int(input())
for _ in range(t):
	s = list(str(input()))
	s.insert(0, '?')
	s.append('?')
	possible = True
	for i in range(1, len(s) - 1):
		if s[i] != '?':
			if s[i - 1] == s[i] or s[i + 1] == s[i]:
				possible = False
				break
		else:
			if s[i - 1] != 'a' and s[i + 1] != 'a':
				s[i] = 'a'
			if s[i - 1] != 'b' and s[i + 1] != 'b':
				s[i] = 'b'
			if s[i - 1] != 'c' and s[i + 1] != 'c':
				s[i] = 'c'
	print(-1 if not possible else ''.join(s[1:len(s) - 1]))


for i in range(int(input())):
	a = input()
	count = 0
	b = ''
	if len(a) == 1:
		if a[0] == '?':
			print('a')
		else:
			print(a[0])
	else:
		for j in range(len(a)):
			if a[j] != '?':
				b += a[j]
			elif j == 0:
				if a[j + 1] == 'a':
					b += 'b'
				elif a[j + 1] == 'b':
					b += 'c'
				else:
					b += 'a'
			elif j == len(a) - 1:
				if b[j - 1] == 'a':
					b += 'b'
				elif b[j - 1] == 'b':
					b += 'c'
				else:
					b += 'a'
			elif a[j + 1] != 'a' and b[j - 1] != 'a':
				b += 'a'
			elif a[j + 1] != 'b' and b[j - 1] != 'b':
				b += 'b'
			else:
				b += 'c'
		for k in range(len(b) - 1):
			if b[k] == b[k + 1]:
				count = 1
				break
		if count == 0:
			print(b)
		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))


t = int(input())
for q in range(t):
	r = {'a': 'b', 'b': 'c', 'c': 'a'}
	s = list(input())
	n = len(s)
	c = 0
	flag = 0
	for i in range(0, n):
		if s[i] != '?':
			if i >= 1 and s[i] == s[i - 1]:
				flag = 1
				break
		elif s[i] == '?':
			if i == 0:
				s[i] = 'a'
			else:
				s[i] = r[s[i - 1]]
			if i < n - 1:
				if s[i] == s[i + 1]:
					s[i] = r[s[i]]
	if flag == 1:
		print(-1)
	else:
		print(''.join(s))


import random

def chB(s):
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			return -1
	return 1
T = int(input())
char = {'a', 'b', 'c'}
char = set(char)
for t in range(T):
	s = input()
	s = list(s)
	if len(s) == 1 and s[0] != '?':
		s1 = ''
		print(s1.join(s))
		continue
	elif len(s) == 1 and s[0] == '?':
		s1 = ''
		s[0] = random.choice(list(char))
		print(s1.join(s))
		continue
	elif chB(s) == -1:
		print('-1')
		continue
	else:
		for i in range(len(s)):
			rej = {}
			rej = set(rej)
			if s[i] == '?':
				if i == 0:
					rej.add(s[i + 1])
					rand = char - rej
					s[i] = random.choice(list(rand))
				elif i == len(s) - 1:
					rej.add(s[i - 1])
					rand = char - rej
					s[i] = random.choice(list(rand))
				else:
					rej.add(s[i + 1])
					rej.add(s[i - 1])
					rand = char - rej
					s[i] = random.choice(list(rand))
		res = ''
		print(res.join(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())
for _ in range(n):
	s = list(input())
	tr = True
	if len(s) == 1:
		s[0] = 'a'
		print(s[0])
		tr = False
	elif s[0] == '?':
		if s[1] == '?':
			s[0] = 'a'
		else:
			s[0] = chr((ord(s[1]) - 97 + 1) % 3 + 97)
	elif s[0] == s[1]:
		tr = False
		print(-1)
	if tr:
		for i in range(1, len(s) - 1):
			if s[i] == '?' and s[i + 1] == '?':
				s[i] = chr((ord(s[i - 1]) - 97 + 1) % 3 + 97)
			elif s[i] == '?':
				if s[i - 1] == 'a':
					if s[i + 1] == 'a':
						s[i] = 'b'
					elif s[i + 1] == 'b':
						s[i] = 'c'
					elif s[i + 1] == 'c':
						s[i] = 'b'
				elif s[i - 1] == 'b':
					if s[i + 1] == 'a':
						s[i] = 'c'
					elif s[i + 1] == 'b':
						s[i] = 'c'
					elif s[i + 1] == 'c':
						s[i] = 'a'
				elif s[i - 1] == 'c':
					if s[i + 1] == 'a':
						s[i] = 'b'
					elif s[i + 1] == 'b':
						s[i] = 'a'
					elif s[i + 1] == 'c':
						s[i] = 'a'
			elif s[i - 1] == s[i]:
				tr = False
				print(-1)
				break
	if tr:
		if s[len(s) - 1] == '?':
			s[len(s) - 1] = chr((ord(s[len(s) - 2]) - 97 + 1) % 3 + 97)
			print(''.join(s))
		elif s[len(s) - 1] == s[len(s) - 2]:
			print(-1)
		else:
			print(''.join(s))


def naive_string_matcher(T, P):
	n = len(T)
	m = len(P)
	for i in range(n - m + 1):
		if P == T[i:i + m]:
			return True
	return False
t = int(input())
setts = {'a', 'c', 'b'}
for i in range(t):
	s = input()
	if naive_string_matcher(s, 'aa') or naive_string_matcher(s, 'cc') or naive_string_matcher(s, 'bb'):
		print('-1')
	elif s == '?':
		print('a')
	else:
		s1 = list(s)
		for i in range(len(s1)):
			if s1[i] == '?':
				if i == 0:
					c = list(setts - {s1[i + 1]})
					s1[i] = c[0]
				elif i == len(s1) - 1:
					c = list(setts - {s1[i - 1]})
					s1[i] = c[0]
				else:
					c = list(setts - {s1[i - 1], s1[i + 1]})
					s1[i] = c[0]
		for i in s1:
			print(i, end='')
		print('')


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


n = int(input())
s = []
for i in range(n):
	s.append(input())
for i in range(n):
	if len(s[i]) == 1:
		print('a')
	else:
		for j in range(1, len(s[i]) - 1):
			if s[i][j] == '?':
				if not 'a' in [s[i][j - 1], s[i][j + 1]]:
					s[i] = s[i][:j] + 'a' + s[i][j + 1:]
				elif not 'b' in [s[i][j - 1], s[i][j + 1]]:
					s[i] = s[i][:j] + 'b' + s[i][j + 1:]
				else:
					s[i] = s[i][:j] + 'c' + s[i][j + 1:]
		if s[i][0] == '?':
			if s[i][1] == 'a':
				s[i] = 'b' + s[i][1:]
			else:
				s[i] = 'a' + s[i][1:]
		if s[i][len(s[i]) - 1] == '?':
			if s[i][len(s[i]) - 2] == 'a':
				s[i] = s[i][:len(s[i]) - 1] + 'b'
			else:
				s[i] = s[i][:len(s[i]) - 1] + 'a'
		flag = 0
		for j in range(len(s[i]) - 1):
			if s[i][j] == s[i][j + 1]:
				flag = 1
		if flag == 0:
			print(s[i])
		else:
			print(-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)


def equal(a, b):
	if b == 'a':
		a = 'b'
	elif b == 'b':
		a = 'c'
	else:
		a = 'a'
	return a

def equal2(a, b, c):
	if (b == 'a' or b == 'c') and (c == 'a' or c == 'c' or c == '?'):
		a = 'b'
	elif (b == 'b' or b == 'a') and (c == 'b' or c == 'a' or c == '?'):
		a = 'c'
	else:
		a = 'a'
	return a

def solve(out):
	l = len(out)
	if l == 1:
		if out[0] == '?':
			out[0] = 'a'
		return out
	for j in range(l):
		if out[j] == '?':
			if j == 0:
				out[j] = equal(out[j], out[j + 1])
			elif j > 0 and j < l - 1:
				out[j] = equal2(out[j], out[j - 1], out[j + 1])
			else:
				out[j] = equal(out[j], out[j - 1])
		elif j > 0:
			if out[j] == out[j - 1]:
				out = -1
				break
	return out
for i in range(int(input())):
	s = input()
	s = solve(list(s))
	if s == -1:
		print(s)
	else:
		print(''.join(s))


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)


for x in range(int(input())):
	s = input()
	n = len(s)
	w = []
	flag = True
	for i in range(n):
		if s[i] == '?':
			symb = {'a', 'b', 'c'}
			if i > 0 and w[i - 1] in symb:
				symb.remove(w[i - 1])
			if i < n - 1 and s[i + 1] in symb:
				symb.remove(s[i + 1])
			w.append(symb.pop())
		elif i > 0 and s[i] == s[i - 1] or (i < n - 1 and s[i] == s[i + 1]):
			print(-1)
			flag = False
			break
		else:
			w.append(s[i])
	if flag:
		for i in w:
			print(i, end='')
		print()


import time

def convertToBeautiful(s):
	beau = ''
	possibleB = isPossible(s)
	ant = ''
	pos = ''
	if possibleB == True:
		s = s + '?'
		for x in range(len(s) - 1):
			if s[x] == '?':
				if x > 0:
					ant = beau[x - 1]
				else:
					ant = 'a'
				pos = s[x + 1]
				if ant == 'a' and pos == 'b':
					beau += 'c'
				elif ant == 'a' and (pos == 'a' or pos == 'c' or pos == '?'):
					beau += 'b'
				elif ant == 'b' and pos == 'c':
					beau += 'a'
				elif ant == 'b' and (pos == 'a' or pos == 'b' or pos == '?'):
					beau += 'c'
				elif ant == 'c' and (pos == 'c' or pos == 'b'):
					beau += 'a'
				elif ant == 'c' and (pos == 'a' or pos == '?'):
					beau += 'b'
			else:
				beau += s[x]
	if possibleB == False:
		beau = '-1'
		return beau
	else:
		return beau

def isPossible(s):
	possible = True
	s = s + '?'
	for x in range(len(s) - 1):
		if s[x] != s[x + 1] or s[x] == '?':
			possible = True
		else:
			possible = False
			return possible
	return possible

def solve():
	cases = int(input())
	for x in range(cases):
		s = input()
		print(convertToBeautiful(s))
solve()


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


a = int(input())
for i in range(a):
	s = input()
	ans = [s[i] for i in range(len(s))]
	if len(s) == 1:
		if ans[0] == '?':
			print('a')
			continue
		else:
			print(s)
			continue
	if ans[0] == '?':
		if ans[1] != 'a':
			ans[0] = 'a'
		if ans[1] != 'b':
			ans[0] = 'b'
		if ans[1] != 'c':
			ans[0] = 'c'
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			if ans[i - 1] != 'a' and ans[i + 1] != 'a':
				ans[i] = 'a'
			if ans[i - 1] != 'b' and ans[i + 1] != 'b':
				ans[i] = 'b'
			if ans[i - 1] != 'c' and ans[i + 1] != 'c':
				ans[i] = 'c'
	if ans[-1] == '?':
		if ans[-2] != 'a':
			ans[-1] = 'a'
		if ans[-2] != 'b':
			ans[-1] = 'b'
		if ans[-2] != 'c':
			ans[-1] = 'c'
	flag = 0
	for i in range(1, len(ans)):
		if ans[i] == ans[i - 1]:
			flag = 1
			break
	if flag == 1:
		print(-1)
	else:
		print(''.join(map(str, ans)))


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
for _ in range(inn()):
	s = [str(x) for x in input()]
	i = 0
	n = len(s)
	flag = 0
	ans = ''
	for i in range(1, n - 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'
		elif s[i] == s[i + 1]:
			flag = 1
			break
	if n > 1 and s[0] == s[1] and (s[0] != '?'):
		flag = 1
	if s[0] == '?':
		if n > 1 and (s[1] == 'a' or s[1] == 'b'):
			s[0] = 'c'
		else:
			s[0] = 'a'
	if s[n - 1] == '?':
		if s[n - 2] == 'a' or s[n - 2] == 'b':
			s[n - 1] = 'c'
		else:
			s[n - 1] = 'a'
	if flag == 1:
		print(-1)
	else:
		print(*s, sep='')


def f(s):
	n = len(s) - 1
	if n == 0:
		if s[0] == '?':
			return 'a'
		else:
			return s
	for i in range(n + 1):
		c = s[i]
		if c == '?':
			if i != 0 and (i == n or s[i + 1] == '?'):
				s[i] = 'abc'[('abc'.index(s[i - 1]) + 1) % 3]
			elif i == 0:
				if s[i + 1] == '?':
					s[i] = 'a'
				else:
					s[i] = 'abc'[('abc'.index(s[i + 1]) + 1) % 3]
			else:
				for j in 'abc':
					if j != s[i - 1] and j != s[i + 1]:
						s[i] = j
						break
		elif i != n and s[i + 1] == c:
			return -1
	return ''.join(s)
for _ in range(int(input())):
	print(f(list(input())))


for _ in range(int(input())):
	string = input()
	sl = []
	size = len(string)
	flag = 0
	for i in range(size - 1):
		if string[i] != '?' and string[i + 1] != '?':
			if string[i] == string[i + 1]:
				print(-1)
				flag = 1
				break
	if flag == 1:
		continue
	for i in string:
		sl.append(i)
	string = ''
	i = 0
	while i < size:
		if sl[i] != '?':
			i += 1
			continue
		index = i
		while index < size and sl[index] == '?':
			index += 1
		if i == 0:
			if index >= size:
				string = 'abc'
				for j in range(size):
					sl[j] = string[j % 3]
				break
			elif sl[index] == 'a':
				string = 'bc'
				for j in range(index):
					sl[j] = string[j % 2]
			elif sl[index] == 'b':
				string = 'ac'
				for j in range(index):
					sl[j] = string[j % 2]
			else:
				string = 'ab'
				for j in range(index):
					sl[j] = string[j % 2]
		elif index >= size:
			if sl[i - 1] == 'a':
				string = 'bca'
				count = 0
				for j in range(i, index):
					sl[j] = string[count % 3]
					count += 1
			elif sl[i - 1] == 'b':
				string = 'cba'
				count = 0
				for j in range(i, index):
					sl[j] = string[count % 3]
					count += 1
			else:
				string = 'abc'
				count = 0
				for j in range(i, index):
					sl[j] = string[count % 3]
					count += 1
			break
		elif sl[i - 1] == sl[index]:
			if sl[index] == 'a':
				string = 'bc'
				count = 0
				for j in range(i, index):
					sl[j] = string[count % 2]
					count += 1
			elif sl[index] == 'b':
				string = 'ac'
				count = 0
				for j in range(i, index):
					sl[j] = string[count % 2]
					count += 1
			else:
				string = 'ab'
				count = 0
				for j in range(i, index):
					sl[j] = string[count % 2]
					count += 1
		elif sl[i - 1] == 'a':
			string = 'ba'
			count = 0
			for j in range(i, index):
				sl[j] = string[count % 2]
				count += 1
			if sl[index] == sl[index - 1]:
				sl[index - 1] = 'c'
		elif sl[i - 1] == 'b':
			string = 'cb'
			count = 0
			for j in range(i, index):
				sl[j] = string[count % 2]
				count += 1
			if sl[index] == sl[index - 1]:
				sl[index - 1] = 'a'
		else:
			string = 'ac'
			count = 0
			for j in range(i, index):
				sl[j] = string[count % 2]
				count += 1
			if sl[index] == sl[index - 1]:
				sl[index - 1] = 'b'
		i = index
	for i in range(size):
		if i == size - 1:
			print(sl[i])
			break
		print(sl[i], end='')


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


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

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

def main():
	t = inin()
	for _ in range(t):
		s = sin()
		s = list(s)
		n = len(s)
		x = ['a', 'b', 'c']
		for i in range(n):
			if s[i] == '?':
				for j in x:
					if i > 0 and j == s[i - 1] or (i < n - 1 and j == s[i + 1]):
						continue
					s[i] = j
		x = 0
		for i in range(1, n):
			if s[i] == s[i - 1]:
				x = -1
		if x == -1:
			print(x)
		else:
			print(*s, sep='')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


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


col = int(input())
for _ in range(col):
	s = str(input())
	if len(s) == 1:
		print('a')
		continue
	if s.find('aa') != -1 or s.find('cc') != -1 or s.find('bb') != -1:
		print('-1')
		continue
	if s[0] == '?':
		if s[1] != 'a':
			s = 'a' + s[1:]
		else:
			s = 'c' + s[1:]
	if s[len(s) - 1] == '?':
		if s[len(s) - 2] == 'c':
			s = s[:len(s) - 1] + 'b'
		else:
			s = s[:len(s) - 1] + 'c'
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			if s[i - 1] == 'a' and s[i + 1] == 'b' or (s[i - 1] == 'b' and s[i + 1] == 'a'):
				s = s[0:i] + 'c' + s[i + 1:]
			elif s[i - 1] == 'a' and s[i + 1] == 'c' or (s[i - 1] == 'c' and s[i + 1] == 'a'):
				s = s[0:i] + 'b' + s[i + 1:]
			elif s[i - 1] == 'c' and s[i + 1] == 'b' or (s[i - 1] == 'b' and s[i + 1] == 'c'):
				s = s[0:i] + 'a' + s[i + 1:]
			elif s[i - 1] == 'a' and s[i + 1] == '?':
				s = s[0:i] + 'b' + s[i + 1:]
			elif s[i - 1] == 'b' and s[i + 1] == '?':
				s = s[0:i] + 'a' + s[i + 1:]
			elif s[i - 1] == 'c' and s[i + 1] == '?':
				s = s[0:i] + 'a' + s[i + 1:]
			elif s[i - 1] == 'a' and s[i + 1] == 'a':
				s = s[0:i] + 'b' + s[i + 1:]
			elif s[i - 1] == 'b' and s[i + 1] == 'b':
				s = s[0:i] + 'a' + s[i + 1:]
			elif s[i - 1] == 'c' and s[i + 1] == 'c':
				s = s[0:i] + 'b' + s[i + 1:]
	print(s)


for _ in [0] * int(input()):
	s = input()
	a = ['', *s]
	i = 0
	for x in s:
		i += 1
		a[i] = x < 'a' and ({*'abc'} - {*a[i - 1:i + 2]}).pop() or x
	print(*(a, [-1])[any((x * 2 in s for x in 'abc'))], sep='')


import random

def beautify_string():
	string = input()
	if 'aa' in string or 'bb' in string or 'cc' in string:
		return -1
	letters = [x for x in string]
	for i in range(len(letters)):
		if letters[i] == '?':
			poss_letters = ['a', 'b', 'c']
			if not i == 0:
				if letters[i - 1] in poss_letters:
					poss_letters.remove(letters[i - 1])
			if not i == len(letters) - 1:
				if letters[i + 1] in poss_letters:
					poss_letters.remove(letters[i + 1])
			letters[i] = random.choice(poss_letters)
	return ''.join(letters)
for i in range(int(input())):
	print(beautify_string())


t = int(input())
for t_i in range(t):
	s = list(input())
	n = len(s)
	imposs = False
	for i in range(n):
		if i > 0 and s[i] == s[i - 1] and (s[i] != '?'):
			imposs = True
			break
		if s[i] == '?':
			poss = set(['a', 'b', 'c'])
			if i > 0:
				poss.discard(s[i - 1])
			if i < n - 1:
				poss.discard(s[i + 1])
			s[i] = poss.pop()
	if imposs:
		print(-1)
	else:
		print(''.join(s))


for _ in range(int(input())):
	s = input()
	ans = []
	flag = 0
	tflag = 1
	d = {'a': 'b', 'b': 'c', 'c': 'a'}
	for i in s:
		if i == '?':
			if ans:
				ans.append(d[ans[-1]])
			else:
				ans.append('a')
			flag = 1
		else:
			if not ans:
				ans.append(i)
			elif ans[-1] == i:
				if flag:
					x = ans.pop()
					ans.append(d[x])
					ans.append(i)
					flag = 0
				else:
					tflag = 0
			else:
				ans.append(i)
			flag = 0
	if tflag:
		print(''.join(ans))
	else:
		print(-1)


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)


import sys

class ABeautifulString:

	def solve(self):

		def get_not(arr):
			for x in ['a', 'b', 'c']:
				if x not in arr:
					return x
			assert False
		for _ 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:
				x = 3 * ord('a') + 1 + 2
				for i in range(n):
					if s[i] == '?':
						if i > 0 and i < n - 1:
							s[i] = get_not([s[i - 1], s[i + 1]])
						elif i == 0:
							s[i] = get_not([s[i + 1]])
						else:
							s[i] = get_not([s[i - 1]])
				print(''.join(s))
solver = ABeautifulString()
input = sys.stdin.readline
solver.solve()


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


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())):
	x = list(input())
	l = len(x)
	k = 1
	for i in range(l):
		if i != l - 1 and x[i] == x[i + 1] and (x[i] != '?'):
			print(-1)
			k = 0
			break
		elif x[i] == '?':
			x[i] = list({'a', 'b', 'c'}.difference({x[max(0, i - 1)], x[min(l - 1, i + 1)]}))[0]
	if k:
		print(''.join(x))


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


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)


for _ in range(int(input())):
	s = list(input())
	arr = ['a', 'b', 'c']
	result = True
	for i in range(len(s) - 1):
		if s[i] != '?' and s[i] == s[i + 1]:
			result = False
			break
		if s[i] == '?':
			if i == 0:
				for j in arr:
					if j != s[i + 1]:
						s[i] = j
			elif i == len(s) - 1:
				for j in arr:
					if j != s[i - 1]:
						s[i] = j
			else:
				for j in arr:
					if j != s[i - 1] and j != s[i + 1]:
						s[i] = j
	if s[len(s) - 1] == '?':
		for j in arr:
			if j != s[len(s) - 2]:
				s[len(s) - 1] = j
	if not result:
		print(-1)
	else:
		for i in s:
			print(i, end='')
		print()


def main():
	inps = eval(input())
	count = 0
	strings = []
	while count != inps:
		strs = input()
		strings.append(strs)
		count += 1
	for i in strings:
		counta = 0
		countb = 0
		countc = 0
		for j in list(i):
			if j == 'a':
				counta += 1
				countb = 0
				countc = 0
			elif j == 'b':
				countb += 1
				counta = 0
				countc = 0
			elif j == 'c':
				countc += 1
				counta = 0
				countb = 0
			elif j == '?':
				counta = 0
				countb = 0
				countc = 0
			if counta == 2 or countb == 2 or countc == 2:
				print(-1)
				i = ''
				break
		if len(i) == 0:
			continue
		strlist = list(i)
		prev = strlist[0]
		if prev == '?' and len(strlist) != 1:
			if strlist[1] == 'a':
				strlist[0] = 'b'
				prev = strlist[0]
			else:
				strlist[0] = 'a'
				prev = strlist[0]
		elif prev == '?' and len(strlist) == 1:
			print('b')
			continue
		for j in range(1, len(strlist)):
			if strlist[j] == '?':
				if j == len(strlist) - 1:
					if prev == 'a':
						strlist[j] = 'b'
					else:
						strlist[j] = 'a'
				elif prev == 'a':
					if strlist[j + 1] != 'b':
						strlist[j] = 'b'
						prev = 'b'
					else:
						strlist[j] = 'c'
						prev = 'c'
				elif prev == 'c':
					if strlist[j + 1] != 'b':
						strlist[j] = 'b'
						prev = 'b'
					else:
						strlist[j] = 'a'
						prev = 'a'
				elif prev == 'b':
					if strlist[j + 1] != 'a':
						strlist[j] = 'a'
						prev = 'a'
					else:
						strlist[j] = 'c'
						prev = 'c'
			else:
				prev = strlist[j]
		print(''.join(strlist))
main()


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


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


tc = int(input())
for _ in range(tc):
	s = list(input())
	avl = {'a': ['b', 'c'], 'b': ['a', 'c'], 'c': ['a', 'b']}
	d = {}
	flag = 0
	cur = -1
	if s[0] == '?':
		if len(s) > 1 and s[1] != '?':
			s[0] = avl[s[1]][0]
		else:
			s[0] = 'a'
	if s[-1] == '?':
		if s[-2] != '?':
			s[-1] = avl[s[-2]][0]
		else:
			s[-1] = 'a'
	for i in range(1, len(s)):
		if s[i] == '?':
			if s[i + 1] != '?':
				s[i] = list(set(avl[s[i - 1]]) & set(avl[s[i + 1]]))[0]
			else:
				s[i] = avl[s[i - 1]][0]
		elif s[i] == s[i - 1]:
			print(-1)
			break
	else:
		print(''.join(s))


nxt = {}
nxt['a'] = 'b'
nxt['b'] = 'c'
nxt['c'] = 'a'
for _ in range(int(input())):
	s = list(input())
	if len(s) == 1:
		if s[0] == '?':
			s[0] = 'a'
		print(s[0])
		continue
	s.append('?')
	if s[0] == '?':
		s[0] = nxt[s[1]] if s[1] != '?' else 'a'
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			s[i] = 'a'
			while s[i] == s[i - 1] or s[i] == s[i + 1]:
				s[i] = nxt[s[i]]
	s.pop()
	possible = True
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			possible = False
			break
	print(''.join(map(str, s)) if possible else -1)


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)


alpha = ['a', 'b', 'c']
for _ in range(int(input())):
	s = [i for i in input()]
	ok = True
	for i in range(len(s)):
		if i == len(s) - 1:
			if s[i] == '?':
				for j in alpha:
					if j != s[i - 1]:
						s[i] = j
		elif s[i] == '?' and i > 0 and (i < len(s) - 1):
			for j in alpha:
				if j != s[i + 1] and j != s[i - 1]:
					s[i] = j
		elif s[i] == '?' and i == 0:
			for j in alpha:
				if j != s[i + 1]:
					s[i] = j
		elif s[i] == s[i + 1] and s[i] != '?':
			ok = False
	if ok:
		print(''.join(s))
	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))


for _ in range(int(input())):
	a = input()
	if a == '?':
		print('a')
		continue
	ans = []
	if a[0] == '?' and len(a) > 1:
		if a[1] == 'a':
			ans.append('b')
		elif a[1] == 'b':
			ans.append('c')
		else:
			ans.append('a')
	else:
		ans.append(a[0])
	z = 0
	k = len(a)
	for i in range(1, k - 1):
		if a[i] == ans[-1]:
			z = 1
			break
		if a[i] == '?':
			if ans[-1] == 'a' and a[i + 1] == 'a':
				ans.append('b')
			elif ans[-1] == 'b' and a[i + 1] == 'b':
				ans.append('c')
			elif ans[-1] == 'c' and a[i + 1] == 'c':
				ans.append('a')
			elif ans[-1] == 'c' and a[i + 1] == '?':
				ans.append('a')
			elif ans[-1] == 'b' and a[i + 1] == '?':
				ans.append('a')
			elif ans[-1] == 'a' and a[i + 1] == '?':
				ans.append('c')
			elif ans[-1] == 'b' and a[i + 1] == 'c':
				ans.append('a')
			elif ans[-1] == 'c' and a[i + 1] == 'b':
				ans.append('a')
			elif ans[-1] == 'a' and a[i + 1] == 'c':
				ans.append('b')
			elif ans[-1] == 'c' and a[i + 1] == 'a':
				ans.append('b')
			elif ans[-1] == 'a' and a[i + 1] == 'b':
				ans.append('c')
			elif ans[-1] == 'b' and a[i + 1] == 'a':
				ans.append('c')
		else:
			ans.append(a[i])
	if k > 1:
		if a[-1] == ans[-1]:
			z = 1
		elif a[-1] == '?':
			if ans[-1] == 'a':
				ans.append('b')
			elif ans[-1] == 'b':
				ans.append('c')
			else:
				ans.append('b')
		else:
			ans.append(a[-1])
	if z == 1:
		print(-1)
	else:
		print(''.join(ans))


for _ in range(int(input())):
	s = input()
	n = len(s)
	if s[0] != 'a':
		s = 'a' + s
	else:
		s = 'b' + s
	if s[n] != 'a':
		s = s + 'a'
	else:
		s = s + 'b'
	ans = ''

	def f(a, b, x, y):
		f = 0
		r = ''
		for i in range(a, b):
			if f == 1:
				r += x
				f = 0
			else:
				r += y
				f = 1
		return r
	i = 1
	v = 0
	while i < n + 1:
		if s[i] == '?':
			lock = ''
			for j in range(i, n + 2):
				if s[j] != '?':
					lock = s[j]
					break
			if lock == 'a' and s[i - 1] == 'a':
				ans += f(i, j, 'b', 'c')
			elif lock == 'b' and s[i - 1] == 'b':
				ans += f(i, j, 'a', 'c')
			elif lock == 'c' and s[i - 1] == 'c':
				ans += f(i, j, 'b', 'a')
			elif lock == 'a' and s[i - 1] == 'b':
				ans += f(i, j, 'b', 'c')
			elif lock == 'a' and s[i - 1] == 'c':
				ans += f(i, j, 'c', 'b')
			elif lock == 'b' and s[i - 1] == 'a':
				ans += f(i, j, 'a', 'c')
			elif lock == 'b' and s[i - 1] == 'c':
				ans += f(i, j, 'c', 'a')
			elif lock == 'c' and s[i - 1] == 'a':
				ans += f(i, j, 'a', 'b')
			elif lock == 'c' and s[i - 1] == 'b':
				ans += f(i, j, 'b', 'a')
			i = j - 1
		elif s[i] == s[i + 1]:
			v = 1
			print(-1)
			break
		else:
			ans += s[i]
		i += 1
	if v == 0:
		print(ans)


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)


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


for _ in range(int(input())):
	s = input()
	s += 'a'
	s = list(s)
	d = {'a': 1, 'b': 2, 'c': 3}
	d2 = {1: 'a', 2: 'b', 3: 'c'}
	f = 0
	for i in range(len(s) - 1):
		if i == 0 and s[i] == '?' and (s[i + 1] == '?'):
			s[i] = 'a'
		if i == 0 and s[i] == '?':
			s[i] = d2[d[s[i + 1]] % 3 + 1]
		if i > 0 and s[i] == '?' and (s[i + 1] == '?'):
			s[i] = d2[d[s[i - 1]] % 3 + 1]
		elif i > 0 and s[i] == '?':
			k = d[s[i - 1]] + d[s[i + 1]]
			if k == 3:
				s[i] = 'c'
			if k == 4 and s[i - 1] == 'b':
				s[i] = 'c'
			elif k == 4:
				s[i] = 'b'
			if k == 5:
				s[i] = 'a'
			if k == 6:
				s[i] = 'a'
			if k == 2:
				s[i] = 'b'
	for i in range(1, len(s) - 1):
		if s[i] == s[i - 1]:
			print(-1)
			f = 1
			break
	if not f:
		print(''.join(s)[:len(s) - 1])


t = int(input())
for i in range(t):
	a = input()
	s = list(a)
	ans = 1
	j = 1
	if a == '?':
		print('a')
		continue
	if len(s) == 1:
		print(a)
	if len(s) == 2:
		if s[0] == s[1]:
			if s[1] != '?':
				ans = 0
			else:
				s[1] = 'a'
				s[0] = 'b'
		else:
			if s[0] == '?':
				if s[1] == 'b' or s[1] == 'c':
					s[0] = 'a'
				if s[1] == 'a':
					s[0] = 'b'
			if s[1] == '?':
				if s[0] == 'b' or s[0] == 'c':
					s[1] = 'a'
				if s[0] == 'a':
					s[1] = 'b'
	if s[0] == '?':
		if s[1] == '?':
			s[0] = 'a'
		if s[1] == 'b' or s[1] == 'a':
			s[0] = 'c'
		else:
			s[0] = 'a'
	while j < len(s) - 1:
		if s[j] == s[j - 1] and s[j] != '?' or (s[j] == s[j + 1] and s[j] != '?'):
			ans = 0
			break
		if s[j] == '?':
			if s[j - 1] == 'a':
				if s[j + 1] == 'b':
					s[j] = 'c'
				if s[j + 1] == 'a' or s[j + 1] == 'c':
					s[j] = 'b'
				if s[j + 1] == '?':
					s[j] = 'b'
			if s[j - 1] == 'b':
				if s[j + 1] == 'c':
					s[j] = 'a'
				if s[j + 1] == 'a' or s[j + 1] == 'b':
					s[j] = 'c'
				if s[j + 1] == '?':
					s[j] = 'c'
			if s[j - 1] == 'c':
				if s[j + 1] == 'a':
					s[j] = 'b'
				if s[j + 1] == 'c' or s[j + 1] == 'b':
					s[j] = 'a'
				if s[j + 1] == '?':
					s[j] = 'a'
		j += 1
	tmp = len(s)
	if s[tmp - 1] == '?':
		if s[tmp - 2] == 'b' or s[tmp - 2] == 'a':
			s[tmp - 1] = 'c'
		else:
			s[tmp - 1] = 'a'
	if ans:
		for k in range(len(s)):
			if k == len(s) - 1:
				print(s[k])
				continue
			print(s[k], end='')
	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))


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


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


seto = set(['a', 'b', 'c'])
for _ in range(int(input())):
	getlost = False
	s = list(input())
	size = len(s)
	if size == 1:
		if s[0] == '?':
			s[0] = 'a'
	if size == 2:
		if s[0] == s[1] and s[0] != '?':
			getlost = True
		elif s[0] == '?':
			if s[1] == '?':
				s[0] = 'a'
				s[1] = 'b'
			elif s[1] == 'a':
				s[0] = 'b'
			elif s[1] == 'b':
				s[0] = 'c'
			elif s[1] == 'c':
				s[0] = 'a'
		elif s[1] == '?':
			if s[0] == '?':
				s[1] = 'a'
				s[0] = 'b'
			elif s[0] == 'a':
				s[1] = 'b'
			elif s[0] == 'b':
				s[1] = 'c'
			elif s[0] == 'c':
				s[1] = 'a'
	else:
		if s[0] == '?':
			if s[1] != '?':
				setoo = seto - set([s[1]])
				s[0] = setoo.pop()
			else:
				s[0] = 'a'
		for i in range(1, size - 1):
			if s[i] == '?':
				if s[i + 1] == '?':
					setoo = seto - set([s[i - 1]])
					if len(setoo):
						s[i] = setoo.pop()
					else:
						getlost = True
				else:
					setoo = seto - set([s[i - 1], s[i + 1]])
					if len(setoo):
						s[i] = setoo.pop()
					else:
						getlost = True
			else:
				if s[i - 1] != '?':
					if s[i] == s[i - 1]:
						getlost = True
				if s[i + 1] != '?':
					if s[i] == s[i + 1]:
						getlost = True
			if getlost:
				break
		if s[-1] == '?':
			setoo = seto - set([s[-2]])
			s[-1] = setoo.pop()
	if getlost:
		print(-1)
	else:
		print(*s, sep='')


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)


def mi():
	return map(int, input().split())
for _ in range(int(input())):
	s = list(input())
	n = len(s)
	c = False
	enc = False
	fi = -1
	for i in range(n):
		if s[i] != '?' and (not enc):
			enc = True
			fi = i
		if s[i] != '?' and i < n - 1 and (s[i] == s[i + 1]):
			print(-1)
			c = True
			break
	if c:
		continue
	fc = s[fi]
	for i in range(fi - 1, -1, -1):
		if s[i] == '?':
			if s[i + 1] == 'a':
				if i > 0 and s[i - 1] != 'b':
					s[i] = 'b'
				else:
					s[i] = 'c'
			elif s[i + 1] == 'c':
				if i > 0 and s[i - 1] != 'b':
					s[i] = 'b'
				else:
					s[i] = 'a'
			elif i > 0 and s[i - 1] != 'a':
				s[i] = 'a'
			else:
				s[i] = 'c'
	for i in range(fi + 1, n):
		if s[i] == '?':
			if s[i - 1] == 'a':
				if i < n - 1 and s[i + 1] != 'b':
					s[i] = 'b'
				else:
					s[i] = 'c'
			elif s[i - 1] == 'c':
				if i < n - 1 and s[i + 1] != 'b':
					s[i] = 'b'
				else:
					s[i] = 'a'
			elif i < n - 1 and s[i + 1] != 'a':
				s[i] = 'a'
			else:
				s[i] = 'c'
	for i in range(1, n):
		if s[i] == s[i - 1]:
			print(-1)
			c = True
			break
	if c:
		continue
	print(''.join(s))


q = int(input())
for i in range(q):
	s = input()
	if len(s) == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s)
		continue
	if s[0] != '?' and s[0] == s[1] or (s[-1] != '?' and s[-2] == s[-1]):
		print(-1)
		continue
	if len(s) == 2 and s[0] == '?' and (s[1] == '?'):
		print('ab')
		continue
	if s[0] == '?':
		if s[1] == 'a':
			out = 'b'
		else:
			out = 'a'
	else:
		out = s[0]
	if s[-1] == '?':
		if s[-2] == 'a':
			last = 'b'
		else:
			last = 'a'
	else:
		last = s[-1]
	flg = True
	for i in range(1, len(s) - 1):
		c = s[i]
		ck = {'a': 1, 'b': 1, 'c': 1}
		if s[i] == '?':
			ck[out[i - 1]] = 0
			if i + 1 == len(s) - 1:
				ck[last] = 0
			else:
				ck[s[i + 1]] = 0
			if ck['a'] == 1:
				c = 'a'
			elif ck['b'] == 1:
				c = 'b'
			elif ck['c'] == 1:
				c = 'c'
		elif s[i] == s[i - 1] or s[i] == s[i + 1]:
			print(-1)
			flg = False
			break
		out = out + c
	if flg:
		print(out + last)


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


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)


next_c = {'aa': 'b', 'bb': 'c', 'cc': 'a', 'ab': 'c', 'ac': 'b', 'bc': 'a'}

def solve(s):
	ans = list()
	count = 0
	last = None
	try:
		for c in s:
			if c == '?':
				count += 1
			else:
				if count > 0:
					if last is None:
						last = 'a'
					while count > 0:
						comb = last + c if last <= c else c + last
						other = next_c[comb]
						ans.append(other)
						last = other
						count -= 1
				if last == c:
					return -1
				ans.append(c)
				last = c
		if count:
			if last is None:
				last = 'a'
			c = next_c[last + last]
			while count > 0:
				comb = last + c if last <= c else c + last
				other = next_c[comb]
				ans.append(other)
				last = other
				count -= 1
	except KeyError:
		return -1
	return ''.join(ans)
for _ in range(int(input())):
	print(solve(input()))


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


t = int(input())
for test in range(t):
	s = input()
	cond = True
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] != '?':
			cond = False
	if cond == False:
		print('-1')
	else:
		arr = list(s)
		for i in range(1, len(arr) - 1):
			if arr[i] == '?':
				if arr[i + 1] == '?':
					if arr[i - 1] == 'a':
						arr[i] = 'b'
					if arr[i - 1] == 'b':
						arr[i] = 'c'
					if arr[i - 1] == 'c':
						arr[i] = 'a'
					if i == 1 and arr[0] == '?':
						arr[i] = 'a'
				else:
					if arr[i - 1] == 'a' and arr[i + 1] == 'a':
						arr[i] = 'b'
					if arr[i - 1] == 'a' and arr[i + 1] == 'b':
						arr[i] = 'c'
					if arr[i - 1] == 'a' and arr[i + 1] == 'c':
						arr[i] = 'b'
					if arr[i - 1] == 'b' and arr[i + 1] == 'a':
						arr[i] = 'c'
					if arr[i - 1] == 'b' and arr[i + 1] == 'b':
						arr[i] = 'a'
					if arr[i - 1] == 'b' and arr[i + 1] == 'c':
						arr[i] = 'a'
					if arr[i - 1] == 'c' and arr[i + 1] == 'a':
						arr[i] = 'b'
					if arr[i - 1] == 'c' and arr[i + 1] == 'b':
						arr[i] = 'a'
					if arr[i - 1] == 'c' and arr[i + 1] == 'c':
						arr[i] = 'a'
					if arr[i - 1] == '?' and arr[i + 1] == 'a':
						arr[i] = 'b'
					if arr[i - 1] == '?' and arr[i + 1] == 'b':
						arr[i] = 'a'
					if arr[i - 1] == '?' and arr[i + 1] == 'c':
						arr[i] = 'b'
		if len(arr) >= 1:
			if arr[0] == '?':
				if len(arr) >= 2:
					if arr[1] == 'a':
						arr[0] = 'b'
					if arr[1] == 'b':
						arr[0] = 'a'
					if arr[1] == 'c':
						arr[0] = 'a'
					if arr[1] == '?':
						arr[0] = 'a'
				else:
					arr[0] = 'a'
		if len(arr) >= 2:
			if arr[len(arr) - 1] == '?':
				if arr[len(arr) - 2] == 'a':
					arr[len(arr) - 1] = 'b'
				if arr[len(arr) - 2] == 'b':
					arr[len(arr) - 1] = 'c'
				if arr[len(arr) - 2] == 'c':
					arr[len(arr) - 1] = 'a'
		res = ''.join(arr)
		print(res)


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


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


t = int(input())
for _ in range(t):
	s = input()
	ans = ['', *s]
	i = 0
	cur = ''
	for x in s:
		i += 1
		if x == '?':
			ans[i] = ({*'abc'} - {*ans[i - 1:i + 2]}).pop()
			cur = ''
		else:
			if cur == x:
				ans = [*'-1']
				break
			cur = x
	print(''.join(ans))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

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

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

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

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

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 ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	s = list(inp())
	n = len(s)
	for i in range(1, n):
		if s[i] == s[i - 1] and s[i] != '?':
			print(-1)
			return
	put = ['a', 'b', 'c']
	if n == 1:
		if s[0] == '?':
			print('a')
		else:
			print(s[0])
		return
	for i in range(n):
		if i == 0 and s[i] == '?':
			if s[i + 1] == '?':
				s[i] = 'a'
			elif s[i + 1] == 'a':
				s[i] = 'b'
			else:
				s[i] = 'a'
			continue
		if i == n - 1 and s[i] == '?':
			if s[i - 1] == 'a':
				s[i] = 'b'
			else:
				s[i] = 'a'
			continue
		if i == 0 or i == n - 1:
			continue
		if s[i] == '?':
			vis = [False] * 3
			for ii in range(3):
				if s[i - 1] == put[ii]:
					vis[ii] = True
			for ii in range(3):
				if s[i + 1] == put[ii]:
					vis[ii] = True
			for ii in range(3):
				if vis[ii] == False:
					s[i] = put[ii]
	print(''.join(s))
testcase(int(inp()))


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 fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
for _ in range(int(input())):
	s = [i for i in input()]
	flag = 0
	if len(s) == 1 and s[0] == '?':
		print('a')
		continue
	if s[0] == '?':
		if s[0] == '?' and s[1] == 'a':
			s[0] = 'b'
		elif s[0] == '?' and s[1] == 'b':
			s[0] = 'c'
		elif s[0] == '?' and s[1] == 'c':
			s[0] = 'a'
		elif s[0] == '?' and s[1] == '?':
			s[0] = 'a'
	z = len(s) - 1
	if s[z] == '?':
		if s[z] == '?' and s[z - 1] == 'a':
			s[z] = 'b'
		elif s[z] == '?' and s[z - 1] == 'b':
			s[z] = 'c'
		elif s[z] == '?' and s[z - 1] == 'c':
			s[z] = 'a'
		elif s[z] == '?' and s[z - 1] == '?':
			s[z] = 'a'
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			if (s[i + 1] == 'a' or s[i - 1] == 'a') and (s[i + 1] == 'b' or s[i - 1] == 'b'):
				s[i] = 'c'
			elif (s[i + 1] == 'a' or s[i - 1] == 'a') and (s[i + 1] == 'c' or s[i - 1] == 'c'):
				s[i] = 'b'
			elif (s[i + 1] == 'b' or s[i - 1] == 'b') and (s[i + 1] == 'c' or s[i - 1] == 'c'):
				s[i] = 'a'
			elif s[i - 1] == 'a' and s[i + 1] == '?':
				s[i] = 'b'
			elif s[i - 1] == 'b' and s[i + 1] == '?':
				s[i] = 'c'
			elif s[i - 1] == 'c' and s[i + 1] == '?':
				s[i] = 'a'
			elif s[i - 1] == 'a' and s[i + 1] == 'a':
				s[i] = 'b'
			elif s[i - 1] == 'c' and s[i + 1] == 'c':
				s[i] = 'a'
			elif s[i - 1] == 'b' and s[i + 1] == 'b':
				s[i] = 'a'
	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:
		print(i, end='')
	print()


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


s = input()
n = int(s)
ar = []
for a in range(n):
	z = input()
	ar.append(list(z))

def check(sr):
	c = 0
	while c < len(sr) - 1:
		if sr[c] == sr[c + 1]:
			return False
		else:
			c = c + 1
	return True
arr = []
for i in range(n):
	if len(ar[i]) == 1:
		if ar[i][0] == '?':
			ar[i] = 'b'
	if len(ar[i]) > 1:
		for j in range(len(ar[i])):
			if j == 0 and ar[i][j] == '?':
				if ar[i][j + 1] == 'a' or ar[i][j + 1] == '?':
					ar[i][j] = 'b'
				if ar[i][j + 1] == 'b':
					ar[i][j] = 'c'
				if ar[i][j + 1] == 'c':
					ar[i][j] = 'a'
			if j > 0 and j < len(ar[i]) - 1 and (ar[i][j] == '?'):
				if ar[i][j - 1] == 'a' and ar[i][j + 1] == 'b' or (ar[i][j - 1] == 'b' and ar[i][j + 1] == 'a'):
					ar[i][j] = 'c'
				if ar[i][j - 1] == 'a' and ar[i][j + 1] == 'c' or (ar[i][j - 1] == 'c' and ar[i][j + 1] == 'a'):
					ar[i][j] = 'b'
				if ar[i][j - 1] == 'b' and ar[i][j + 1] == 'c' or (ar[i][j - 1] == 'c' and ar[i][j + 1] == 'b'):
					ar[i][j] = 'a'
				if ar[i][j - 1] == 'a' and ar[i][j + 1] == 'a':
					ar[i][j] = 'b'
				if ar[i][j - 1] == 'b' and ar[i][j + 1] == 'b':
					ar[i][j] = 'c'
				if ar[i][j - 1] == 'c' and ar[i][j + 1] == 'c':
					ar[i][j] = 'a'
				if ar[i][j - 1] == 'a' and ar[i][j + 1] == '?':
					ar[i][j] = 'b'
				if ar[i][j - 1] == 'b' and ar[i][j + 1] == '?':
					ar[i][j] = 'c'
				if ar[i][j - 1] == 'c' and ar[i][j + 1] == '?':
					ar[i][j] = 'a'
			if j == len(ar[i]) - 1 and ar[i][j] == '?':
				if ar[i][j - 1] == 'a' or ar[i][j - 1] == '?':
					ar[i][j] = 'b'
				if ar[i][j - 1] == 'b':
					ar[i][j] = 'c'
				if ar[i][j - 1] == 'c':
					ar[i][j] = 'a'
for i in range(n):
	if len(ar[i]) > 1:
		if check(''.join(ar[i])):
			print(''.join(ar[i]))
		else:
			print(-1)
	if len(ar[i]) == 1:
		print(ar[i])


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 i in range(t):
	text = list(input())
	string = list(filter(lambda x: x != '?', text))
	ok = True
	for j in range(len(text) - 1):
		if text[j] == text[j + 1] and text[j] != '?':
			ok = False
			break
	if not ok:
		print(-1)
	else:
		for j in range(len(text)):
			if text[j] == '?':
				if len(text) - 1 > j > 0:
					if text[j - 1] == 'a' and text[j + 1] == 'b':
						text[j] = 'c'
						continue
					if text[j - 1] == 'a':
						text[j] = 'b'
						continue
					if text[j - 1] == 'b' and text[j + 1] == 'c':
						text[j] = 'a'
						continue
					if text[j - 1] == 'b':
						text[j] = 'c'
						continue
					if text[j - 1] == 'c' and text[j + 1] == 'a':
						text[j] = 'b'
						continue
					if text[j - 1] == 'c':
						text[j] = 'a'
						continue
				if j == 0 and len(text) > 1:
					if text[1] == 'c':
						text[0] = 'b'
					else:
						text[0] = 'c'
					continue
				if j == len(text) - 1 and len(text) > 1:
					if text[-2] == 'c':
						text[-1] = 'b'
					else:
						text[-1] = 'c'
					continue
				text[j] = 'a'
		print(''.join(text))


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


for case in range(int(input())):
	str = input()
	str_list = []
	char_set = {'a', 'b', 'c'}
	for ch in str:
		str_list.append(ch)
	n = len(str_list)
	answer_flag = 0
	if n >= 2:
		for i in range(n):
			if str_list[i] != '?':
				try:
					if str_list[i] == str_list[i + 1]:
						answer_flag = -1
						break
				except IndexError:
					pass
				if i != 0 and str_list[i] == str_list[i - 1]:
					answer_flag = -1
					break
			else:
				possible_set = set(['a', 'b', 'c'])
				try:
					possible_set.remove(str_list[i - 1])
				except (KeyError, IndexError):
					pass
				try:
					possible_set.remove(str_list[i + 1])
				except (KeyError, IndexError):
					pass
				if len(possible_set) == 0:
					answer_flag = -1
					break
				else:
					str_list[i] = list(possible_set)[0]
		if answer_flag == -1:
			print(answer_flag)
		else:
			print(''.join(str_list))
	elif str_list[0] == '?':
		print('a')
	else:
		print(str)


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


t = int(input())
chars = ['a', 'b', 'c']

def main():
	s = list(input())
	l = len(s)
	for i in range(l - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print(-1)
			return
	if l == 1:
		if s[0] == '?':
			s[0] = 'a'
	for i in range(l):
		if s[i] == '?':
			for char in chars:
				if i == 0:
					if char != s[i + 1]:
						s[i] = char
				elif i == l - 1:
					if char != s[i - 1]:
						s[i] = char
				elif char != s[i - 1] and char != s[i + 1]:
					s[i] = char
	for i in range(l):
		if s[i] == '?':
			print(-1)
			return
	ans = ''.join(s)
	print(ans)
for _ in range(t):
	main()


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


nb = int(input())
for i in range(nb):
	tmp = input()
	t = ['a', 'b', 'c']
	res = ''
	cnt = 0
	err = False
	for j in range(len(tmp)):
		if tmp[j] == 'a':
			cnt = 1
			res += tmp[j]
		elif tmp[j] == 'b':
			cnt = 2
			res += tmp[j]
		elif tmp[j] == 'c':
			cnt = 0
			res += tmp[j]
		if tmp[j] == '?':
			if j + 1 == len(tmp):
				res += t[cnt]
			elif j + 1 < len(tmp) and tmp[j + 1] != t[cnt]:
				res += t[cnt]
				cnt = (cnt + 1) % 3
			elif j + 1 < len(tmp):
				cnt = (cnt + 1) % 3
				res += t[cnt]
		if len(res) > 1 and res[-1] == res[-2]:
			err = True
			break
	if err:
		print(-1)
		continue
	print(res)


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


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)


import sys
from fractions import gcd
cin = sys.stdin.buffer.readline
for _ in range(int(cin())):
	s = input()
	ans = ''
	n = len(s)
	for i in range(n):
		if s[i] == '?':
			if i == 0:
				if n > 1:
					ans += ['a', 'b'][s[i + 1] == 'a']
				else:
					ans += 'a'
			elif i == n - 1 or s[i + 1] == '?':
				if ans[-1] == 'a':
					ans += 'b'
				else:
					ans += 'a'
			elif ans[-1] == 'a':
				ans += ['c', 'b'][s[i + 1] == 'c']
			elif ans[-1] == 'b':
				ans += ['c', 'a'][s[i + 1] == 'c']
			else:
				ans += ['a', 'b'][s[i + 1] == 'a']
		else:
			ans += s[i]
	for i in range(1, n):
		if ans[i] == ans[i - 1]:
			ans = -1
			break
	print(ans)


t = int(input().strip())
for _ in range(t):
	s = input().strip()
	l = list(s)
	llen = len(l)
	if llen == 1:
		if l[0] == '?':
			print('a')
		else:
			print(l[0])
		continue
	if l[0] == '?':
		l[0] = 'a' if l[1] != 'a' else 'b' if l[1] != 'b' else 'c'
	if l[-1] == '?':
		l[-1] = 'a' if l[-2] != 'a' else 'b' if l[-2] != 'b' else 'c'
	for (i, c) in enumerate(l):
		if c == '?':
			l[i] = 'b' if l[i - 1] != 'b' and l[i + 1] != 'b' else 'c' if l[i - 1] != 'c' and l[i + 1] != 'c' else 'a'
	same = False
	for (i, c) in enumerate(l[1:]):
		if c == l[i]:
			same = True
			break
	if same:
		print(-1)
	else:
		print(''.join(l))


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


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
for _ in range(ii()):
	s = si()
	s = list(s)
	A = ['a', 'b', 'c']
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			for j in A:
				if j != s[i - 1] and j != s[i + 1]:
					s[i] = j
					break
	if len(s) == 1:
		if s[0] == '?':
			print('a')
			continue
		else:
			print(s[0])
			continue
	if len(s) >= 2:
		if s[0] == '?':
			for i in A:
				if s[1] != i:
					s[0] = i
					break
		if s[-1] == '?':
			for i in A:
				if s[-2] != i:
					s[-1] = i
					break
	fg = 0
	for i in range(1, len(s)):
		if s[i] == '?' or s[i] == s[i - 1]:
			fg = 1
			break
	if fg == 1:
		print(-1)
	else:
		print(''.join(s))


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


def repair_text(s):
	r = {'a', 'b', 'c'}
	s.append('?')
	for i in range(len(s) - 1):
		if s[i] == '?':
			x = r.difference(s[i - 1], s[i + 1])
			s[i] = x.pop()
	return ''.join((i for i in s[:-1]))
t = int(input().strip())
for i in range(t):
	s = list(input().strip())
	s = repair_text(s)
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
	else:
		print(s)


for _ in range(int(input())):
	a = input()
	if 'aa' in a or 'bb' in a or 'cc' in a:
		print('-1')
	else:
		n = len(a)
		if n == 1:
			if a[0] == '?':
				print('a')
			else:
				print(a)
		else:
			a = list(a)
			if a[0] == '?':
				if a[1] != 'a':
					a[0] = 'a'
				elif a[1] != 'b':
					a[0] = 'b'
				elif a[1] != 'c':
					a[0] = 'c'
			for x in range(1, n - 1):
				if a[x] == '?':
					if a[x + 1] == 'a':
						if a[x - 1] == 'a':
							a[x] = 'b'
						if a[x - 1] == 'b':
							a[x] = 'c'
						elif a[x - 1] == 'c':
							a[x] = 'b'
					elif a[x + 1] == 'b':
						if a[x - 1] == 'a':
							a[x] = 'c'
						if a[x - 1] == 'b':
							a[x] = 'c'
						elif a[x - 1] == 'c':
							a[x] = 'a'
					elif a[x + 1] == 'c':
						if a[x - 1] == 'a':
							a[x] = 'b'
						if a[x - 1] == 'b':
							a[x] = 'a'
						elif a[x - 1] == 'c':
							a[x] = 'a'
					elif a[x - 1] != 'a':
						a[x] = 'a'
					elif a[x - 1] != 'b':
						a[x] = 'b'
					elif a[x - 1] != 'c':
						a[x] = 'c'
			if a[n - 1] == '?':
				if a[n - 2] != 'a':
					a[n - 1] = 'a'
				elif a[n - 2] != 'b':
					a[n - 1] = 'b'
				elif a[n - 2] != 'c':
					a[n - 1] = 'c'
			print(''.join([str(elem) for elem in a]))


t = int(input())
s = []
for i in range(t):
	s.append(input())
que = [0] * t
c = 0
v = ['a', 'b', 'c']

def p(i):
	q = []
	if len(i) == 1:
		q = 0
	else:
		for j in range(len(i) - 1):
			if i[j] == '?':
				q.append(j)
			if i[j] and i[j + 1] != '?' and (i[j] == i[j + 1]):
				return -1
		if i[j + 1] == '?':
			q.append(j + 1)
	return q
for i in s:
	que[c] = p(i)
	c += 1
for (i, val) in enumerate(s):
	if que[i] == -1:
		print(-1)
	elif len(val) == 1:
		print('a')
	else:
		for j in que[i]:
			if j == 0:
				if val[j + 1] == 'a':
					val = 'b' + val[j + 1:]
				elif val[j + 1] == 'b':
					val = 'c' + val[j + 1:]
				else:
					val = 'a' + val[j + 1:]
			elif j == len(val) - 1:
				if val[j - 1] == 'a':
					val = val[:j] + 'b'
				elif val[j - 1] == 'b':
					val = val[:j] + 'c'
				elif val[j - 1] == 'c':
					val = val[:j] + 'a'
			elif val[j - 1] == 'a' and val[j + 1] != 'b':
				val = val[:j] + 'b' + val[j + 1:]
			elif val[j - 1] == 'a' and val[j + 1] != 'c':
				val = val[:j] + 'c' + val[j + 1:]
			elif val[j - 1] == 'b' and val[j + 1] != 'a':
				val = val[:j] + 'a' + val[j + 1:]
			elif val[j - 1] == 'b' and val[j + 1] != 'c':
				val = val[:j] + 'c' + val[j + 1:]
			elif val[j - 1] == 'c' and val[j + 1] != 'a':
				val = val[:j] + 'a' + val[j + 1:]
			elif val[j - 1] == 'c' and val[j + 1] != 'b':
				val = val[:j] + 'b' + val[j + 1:]
		print(val)


n = int(input())
s = [[] for i in range(n)]
for i in range(n):
	s[i] = input()
for i in range(n):
	t = list(s[i])
	m = len(t)
	for j in range(m):
		if t[j] == '?':
			pool = {'a', 'b', 'c'}
			if j > 0:
				pool.discard(t[j - 1])
			if j < m - 1:
				pool.discard(t[j + 1])
			t[j] = pool.pop()
	t = ''.join(t)
	if any((t[i] == t[i + 1] for i in range(m - 1))):
		print(-1)
	else:
		print(t)


t = int(input())
for x in range(t):
	a = list(input())
	if len(a) >= 2 and a[0] == '?':
		if a[1] == 'a':
			a[0] = 'b'
		elif a[1] == 'b':
			a[0] = 'a'
		elif a[1] == 'c':
			a[0] = 'b'
		elif a[1] == '?':
			a[0] = 'a'
	elif a[0] == '?':
		a[0] = 'a'
	for x in range(1, len(a) - 1):
		if a[x] == '?':
			g = a[x - 1] + a[x + 1]
			if g == 'ab' or g == 'ba':
				a[x] = 'c'
			elif g == 'ac' or g == 'ca':
				a[x] = 'b'
			elif g == 'bc' or g == 'cb':
				a[x] = 'a'
			if g == 'aa':
				a[x] = 'b'
			elif g == 'bb':
				a[x] = 'a'
			elif g == 'cc':
				a[x] = 'b'
			if g == 'a?':
				a[x] = 'b'
			elif g == 'b?':
				a[x] = 'a'
			elif g == 'c?':
				a[x] = 'b'
	if len(a) >= 2 and a[-1] == '?':
		if a[-2] == 'a':
			a[-1] = 'b'
		elif a[-2] == 'b':
			a[-1] = 'a'
		elif a[-2] == 'c':
			a[-1] = 'b'
		elif a[-2] == '?':
			a[-1] = 'a'
	elif a[-1] == '?':
		a[-1] = 'a'
	t = True
	for x in range(len(a) - 1):
		if a[x] == a[x + 1]:
			t = False
	if t:
		print(''.join(a))
	else:
		print(-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()


from collections import defaultdict
mapp = {'a': 0, 'b': 1, 'c': 2}
mapp_r = {0: 'a', 1: 'b', 2: 'c'}

def sol():
	s = input()
	a = []
	n = len(s)
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print('-1')
			return
	pos = 0
	c = 0
	d = 0
	again = 0
	dic = dict()
	for i in range(n):
		if s[i] == '?':
			if again == 0:
				pos = i
			again = 1
		else:
			if again == 1:
				d = mapp[s[i]]
				if pos == 0:
					dic[pos] = ((d + 1) % 3, d)
				else:
					dic[pos] = (c, d)
			c = mapp[s[i]]
			again = 0
	if again == 1:
		dic[pos] = (c, (c + 1) % 3)
	i = 0
	while i < n:
		if s[i] == '?':
			(c, d) = dic[i]
			if c == d:
				neg = 1
				inloop = 0
				while s[i] == '?':
					print(mapp_r[(c + 1 * neg) % 3], end='')
					neg = neg * -1
					i += 1
					if i >= n:
						inloop = 1
						break
				if i < n and inloop == 1:
					print(s[i], end='')
			else:
				neg = 1
				c2 = 3 - (c + d)
				inloop = 0
				while s[i] == '?':
					if neg:
						print(mapp_r[c2 % 3], end='')
					else:
						print(mapp_r[c % 3], end='')
					neg = (neg + 1) % 2
					i += 1
					if i >= n:
						inloop = 1
						break
				if i < n and inloop == 1:
					print(s[i], end='')
		else:
			print(s[i], end='')
			i += 1
	print()
for _ in range(int(input())):
	sol()


for _ in range(int(input())):
	s = input()
	if len(s) == 1:
		print('a' if s is '?' else s)
		continue
	ans = []
	if s[0] is '?':
		ans.append('b' if s[1] is 'a' else 'a')
	else:
		ans.append(s[0])
	for c in s[1:]:
		if ans[-1] is '?':
			for b in 'abc':
				if ans[-2] != b and c != b:
					ans[-1] = b
					break
		elif ans[-1] is c:
			ans = None
			break
		ans.append(c)
	if ans is None:
		print(-1)
	else:
		if ans[-1] is '?':
			for b in 'abc':
				if ans[-2] != b:
					ans[-1] = b
					break
		print(*ans, sep='')


a = int(input())
for x in range(a):
	prev = ''
	next = ''
	str = input()
	res = []
	ch = 0
	for i in range(len(str)):
		if str[i] == prev:
			print(-1)
			ch = 1
			break
		if i + 1 != len(str):
			next = str[i + 1]
		if str[i] == '?':
			if 'a' != prev and 'a' != next:
				res.append('a')
				prev = 'a'
			elif 'b' != prev and 'b' != next:
				res.append('b')
				prev = 'b'
			elif 'c' != prev and 'c' != next:
				res.append('c')
				prev = 'c'
		if str[i] == 'a' or str[i] == 'b' or str[i] == 'c':
			prev = str[i]
			res.append(prev)
	if ch == 0:
		print(''.join((y for y in res)))


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


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'
d = {'a': 'b', 'b': 'c', 'c': 'a', '?': 'a'}
for _ in range(int(input())):
	s = list(input())
	n = len(s)
	if n == 1 and s[0] == '?':
		print('a')
		continue
	if n == 1:
		print(s[0])
		continue
	flag = False
	for i in range(1, n):
		if s[i] == s[i - 1] and s[i] != '?':
			flag = True
	if flag:
		print(-1)
		continue
	if s[0] == '?':
		s[0] = d[s[1]]
	for i in range(1, n - 1):
		if s[i] == '?':
			if s[i + 1] == '?':
				s[i] = d[s[i - 1]]
			else:
				x = tuple(sorted([s[i - 1], s[i + 1]]))
				if len(set(x)) == 1:
					s[i] = d[x[0]]
				elif x == ('a', 'b'):
					s[i] = 'c'
				elif x == ('b', 'c'):
					s[i] = 'a'
				elif x == ('a', 'c'):
					s[i] = 'b'
	if s[-1] == '?':
		s[-1] = d[s[-2]]
	print(*s, sep='')


T = int(input())
for t in range(0, T):
	s = list(input())
	lens = len(s)
	flag = 0
	for i in range(0, lens - 1):
		if s[i] == s[i + 1] and s[i + 1] != '?':
			flag = 1
	if flag == 1:
		print(-1)
	elif lens == 1:
		if s[0] != '?':
			print(s[0])
		else:
			print('a')
	else:
		if s[0] == '?':
			if s[1] == '?':
				s[0] = 'a'
			elif s[1] == 'c':
				s[0] = 'a'
			else:
				s[0] = 'c'
		for i in range(1, lens - 1):
			if s[i] == '?':
				if s[i + 1] != '?':
					t1 = ord(s[i - 1])
					t2 = ord(s[i + 1])
					if t1 != t2:
						s[i] = chr(294 - t1 - t2)
					elif t1 == 99:
						s[i] = 'a'
					else:
						s[i] = 'c'
				elif s[i - 1] == 'c':
					s[i] = 'a'
				else:
					s[i] = 'c'
		if s[-1] == '?':
			if s[-2] == 'c':
				s[-1] = 'a'
			else:
				s[-1] = 'c'
		for i in s:
			print(i, end='')
		print()


t = int(input())

def findBestCand(ind, arr):
	cand = 'abc'
	for x in cand:
		if arr[ind - 1] != x and arr[ind + 1] != x:
			return x
for _ in range(t):
	s = input()
	if s.count('aa') or s.count('bb') or s.count('cc'):
		print(-1)
	else:
		ans = [x for x in s]
		for i in range(1, len(ans) - 1):
			if ans[i] == '?':
				ans[i] = findBestCand(i, ans)
		cand = 'abc'
		if len(ans) == 1:
			if ans[0] == '?':
				ans[0] = 'a'
		if ans[0] == '?':
			for x in cand:
				if ans[1] != x:
					ans[0] = x
					break
		if ans[-1] == '?':
			for x in cand:
				if ans[-2] != x:
					ans[-1] = x
					break
		print(''.join(ans))


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

def type2():
	return list(type1())

def type3():
	return int(input())
for _ in range(type3()):
	s = input()
	flag = 0
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			flag = 1
			break
	if flag != 1:
		st = {'a', 'b', 'c'}
		ans = ''
		s = list(s)
		for i in range(len(s)):
			if s[i] == '?':
				if len(s) == 1:
					s[i] = 'a'
				elif i == 0:
					if len(s) > 1 and s[i + 1] == '?':
						s[i] = 'a'
					else:
						st.remove(s[1])
						s[i] = st.pop()
				elif i == len(s) - 1:
					st.remove(s[i - 1])
					s[i] = st.pop()
				elif s[i + 1] == '?':
					st.remove(s[i - 1])
					s[i] = st.pop()
				else:
					st.remove(s[i - 1])
					if s[i - 1] != s[i + 1]:
						st.remove(s[i + 1])
					s[i] = st.pop()
			st = {'a', 'b', 'c'}
		print(''.join(s))
	else:
		print(-1)


t = int(input())
res = []
suivant = {}
suivant['a'] = 'b'
suivant['b'] = 'c'
suivant['c'] = 'a'

def verifyBeautiful(word):
	for j in range(len(word) - 1):
		if word[j] == word[j + 1]:
			return False
	return True
for i in range(t):
	s = input()
	new = ''
	if s[0] == '?':
		if len(s) >= 2:
			if s[1] == '?':
				new += 'a'
			else:
				new += suivant[s[1]]
	else:
		new += s[0]
	for i in range(1, len(s) - 1):
		if s[i] != '?':
			new += s[i]
		else:
			lettre = suivant[new[i - 1]]
			if s[i + 1] == lettre:
				lettre = suivant[lettre]
			new += lettre
	if s[len(s) - 1] == '?':
		if len(s) >= 2:
			new += suivant[new[len(s) - 2]]
		else:
			new += 'a'
	else:
		new += s[len(s) - 1]
	if verifyBeautiful(new):
		res.append(new)
	else:
		res.append(-1)
for ligne in res:
	print(ligne)


import sys, math

def input():
	return sys.stdin.readline()[:-1]

def main():
	q = int(input())
	for _ in range(q):
		s = [str(x) for x in input()]
		if len(s) == 1:
			if s[0] == '?':
				print('a')
			else:
				print(s[0])
		else:
			f = 0
			for k in range(len(s) - 1):
				if s[k] == s[k + 1]:
					if s[k] != '?':
						f = 1
						break
			a = set(['a', 'b', 'c'])
			if len(s) >= 3:
				for k in range(1, len(s) - 1):
					if s[k] == '?':
						s[k] = list(a - set([s[k - 1], s[k + 1]]))[0]
			if s[0] == '?':
				s[0] = list(a - set([s[1]]))[0]
			if s[-1] == '?':
				s[-1] = list(a - set([s[-2]]))[0]
			if f == 1:
				print(-1)
			else:
				print(''.join(s))
main()


lis = ['a', 'b', 'c']
t = eval(input())
strings = list()
for i in range(t):
	temp = input()
	strings.append(temp)
for string in strings:
	if len(string) <= 1 and string != '?':
		print(string)
	list_of_str = list(string)
	for i in range(len(list_of_str)):
		if i == 0 and list_of_str[i] == '?':
			if len(list_of_str) == 1:
				next_str = 0
			elif list_of_str[i + 1] == '?':
				next_str = 0
			else:
				next_str = (ord(list_of_str[i + 1]) + 1 - 97) % 3
			list_of_str[i] = lis[next_str]
		elif i < len(list_of_str) - 1 and list_of_str[i] != '?' and (list_of_str[i] == list_of_str[i + 1]):
			print(-1)
			break
		elif list_of_str[i] == '?':
			next_str = (ord(list_of_str[i - 1]) + 1 - 97) % 3
			if list_of_str[(i + 1 - len(list_of_str)) % len(list_of_str)] == lis[next_str]:
				next_str = (ord(list_of_str[i - 1]) + 2 - 97) % 3
				if list_of_str[i - 1] == lis[next_str]:
					print(-1)
					break
				else:
					list_of_str[i] = lis[next_str]
			else:
				list_of_str[i] = lis[next_str]
		if i == len(list_of_str) - 1:
			str1 = ''
			print(str1.join(list_of_str))


x = int(input())
A = []
for i in range(x):
	s0 = input()
	s = ''
	if s0[0] == 'a':
		s += '2'
	else:
		s += '1'
	for i in range(len(s0)):
		if s0[i] == 'a':
			s += '1'
		elif s0[i] == 'b':
			s += '2'
		elif s0[i] == 'c':
			s += '3'
		elif s0[i] == '?':
			s += '?'
	l = len(s)
	s2 = ''
	k = True
	for i in range(l):
		if s[i] == '?':
			if i < l - 1:
				if s[i + 1] != '?':
					if int(s2[i - 1]) in [1, 2] and int(s[i + 1]) in [1, 2]:
						s2 += '3'
					elif int(s2[i - 1]) in [1, 3] and int(s[i + 1]) in [1, 3]:
						s2 += '2'
					else:
						s2 += '1'
				elif int(s2[i - 1]) != 2:
					s2 += '2'
				else:
					s2 += '1'
			elif int(s2[i - 1]) != 2:
				s2 += '2'
			else:
				s2 += '1'
		else:
			if i != 0:
				if int(s2[i - 1]) == int(s[i]):
					k = False
			s2 += s[i]
	if not k:
		A.append(-1)
	else:
		S = ''
		s2 = s2[1:]
		for i in range(len(s2)):
			S += chr(int(s2[i]) + ord('a') - 1)
		A.append(S)
for a in A:
	print(a)


t = int(input())
for _ in range(t):
	s = input()
	if len(s) == 1:
		if s[0] == '?' or s[0] == 'b' or s[0] == 'c':
			print('a')
			continue
		else:
			print('b')
			continue
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
	else:
		s = list(s)
		ch = ['a', 'b', 'c']
		d = {'a': 1, 'b': 2, 'c': 3}
		if s[0] == '?':
			if s[1] == '?':
				s[0] = ch[0]
			else:
				s[0] = ch[(1 + ord(s[1]) - ord('a')) % 3]
		if s[-1] == '?':
			if s[-2] == '?':
				s[-1] = ch[0]
			else:
				s[-1] = ch[(1 + ord(s[-2]) - ord('a')) % 3]
		for i in range(1, len(s) - 1):
			if s[i] == '?':
				if s[i - 1] == s[i + 1] or s[i + 1] == '?':
					idx = (1 + ord(s[i - 1]) - ord('a')) % 3
					s[i] = ch[idx]
				else:
					s[i] = ch[6 - d[s[i - 1]] - d[s[i + 1]] - 1]
		print(''.join(s))


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


for _ in range(int(input())):
	given = '-' + input() + '-'
	cannot = False
	for x in ['aa', 'bb', 'cc']:
		if x in given:
			cannot = True
			break
	if not cannot:
		given = list(given)
		for j in range(len(given)):
			if given[j] == '?':
				canbe = [given[j - 1], given[j + 1]]
				for x in 'abc':
					if x not in canbe:
						given[j] = x
	if cannot:
		print(-1)
	else:
		print(''.join(given[1:-1]))


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


n = int(input())
for i in range(n):
	s = list(input())
	flag = False
	if len(s) == 1:
		print('a')
		continue
	if len(s) == 2:
		if s[0] == s[1] == '?':
			print('ab')
			continue
		elif s[0] == '?':
			if s[1] != 'a':
				s[0] = 'a'
			else:
				s[0] = 'b'
			print(''.join(s))
			continue
		else:
			if s[0] != 'a':
				s[1] = 'a'
			else:
				s[1] = 'b'
			print(''.join(s))
			continue
	for j in range(len(s) - 1):
		if s[j] != '?' and s[j] == s[j + 1]:
			print(-1)
			flag = True
			break
	if not flag:
		for j in range(1, len(s) - 1):
			if s[j] == s[j - 1] == s[j + 1] == '?':
				s[j - 1] = 'a'
				s[j] = 'b'
			elif s[j] == s[j - 1] == '?':
				if s[j + 1] != 'a':
					s[j] = 'a'
					s[j - 1] = 'b'
				else:
					s[j] = 'b'
					s[j - 1] = 'a'
			elif s[j] == s[j + 1] == '?':
				if s[j - 1] != 'a':
					s[j] = 'a'
				else:
					s[j] = 'b'
			elif s[j] == '?' and s[j - 1] == s[j + 1]:
				if s[j - 1] != 'a':
					s[j] = 'a'
				else:
					s[j] = 'b'
			elif s[j] == '?' and s[j - 1] != s[j + 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'
				else:
					s[j] = 'c'
			elif s[j - 1] == '?':
				if s[j] != 'a':
					s[j - 1] = 'a'
				else:
					s[j - 1] = 'b'
		if s[-1] == '?':
			if s[-2] != 'a':
				s[-1] = 'a'
			else:
				s[-1] = 'b'
		print(''.join(s))


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


def fill(start, end, first, second):
	if first == 'a' and second == 'a':
		pair = ['b', 'c']
	elif first == 'a' and second == 'b':
		pair = ['c', 'a']
	elif first == 'a' and second == 'c':
		pair = ['b', 'a']
	elif first == 'b' and second == 'a':
		pair = ['c', 'b']
	elif first == 'b' and second == 'b':
		pair = ['a', 'c']
	elif first == 'b' and second == 'c':
		pair = ['a', 'b']
	elif first == 'c' and second == 'a':
		pair = ['b', 'c']
	elif first == 'c' and second == 'b':
		pair = ['a', 'c']
	else:
		pair = ['a', 'b']
	counter = 0
	for j in range(start, end):
		s[j] = pair[counter % 2]
		counter += 1
t = int(input())
result = []
for _ in range(t):
	flag = True
	s = list(input())
	prev = s[0]
	start = 1
	while start < len(s) and prev == '?':
		pointer = 0
		prev = s[start]
		start += 1
	if start == len(s) and prev == '?':
		fill(0, len(s), 'a', 'b')
		result.append(''.join(s))
	else:
		if start > 1:
			fill(0, start - 1, s[start - 1], s[start - 1])
		for i in range(start, len(s)):
			cur = s[i]
			if cur == '?':
				if cur != prev:
					pointer = i
					first = prev
				prev = cur
			elif prev == '?':
				second = cur
				fill(pointer, i, first, second)
				prev = cur
			elif cur == prev:
				flag = False
				result.append(-1)
				break
			else:
				prev = cur
		if flag:
			if prev == '?':
				fill(pointer, len(s), first, first)
			result.append(''.join(s))
for i in range(t):
	print(result[i])


for _ in range(int(input())):
	s = input()
	if any((s.count(i + i) for i in 'abc')):
		print(-1)
		continue
	ans = ''
	for i in range(len(s)):
		if s[i] != '?':
			ans += s[i]
		else:
			try:
				pre = ans[i - 1]
			except IndexError:
				pre = '?'
			try:
				nex = s[i + 1]
			except IndexError:
				nex = '?'
			ans += {'a', 'b', 'c'}.difference({pre, nex}).pop()
	print(ans)


import sys

def inp():
	return sys.stdin.readline().strip()
for _ in range(int(inp())):
	s = inp()
	ll = [i for i in s]
	n = len(ll)
	f = True
	for i in range(1, n):
		if ll[i] == '?':
			continue
		if ll[i - 1] == ll[i]:
			f = False
			break
	if not f:
		print(-1)
		continue
	stt = set(['a', 'b', 'c', '?'])
	for i in range(n):
		if ll[i] == '?':
			st = set(['?'])
			if i - 1 >= 0:
				st.add(ll[i - 1])
			if i + 1 < n:
				st.add(ll[i + 1])
			sttt = stt - st
			e = sttt.pop()
			ll[i] = e
	print(''.join(ll))


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


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

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

def fi():
	return float(stdin.readline())

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

def fmi():
	return map(float, stdin.readline().split())

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

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()
pp = dict(a='b', b='c', c='a')
ss = dict(a='c', b='a', c='b')
for _ in range(ii()):
	a = lsi()
	a += [1]
	if a[0] == '?':
		if len(a) > 2:
			if a[0] != a[1]:
				a[0] = pp[a[1]]
			else:
				a[0] = 'a'
		else:
			a[0] = 'a'
	for i in range(1, len(a) - 1):
		if a[i] != '?' and a[i] == a[i - 1]:
			a = ['-', 1, 1]
			break
		if a[i] == '?':
			if a[i + 1] == pp[a[i - 1]]:
				a[i] = ss[a[i - 1]]
			else:
				a[i] = pp[a[i - 1]]
	print(*a[:-1], sep='')


def change_char(s, p, r):
	return s[:p] + r + s[p + 1:]
n = int(input())
while n != 0:
	flag = 0
	inp_string = input()
	len1 = len(inp_string)
	ans = 0
	q_count = inp_string.count('?')
	final_string1 = ''
	final_string = inp_string
	if len1 == 1:
		final_string = change_char(final_string, 0, 'a')
	else:
		for i in range(0, len1 - 1):
			if final_string[i] == '?':
				if final_string[i + 1] == 'a':
					if i == 0:
						final_string = change_char(final_string, i, 'b')
					elif final_string[i - 1] == 'a':
						final_string = change_char(final_string, i, 'b')
					elif final_string[i - 1] == 'c':
						final_string = change_char(final_string, i, 'b')
					elif final_string[i - 1] == 'b':
						final_string = change_char(final_string, i, 'c')
				elif final_string[i + 1] == 'b':
					if i == 0:
						final_string = change_char(final_string, i, 'c')
					elif final_string[i - 1] == 'a':
						final_string = change_char(final_string, i, 'c')
					elif final_string[i - 1] == 'c':
						final_string = change_char(final_string, i, 'a')
					elif final_string[i - 1] == 'b':
						final_string = change_char(final_string, i, 'c')
				elif final_string[i + 1] == 'c':
					if i == 0:
						final_string = change_char(final_string, i, 'b')
					elif final_string[i - 1] == 'a':
						final_string = change_char(final_string, i, 'b')
					elif final_string[i - 1] == 'c':
						final_string = change_char(final_string, i, 'b')
					elif final_string[i - 1] == 'b':
						final_string = change_char(final_string, i, 'a')
				elif final_string[i + 1] == '?':
					if i == 0:
						final_string = change_char(final_string, i, 'a')
					elif final_string[i - 1] == 'a':
						final_string = change_char(final_string, i, 'b')
					elif final_string[i - 1] == 'c':
						final_string = change_char(final_string, i, 'b')
					elif final_string[i - 1] == 'b':
						final_string = change_char(final_string, i, 'a')
			elif final_string[i + 1] == final_string[i]:
				ans = -1
				flag = 1
				break
		if final_string[len1 - 1] == '?':
			if final_string[len1 - 2] == 'a':
				final_string = change_char(final_string, len1 - 1, 'b')
			elif final_string[len1 - 2] == 'c':
				final_string = change_char(final_string, len1 - 1, 'b')
			elif final_string[len1 - 2] == 'b':
				final_string = change_char(final_string, len1 - 1, 'a')
	if flag == 1:
		print(ans)
	else:
		print(final_string)
	n -= 1


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


t = int(input())
while t:
	s1 = input()
	checker = False
	s = list(s1)
	res = s

	def condition(character1, character2):
		output_char = ''
		if character1 == 'a' and (character2 == 'b' or character2 == '?' or character2 == 'a'):
			output_char = 'c'
		elif character1 == 'b' and (character2 == 'c' or character2 == '?' or character2 == 'b'):
			output_char = 'a'
		elif character1 == 'c' and (character2 == 'a' or character2 == '?' or character2 == 'c'):
			output_char = 'b'
		elif character1 == 'b' and (character2 == 'a' or character2 == '?' or character2 == 'b'):
			output_char = 'c'
		elif character1 == 'c' and (character2 == 'b' or character2 == '?' or character2 == 'c'):
			output_char = 'a'
		elif character1 == 'a' and (character2 == 'c' or character2 == '?' or character2 == 'a'):
			output_char = 'b'
		elif character1 == '' and character2 == 'a':
			output_char = 'b'
		elif character1 == '' and character2 == 'b':
			output_char = 'c'
		elif character1 == '' and character2 == 'c':
			output_char = 'a'
		else:
			output_char = 'a'
		return output_char
	for i in range(0, len(s) - 1):
		if s[i] == s[i + 1] and s[i] != '?':
			print('-1')
			checker = True
			break
		elif i == 0 and res[i] == '?':
			res[i] = condition('', res[i + 1])
		elif res[i] == '?':
			res[i] = condition(res[i - 1], res[i + 1])
	if res[len(s) - 1] == '?':
		res[len(s) - 1] = condition('', res[len(s) - 2])
	if checker == False:
		print(''.join(map(str, res)))
	t -= 1


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


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


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


import random

def truth(s):
	for i in range(len(s) - 1):
		if s[i] == s[i + 1] and s[i].isalpha() and s[i + 1].isalpha():
			return False
	return True

def ch1(s):
	a = ['a', 'c', 'b']
	for i in range(len(a)):
		if s != a[i]:
			return a[i]

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

def ch(s):
	a = ['a', 'b', 'c']
	j = [char for char in s]
	if len(s) == 1 and s[0] == '?':
		return 'a'
	elif len(s) == 1:
		return s
	tr = truth(s)
	if tr:
		if len(s) == 2:
			if j[0] == '?' and j[1] == '?':
				j[0] = 'b'
				j[1] = ch1(s[0])
				return j
			elif j[0] == '?' and j[1].isalpha():
				j[0] = ch1(s[1])
				return j
			elif s[1] == '?':
				j[1] = ch1(s[0])
				return j
		for i in range(len(j) - 1):
			if j[i] == '?' and j == 0 and (len(j) >= i + 1):
				if j[i + 1].isalpha():
					j[i] = ch1(j[i + 1])
				else:
					j[i + 1] = s[random.randint(0, 2)]
			elif j[i] == '?' and j != 0 and (len(j) >= i + 1):
				if j[i + 1].isalpha():
					j[i] = ch2(j[i - 1], j[i + 1])
				else:
					j[i] = ch1(j[i - 1])
		if j[-1] == '?':
			j[-1] = ch1(j[-2])
		return j
	else:
		return -1
size = eval(input())
c = []
for i in range(size):
	b = input()
	c.append(b)
for i in range(size):
	a = ch(c[i])
	if a == -1:
		print(-1)
	else:
		print(''.join(a))


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


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


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


t = int(input())
while t > 0:
	s = list(input())
	if len(s) == 1:
		if s[0] == '?':
			print('a')
		else:
			print(''.join(s))
		t -= 1
		continue
	f = 0
	for i in range(1, len(s)):
		if s[i] == s[i - 1] and s[i] != '?':
			print('-1')
			f = 1
			t -= 1
			break
	if f:
		continue
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			p1 = set(['a', 'b', 'c'])
			p2 = set([s[i - 1], s[i + 1]])
			val = list(p1 - p2)[0]
			s[i] = val
	if s[0] == '?':
		p1 = set(['a', 'b', 'c'])
		p2 = set([s[1]])
		s[0] = list(p1 - p2)[0]
	if s[-1] == '?':
		p1 = set(['a', 'b', 'c'])
		p2 = set([s[-2]])
		s[-1] = list(p1 - p2)[0]
	print(''.join(s))
	t -= 1


t = int(input())
while t:
	k = input()
	l = '(' + k + '('
	s = list(l)
	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'
			else:
				s[i] = 'c'
	p = 0
	j_pre = 'l'
	for j in s:
		if j_pre == j:
			p = -1
		j_pre = j
	if p == -1:
		print(p)
	else:
		for n in s[1:len(s) - 1]:
			print(n, end='')
		print('\n')
	t -= 1


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


def answer():
	s = list(input())
	len_s = len(s)
	if len_s == 1:
		if s[0] == '?':
			return 'a'
		else:
			return s[0]
	if s[0] == '?':
		if s[1] == 'a':
			s[0] = 'b'
		else:
			s[0] = 'a'
	if s[-1] == '?':
		if s[-2] == 'a':
			s[-1] = 'b'
		else:
			s[-1] = 'a'
	if s[0] == s[1] or s[-2] == s[-1]:
		return -1
	for i in range(1, len_s - 1):
		(c1, c2, c3) = (s[i - 1], s[i], s[i + 1])
		if c2 == c3 and c2 != '?':
			return -1
		if c2 == '?':
			if c1 == c3 or c3 == '?':
				if c1 == 'a':
					s[i] = 'b'
				else:
					s[i] = 'a'
			else:
				tmp = ['a', 'b', 'c']
				tmp.remove(c1)
				tmp.remove(c3)
				s[i] = tmp[0]
	return ''.join(s)
n = int(input())
for i in range(n):
	out = answer()
	print(out)


t = int(input())
for _ in range(t):
	s = list(input())
	n = len(s)
	flag = 0
	if n == 1:
		if s[0] == '?':
			print('a')
	else:
		for i in range(n):
			if s[i] != '?':
				if i == 0:
					if s[i] == s[1]:
						flag = 1
						break
				elif i != n - 1 and (s[i] == s[i - 1] or s[i] == s[i + 1]):
					flag = 1
					break
			elif i == 0:
				if s[1] == '?':
					s[i] = 'a'
				elif s[i + 1] == 'a':
					s[i] = 'b'
				elif s[i + 1] == 'b':
					s[i] = 'c'
				else:
					s[i] = 'a'
			elif i != n - 1:
				if s[i + 1] != '?':
					if s[i - 1] == s[i + 1]:
						if s[i - 1] == 'a':
							s[i] = 'c'
						elif s[i - 1] == 'b':
							s[i] = 'c'
						else:
							s[i] = 'a'
					elif s[i - 1] != s[i + 1]:
						s[i] = chr(294 - (ord(s[i - 1]) + ord(s[i + 1])))
				elif s[i - 1] == 'a':
					s[i] = 'b'
				elif s[i - 1] == 'b':
					s[i] = 'a'
				else:
					s[i] = 'b'
			elif s[i] == '?':
				if s[i - 1] == 'a':
					s[i] = 'b'
				elif s[i - 1] == 'b':
					s[i] = 'a'
				else:
					s[i] = 'a'
		if not flag:
			print(''.join(s))
		else:
			print('-1')


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


from itertools import groupby
for k in range(int(input())):
	n = input()
	a = ['a']
	for j in n:
		a.append(j)
	a.append('a')
	for i in range(1, len(a)):
		if a[i] == '?' and a[i - 1] == '?' and (a[i + 1] == '?'):
			a[i] = 'a'
		if a[i] == '?' and a[i - 1] == 'a' and (a[i + 1] == 'a'):
			a[i] = 'c'
		if a[i] == '?' and a[i - 1] == 'a' and (a[i + 1] == 'b'):
			a[i] = 'c'
		if a[i] == '?' and a[i - 1] == 'a' and (a[i + 1] == 'c'):
			a[i] = 'b'
		if a[i] == '?' and a[i - 1] == 'b' and (a[i + 1] == 'c'):
			a[i] = 'a'
		if a[i] == '?' and a[i - 1] == 'b' and (a[i + 1] == 'a'):
			a[i] = 'c'
		if a[i] == '?' and a[i - 1] == 'b' and (a[i + 1] == 'b'):
			a[i] = 'a'
		if a[i] == '?' and a[i - 1] == 'c' and (a[i + 1] == 'a'):
			a[i] = 'b'
		if a[i] == '?' and a[i - 1] == 'c' and (a[i + 1] == 'b'):
			a[i] = 'a'
		if a[i] == '?' and a[i - 1] == 'c' and (a[i + 1] == 'c'):
			a[i] = 'a'
		if a[i] == '?' and a[i - 1] == 'a' and (a[i + 1] == '?'):
			a[i] = 'b'
		if a[i] == '?' and a[i - 1] == 'b' and (a[i + 1] == '?'):
			a[i] = 'c'
		if a[i] == '?' and a[i - 1] == 'c' and (a[i + 1] == '?'):
			a[i] = 'a'
		if a[i] == '?' and a[i - 1] == '?' and (a[i + 1] == 'a'):
			a[i] = 'b'
		if a[i] == '?' and a[i - 1] == '?' and (a[i + 1] == 'b'):
			a[i] = 'a'
		if a[i] == '?' and a[i - 1] == '?' and (a[i + 1] == 'c'):
			a[i] = 'a'
	pp = a[1:-1]
	final_str = ''.join([str(i) for i in pp])
	if 'aa' in final_str or 'bb' in final_str or 'cc' in final_str:
		print(-1)
	else:
		print(final_str)


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


import sys

def main():
	for tc in range(int(input())):
		s = list(input())
		for i in range(len(s)):
			if s[i] == '?':
				if i > 0 and i < len(s) - 1:
					if (s[i - 1] == 'a' or s[i - 1] == 'b') and (s[i + 1] == 'a' or s[i + 1] == 'b'):
						s[i] = 'c'
					elif (s[i - 1] == 'a' or s[i - 1] == 'c') and (s[i + 1] == 'a' or s[i + 1] == 'c'):
						s[i] = 'b'
					elif (s[i - 1] == 'c' or s[i - 1] == 'b') and (s[i + 1] == 'c' or s[i + 1] == 'b'):
						s[i] = 'a'
					elif s[i - 1] == 'a':
						s[i] = 'b'
					elif s[i - 1] == 'b':
						s[i] = 'c'
					elif s[i - 1] == 'c':
						s[i] = 'a'
				elif i == 0 and i < len(s) - 1:
					if s[i + 1] == 'a':
						s[i] = 'b'
					elif s[i + 1] == 'b':
						s[i] = 'c'
					elif s[i + 1] == 'c':
						s[i] = 'a'
					else:
						s[i] = 'a'
			if i + 1 < len(s):
				if s[i] == s[i + 1]:
					s = '-1'
					break
		if s[-1] == '?':
			if len(s) == 1:
				s[-1] = 'a'
			elif s[-2] == 'a':
				s[-1] = 'b'
			elif s[-2] == 'b':
				s[-1] = 'c'
			elif s[-2] == 'c':
				s[-1] = 'a'
		print(*s, sep='')
get_array = lambda : list(map(int, sys.stdin.readline().split()))
get_ints = lambda : map(int, sys.stdin.readline().split())
input = lambda : sys.stdin.readline().strip()
main()


import sys
import collections
import heapq
import math
input = sys.stdin.readline

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

def rstr():
	return input().strip()

def rint():
	return int(input().strip())

def rintas():
	return [int(i) for i in input().strip().split()]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = rint()
for _ in range(t):
	s = [i for i in rstr()]
	n = len(s)
	for i in range(len(s)):
		if s[i] != '?':
			continue
		if i == 0 and i + 1 < n:
			if s[i + 1] == 'a':
				s[i] = 'b'
			elif s[i + 1] == 'b':
				s[i] = 'c'
			else:
				s[i] = 'a'
		elif i == 0:
			s[i] = 'a'
		elif i == n - 1:
			if s[i - 1] == 'a':
				s[i] = 'b'
			elif s[i - 1] == 'b':
				s[i] = 'c'
			else:
				s[i] = 'a'
		elif i - 1 >= 0 and i + 1 < n:
			if s[i + 1] == '?' and s[i - 1] == 'a':
				s[i] = 'b'
			elif s[i + 1] == '?' and s[i - 1] == 'b':
				s[i] = 'c'
			elif s[i + 1] == '?' and s[i - 1] == 'c':
				s[i] = 'a'
			elif s[i - 1] == s[i + 1] == 'a':
				s[i] = 'b'
			elif s[i - 1] == s[i + 1] == 'b':
				s[i] = 'c'
			elif s[i - 1] == s[i + 1] == 'c':
				s[i] = 'a'
			else:
				a = {'a', 'b', 'c'}
				b = {s[i - 1], s[i + 1]}
				s[i] = list(a.difference(b))[0]
	status = True
	for (i, v) in enumerate(s):
		if i > 0 and s[i] == s[i - 1]:
			status = False
			break
	if status:
		print(''.join(s))
	else:
		print(-1)


for _ in range(int(input())):
	p = list(input())
	re = ['a', 'b', 'c']
	same = 0
	if len(p) == 1:
		print('a')
	else:
		for i in range(len(p)):
			if p[i] == '?':
				if i == 0 and p[1] == '?':
					p[i] = 'a'
				elif i == 0 and p[1] != '?':
					x = re.index(p[i + 1])
					if x == 2:
						x = 0
					else:
						x = x + 1
					p[i] = re[x]
				elif i == len(p) - 1:
					x = re.index(p[i - 1])
					if x == 2:
						x = 0
					else:
						x = x + 1
					p[i] = re[x]
				elif p[i + 1] == '?':
					x = re.index(p[i - 1])
					if x == 2:
						x = 0
					else:
						x = x + 1
					p[i] = re[x]
				elif p[i + 1] != '?':
					x = re.index(p[i - 1])
					y = re.index(p[i + 1])
					if 0 != x and 0 != y:
						x1 = 0
					elif 1 != x and 1 != y:
						x1 = 1
					elif 2 != x and 2 != y:
						x1 = 2
					p[i] = re[x1]
			elif i != 0:
				if p[i] == p[i - 1]:
					same = 1
					break
		if same == 1:
			print(-1)
		else:
			print(''.join(p))


def solve():
	f = input()
	a = []
	for i in f:
		a += [i]
	z = len(a)
	s = set()
	for i in range(1, 4):
		s = s.union(chr(96 + i))
	a = ['.'] + a + ['.']
	for j in range(1, z + 1):
		if a[j] == a[j - 1]:
			return -1
		elif a[j] == '?':
			a[j] = list(s.difference({a[j - 1], a[j + 1]}))[0]
	p = ''
	for i in a:
		if i != '.':
			p += i
	return p
n = int(input())
for i in range(n):
	print(solve())


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


def dryrun(s):
	for i in range(1, len(s)):
		if s[i] != '?':
			if s[i - 1] == s[i]:
				return 0
	return 1

def replaceq(l, r):
	re = ''
	if l == 0 and r == 0:
		re += 'a'
	elif l != 0 and r != 0:
		if l == r == 'a':
			re += 'b'
		elif l == r == 'b':
			re += 'c'
		elif l == r == 'c':
			re += 'a'
		elif l == 'c' and r == 'b' or (l == 'b' and r == 'c'):
			re += 'a'
		elif l == 'a' and r == 'b' or (l == 'b' and r == 'a'):
			re += 'c'
		elif l == 'a' and r == 'c' or (l == 'c' and r == 'a'):
			re += 'b'
	elif l == 0:
		if r == 'a':
			re += 'b'
		elif r == 'b':
			re += 'c'
		elif r == 'c':
			re += 'a'
	elif r == 0:
		if l == 'a':
			re += 'b'
		elif l == 'b':
			re += 'c'
		elif l == 'c':
			re += 'a'
	return re
t = int(input())
for _ in range(t):
	s = input()
	ns = []
	if dryrun(s):
		for i in range(len(s)):
			if s[i] == '?':
				l = 0 if i == 0 else ns[i - 1]
				r = 0 if i == len(s) - 1 or s[i + 1] == '?' else s[i + 1]
				ns.append(replaceq(l, r))
			else:
				ns.append(s[i])
		print(''.join(ns))
	else:
		print(-1)


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


def getChar(x, y):
	opts = ['a', 'b', 'c']
	if x in opts:
		opts.remove(x)
	if y in opts:
		opts.remove(y)
	return opts[0]

def findBS(s):
	length = len(s)
	opts = ['a', 'b', 'c']
	if length == 1:
		if '?' in s:
			print('a')
		else:
			print(s)
		return
	for i in range(len(opts)):
		if s[0] == '?' and s[1] != opts[i]:
			s[0] = opts[i]
		if s[length - 1] == '?' and s[length - 2] != opts[i]:
			s[length - 1] = opts[i]
	for i in range(1, length - 1):
		if s[i] == '?':
			s[i] = getChar(s[i - 1], s[i + 1])
		if s[i] == s[i - 1] or s[i] == s[i + 1]:
			print('-1')
			return
	if '?' in opts:
		print(-1)
	print(''.join(s))
t = int(input())
for _ in range(t):
	s = list(input().rstrip())
	findBS(s)


def func(s):
	questionMark = '?'
	a = 'a'
	b = 'b'
	if len(s) == 1:
		if s[0] == questionMark:
			return 'a'
		else:
			return s
	previous = None
	for x in range(len(s)):
		allowedLetter = ['a', 'b', 'c']
		current = s[x]
		if x + 1 < len(s):
			next = s[x + 1]
		else:
			next = None
		if current != questionMark and next != questionMark and (current == next):
			return -1
		elif current == questionMark:
			if previous:
				allowedLetter.remove(previous)
			if next and next != questionMark and (x + 1 < len(s)) and (next != previous):
				allowedLetter.remove(next)
			s[x] = allowedLetter[0]
		previous = s[x]
	return ''.join(s)
for i in range(int(input())):
	s = list(input())
	print(func(s))


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


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


t = int(input())
for _ in range(t):
	ok = True
	s = list(input())
	for i in range(1, len(s)):
		if s[i] == s[i - 1] and s[i] != '?':
			ok = False
	s = ['$'] + s + ['$']
	for i in range(1, len(s)):
		if s[i] == '?':
			for x in 'abc':
				if s[i - 1] != x and s[i + 1] != x:
					s[i] = x
	if ok == False:
		print('-1')
	else:
		print(''.join(s[1:len(s) - 1]))


for _ in range(int(input())):
	x = input()
	if 'aa' in x or 'bb' in x or 'cc' in x:
		print(-1)
		continue
	li = list(x)
	l = len(li)
	for i in range(l):
		if li[i] == '?':
			prev = 'd' if i == 0 else li[i - 1]
			nxt = 'e' if i + 1 >= l else li[i + 1]
			for j in ['a', 'b', 'c']:
				if prev != j and nxt != j:
					li[i] = j
	print(''.join(li))


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)


t = int(input())
while t > 0:
	t = t - 1
	s = input()
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print('-1')
	else:
		s = list(s)
		s.append(0)
		s.insert(0, 0)
		a = ['a', 'b', 'c']
		for i in range(len(s)):
			if s[i] == '?':
				for j in a:
					if j != s[i - 1] and j != s[i + 1]:
						s[i] = j
		s.pop(0)
		s.pop(-1)
		for i in s:
			print(i, end='')
		print()


from math import gcd, ceil
from collections import defaultdict as dd

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

def inin():
	return int(input())

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

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su

def pred(n, k, pointer):
	return pointer - k >= n

def yes():
	print('YES')

def no():
	print('NO')
Testcase = inin()
for n in range(Testcase):
	s = 'f' + input() + 'f'
	s = list(s)
	for i in range(1, len(s) - 1):
		f = s[i]
		if f == 'a' or f == 'b' or f == 'c':
			s[i] = f
		else:
			d = set()
			d.add(s[i - 1])
			d.add(s[i + 1])
			ds = {'a', 'b', 'c'}
			for j in ds.difference(d):
				s[i] = j
				break
	ans = True
	for i in range(0, len(s) - 1):
		if s[i] == s[i + 1]:
			ans = False
			break
	if ans:
		print(''.join(s[1:-1]))
	else:
		print(-1)


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


test = int(input())
for _ in range(test):
	s = ['r'] + [i for i in input()] + ['r']
	ans = True
	for i in range(1, len(s) - 1):
		if s[i] != '?' and s[i] == s[i + 1]:
			ans = False
			print(-1)
			break
	if ans:
		if s[1] == '?':
			if s[2] == 'a':
				s[1] = 'b'
			elif s[2] == 'b':
				s[1] = 'a'
			else:
				s[1] = 'b'
		for lit in range(1, len(s) - 1):
			if s[lit] == '?' and s[lit + 1] != '?':
				if s[lit - 1] == 'c' and s[lit + 1] == 'b' or (s[lit - 1] == 'b' and s[lit + 1] == 'c'):
					s[lit] = 'a'
				elif s[lit - 1] == 'c' and s[lit + 1] == 'a' or (s[lit - 1] == 'a' and s[lit + 1] == 'c'):
					s[lit] = 'b'
				elif s[lit - 1] == 'a' and s[lit + 1] == 'b' or (s[lit - 1] == 'b' and s[lit + 1] == 'a'):
					s[lit] = 'c'
			if s[lit] == '?':
				if s[lit - 1] == 'a':
					s[lit] = 'b'
				elif s[lit - 1] == 'b':
					s[lit] = 'c'
				elif s[lit - 1] == 'c':
					s[lit] = 'a'
		print(''.join(s[1:-1]))


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)


t = int(input())
for w in range(t):
	s = list(str(input()))
	n = len(s)
	bol = True
	if len(s) == 1 and s[0] == '?':
		print('a')
		continue
	if len(s) == 2:
		if s[0] == s[1] and s[0] != '?':
			print(-1)
			continue
	for i in range(1, n - 1):
		if (s[i - 1] == s[i] or s[i] == s[i + 1]) and (s[i] == 'a' or s[i] == 'b' or s[i] == 'c'):
			bol = False
			break
	if not bol:
		print(-1)
		continue
	if s[0] == '?':
		if s[1] == 'a':
			s[0] = 'b'
		elif s[1] == 'b':
			s[0] = 'c'
		else:
			s[0] = 'a'
	for i in range(1, n - 1):
		if s[i] == '?':
			if s[i - 1] == 'a' and (s[i + 1] == 'a' or s[i + 1] == 'c' or s[i + 1] == '?'):
				s[i] = 'b'
			elif s[i - 1] == 'a' and s[i + 1] == 'b':
				s[i] = 'c'
			elif s[i - 1] == 'b' and (s[i + 1] == 'b' or s[i + 1] == 'a' or s[i + 1] == '?'):
				s[i] = 'c'
			elif s[i - 1] == 'b' and s[i + 1] == 'c':
				s[i] = 'a'
			elif s[i - 1] == 'c' and (s[i + 1] == 'c' or s[i + 1] == 'a' or s[i + 1] == '?'):
				s[i] = 'b'
			elif s[i - 1] == 'c' and s[i + 1] == 'b':
				s[i] = 'a'
	if s[n - 1] == '?':
		if s[n - 2] == 'a':
			s[n - 1] = 'b'
		elif s[n - 2] == 'b':
			s[n - 1] = 'c'
		else:
			s[n - 1] = 'a'
	for i in range(n):
		print(s[i], end='')
	print()


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)


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

def is_impossible(s):
	n = len(s)
	for i in range(1, n):
		if s[i] != '?' and s[i] == s[i - 1]:
			return True
	return False
t = int(input())
for i in range(t):
	s = input()
	if is_impossible(s):
		print(-1)
		continue
	n = len(s)
	if n == 1:
		if s == '?':
			print('a')
		else:
			print(s)
		continue
	ans = ''
	for i in range(n):
		if s[i] != '?':
			ans += s[i]
			continue
		if i == 0:
			if s[i + 1] == 'a':
				ans += 'b'
			else:
				ans += 'a'
			continue
		if i == n - 1:
			if ans[-1] == 'a':
				ans += 'b'
			else:
				ans += 'a'
			continue
		if s[i] != '?':
			ans += s[i]
			continue
		if ans[-1] != 'a' and s[i + 1] != 'a':
			ans += 'a'
			continue
		if ans[-1] != 'b' and s[i + 1] != 'b':
			ans += 'b'
			continue
		ans += 'c'
	print(ans)


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)


from math import floor, ceil
t = int(input())
for _ in range(t):
	a = list(input())
	n = len(a)
	flag = 1
	for i in range(n):
		if a[i] == '?':
			p = a[i - 1] if i > 0 else 'z'
			q = a[i + 1] if i < n - 1 else 'z'
			r = set(['a', 'b', 'c']).difference(set([p])).difference(set([q])).pop()
			a[i] = r
		elif i > 0 and a[i - 1] == a[i] or (i < n - 1 and a[i + 1] == a[i]):
			flag = -1
		if flag == -1:
			break
	if flag == -1:
		print(-1)
	else:
		print(''.join(a))


n = int(input())
base = 'abc'
for _ in range(n):
	string = list(str(input()))
	ok = True
	for i in range(1, len(string)):
		if string[i] == string[i - 1] and string[i] != '?':
			ok = False
			break
	if ok:
		for i in range(len(string)):
			if string[i] == '?':
				if i - 1 >= 0 and i + 1 < len(string):
					if string[i - 1] == '?' and string[i + 1] == '?':
						string[i] = base[0]
					elif string[i - 1] == '?':
						for el in base:
							if el != string[i + 1]:
								string[i] = el
					elif string[i + 1] == '?':
						for el in base:
							if el != string[i - 1]:
								string[i] = el
					else:
						for el in base:
							if el != string[i - 1] and el != string[i + 1]:
								string[i] = el
				elif i == len(string) - 1:
					for el in base:
						if el != string[i - 1] or string[i - 1] == '?':
							string[i] = el
				elif i == 0:
					for el in base:
						if el != string[i + 1] or string[i + 1] == '?':
							string[i] = el
	if ok:
		print(''.join(string))
	else:
		print(-1)


def program():
	str = [char for char in input()]
	l = ['a', 'b', 'c']
	n = len(str)
	for i in range(n - 1):
		if str[i] == str[i + 1] and str[i] != '?':
			print('-1')
			return 0
	for i in range(n):
		if str[i] == '?':
			if i == 0:
				prev = '0'
			else:
				prev = str[i - 1]
			if i == n - 1:
				nex = '0'
			else:
				nex = str[i + 1]
			for x in l:
				if x != prev and x != nex:
					str[i] = x
	for x in str:
		print(x, end='')
	print()
t = int(input())
for i in range(t):
	program()


a = int(input())
for i in range(a):
	b = input()
	p = []
	o = 0
	k = len(b)
	for i in range(k - 1):
		if b[i] == b[i + 1] and b[i] != '?':
			o = 1
			break
	if o == 1:
		print(-1)
	else:
		p = ''
		b = 'd' + b + 'd'
		for i in range(1, k + 1):
			if b[i] != '?':
				p += b[i]
			elif b[i] == '?' and b[i + 1] == '?':
				if p == '':
					p += 'a'
				elif p[-1] == 'a':
					p += 'b'
				elif p[-1] == 'b':
					p += 'c'
				else:
					p += 'a'
			else:
				g = ['a', 'b', 'c']
				if p != '':
					try:
						del g[g.index(p[-1])]
					except:
						pass
				if b[i + 1] != 'd':
					try:
						del g[g.index(b[i + 1])]
					except:
						pass
				p += g[0]
		print(p)


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


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


T = int(input())
for t in range(T):
	lst = list(input())
	temp = ['a', 'b', 'c']
	flag = 0
	if len(lst) == 1 and lst[0] == '?':
		print(temp[0])
		continue
	for i in range(len(lst) - 1):
		if lst[i] == lst[i + 1] and lst[i] != '?':
			print(-1)
			flag = 1
			break
		elif lst[i] == '?':
			if lst[i + 1] == '?':
				try:
					for j in temp:
						if j != lst[i - 1]:
							lst[i] = j
							break
				except:
					lst[i] = temp[0]
			else:
				try:
					for j in temp:
						if lst[i - 1] != j and lst[i + 1] != j:
							lst[i] = j
							break
				except:
					for j in temp:
						if lst[i + 1] != j:
							lst[i] = j
							break
	if flag == 0:
		if lst[-1] == '?':
			for j in temp:
				if j != lst[-2]:
					lst[-1] = j
					break
		print(''.join(lst))


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


def solution(a, b):
	s = ['a', 'b', 'c']
	s = set(s)
	t = [a, b]
	s1 = s - set(t)
	s1 = list(s1)
	return s1[0]

def checkString(s):
	if len(s) == 1:
		return 'a'
	for i in range(len(s)):
		if s[i] == '?':
			if i == 0:
				if s[i + 1] == '?':
					s[i] = 'a'
				else:
					s[i] = solution(s[i + 1], 'a')
			elif i == len(s) - 1:
				s[i] = solution(s[i - 1], 'a')
			elif s[i + 1] == '?':
				s[i] = solution(s[i - 1], 'a')
			else:
				s[i] = solution(s[i - 1], s[i + 1])
		elif i + 1 != len(s) and s[i] == s[i + 1]:
			return -1
	return s
for _ in range(int(input())):
	s = input()
	st = checkString(list(s))
	if st == -1:
		print(-1)
	else:
		print(''.join(st))


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)


t = int(input())
for i in range(t):
	inputstr = input()
	arr = []
	for i in inputstr:
		arr.append(str(i))
	n = len(arr)
	if arr[0] == '?' and len(arr) != 1:
		if arr[1] == 'a':
			arr[0] = 'b'
		elif arr[1] == 'b':
			arr[0] = 'a'
		else:
			arr[0] = 'b'
	elif arr[0] == '?' and len(arr) == 1:
		arr[0] = 'a'
	for i in range(1, len(inputstr) - 1):
		if arr[i] == '?':
			if arr[i - 1] == 'a' and arr[i + 1] == 'a':
				arr[i] = 'b'
			elif arr[i - 1] == 'a' and arr[i + 1] == 'b':
				arr[i] = 'c'
			elif arr[i - 1] == 'a' and arr[i + 1] == 'c':
				arr[i] = 'b'
			elif arr[i - 1] == 'b' and arr[i + 1] == 'b':
				arr[i] = 'c'
			elif arr[i - 1] == 'b' and arr[i + 1] == 'a':
				arr[i] = 'c'
			elif arr[i - 1] == 'b' and arr[i + 1] == 'c':
				arr[i] = 'a'
			elif arr[i - 1] == 'c' and arr[i + 1] == 'b':
				arr[i] = 'a'
			elif arr[i - 1] == 'c' and arr[i + 1] == 'a':
				arr[i] = 'b'
			elif arr[i - 1] == 'c' and arr[i + 1] == 'c':
				arr[i] = 'a'
			elif arr[i - 1] == 'a' and arr[i + 1] == '?':
				arr[i] = 'c'
			elif arr[i - 1] == 'b' and arr[i + 1] == '?':
				arr[i] = 'a'
			elif arr[i - 1] == 'c' and arr[i + 1] == '?':
				arr[i] = 'b'
	if arr[n - 1] == '?':
		if arr[n - 2] == 'a':
			arr[n - 1] = 'b'
		elif arr[n - 2] == 'b':
			arr[n - 1] = 'a'
		else:
			arr[n - 1] = 'b'
	outputstr = ''.join(arr)
	flag = 0
	for i in range(n - 1):
		if arr[i] == arr[i + 1]:
			flag = 1
			break
	if flag == 1:
		print(-1)
	else:
		print(outputstr)


import sys
input = lambda : sys.stdin.readline().rstrip()
mas = ['a', 'b', 'c']

def proverka(s3):
	for i in range(len(s3) - 1):
		if s3[i] == s3[i + 1] and s3[i] != '?':
			return False
	else:
		return True

def main():
	mas = ['a', 'b', 'c']
	for ___ in range(int(input())):
		s = input()
		if 'a' in s or 'b' in s or 'c' in s:
			if len(s) != 1:
				if proverka(s) == False:
					print('-1', end='')
				else:
					k = len(s)
					last = ''
					for i in range(k):
						if s[i] == '?':
							if i == 0:
								for j in mas:
									if j != s[i + 1]:
										last = j
										print(j, end='')
										break
							elif i == k - 1:
								for j in mas:
									if j != last:
										last = j
										print(j, end='')
										break
							else:
								for j in mas:
									if j != last and j != s[i + 1]:
										last = j
										print(j, end='')
										break
						else:
							last = s[i]
							print(s[i], end='')
				print()
			else:
				print('a')
		else:
			print('ab' * (len(s) // 2) + 'c' * (len(s) % 2))
main()


def solve(s):
	for i in range(1, len(s)):
		if s[i] == s[i - 1] and s[i] != '?':
			return ['-1']
	ans = [None] * len(s)
	for i in range(len(s)):
		if s[i] == '?':
			if i == 0 and (len(s) == 1 or s[i + 1] == '?'):
				ans[i] = 'a'
			elif i == len(s) - 1 or s[i + 1] == '?':
				ans[i] = chr((ord(ans[i - 1]) - 97 + 1) % 3 + 97)
			elif i == 0:
				ans[i] = chr((ord(s[i + 1]) - 97 + 1) % 3 + 97)
			elif ans[i - 1] == s[i + 1]:
				ans[i] = chr((ord(ans[i - 1]) - 97 + 1) % 3 + 97)
			else:
				ans[i] = chr(3 - ord(ans[i - 1]) - ord(s[i + 1]) + 97 * 3)
		else:
			ans[i] = s[i]
	return ans
for i in range(int(input())):
	print(''.join(solve(input())))


for __ in range(int(input())):
	s = input()
	a = [0, *s, 0]
	if any((x * 2 in s for x in 'abc')):
		print(-1)
		continue
	for i in range(len(a)):
		if a[i] == '?':
			a[i] = (set('abc') - {a[i - 1], a[i + 1]}).pop()
	print(''.join(a[1:-1]))


t = int(input())
for i in range(t):
	s = input()
	n = len(s)
	flag = 0
	for j in range(n - 1):
		if s[j] != '?' and s[j + 1] != '?' and (s[j] == s[j + 1]):
			print(-1)
			flag = 1
			break
	if flag:
		continue
	mas = []
	for j in range(n):
		if s[j] != '?':
			mas.append(ord(s[j]) - ord('a') + 1)
		else:
			mas.append(0)
	mas = [1] + mas + [1]
	l = -1
	for j in range(1, n + 2):
		if mas[j] == 0:
			if l == -1:
				l = j
		elif l != -1:
			r = j - 1
			if l == r:
				if 1 != mas[l - 1] and 1 != mas[r + 1]:
					mas[l] = 1
				elif 2 != mas[l - 1] and 2 != mas[r + 1]:
					mas[l] = 2
				else:
					mas[l] = 3
			elif r - l == 1:
				if mas[l - 1] == mas[r + 1]:
					if mas[l - 1] == 1:
						x = 2
						y = 3
					elif mas[l - 1] == 2:
						x = 1
						y = 3
					else:
						x = 1
						y = 2
					mas[l] = x
					mas[r] = y
				else:
					mas[l] = mas[r + 1]
					mas[r] = mas[l - 1]
			elif mas[l - 1] == mas[r + 1]:
				if mas[l - 1] == 1:
					x = 2
					y = 3
				elif mas[l - 1] == 2:
					x = 1
					y = 3
				else:
					x = 1
					y = 2
				for k in range(l, r + 1):
					if k % 2 == 0:
						mas[k] = x
					else:
						mas[k] = y
			else:
				if 1 != mas[l - 1] and 1 != mas[r + 1]:
					x = 1
				elif 2 != mas[l - 1] and 2 != mas[r + 1]:
					x = 2
				else:
					x = 3
				mas[l] = x
				mas[r] = x
				for k in range(l + 1, r):
					if k % 2 == 0:
						mas[k] = mas[l - 1]
					else:
						mas[k] = mas[r + 1]
			l = -1
	for j in range(1, n + 1):
		print(chr(mas[j] - 1 + ord('a')), end='')
	print()


for _ in range(int(input())):
	s = input()
	s = list(s)
	l = len(s)
	k = 2
	for i in range(l):
		pre = 'd' if i == 0 else s[i - 1]
		nxt = 'e' if i == l - 1 else s[i + 1]
		if s[i] != '?':
			if s[i] == pre or s[i] == nxt:
				print(-1)
				k = 1
				break
		else:
			x = {'a', 'b', 'c'} - {pre, nxt}
			s[i] = x.pop()
	if k == 2:
		print(''.join((str(x) for x in s)))


def set_sym(prev_sym=None, next_sym=None):
	alph = ['a', 'b', 'c']
	if next_sym == None or prev_sym == next_sym:
		if prev_sym == 'a':
			return 'b'
		elif prev_sym == 'b':
			return 'c'
		else:
			return 'a'
	elif prev_sym == None:
		if next_sym == 'a':
			return 'b'
		elif next_sym == 'b':
			return 'c'
		else:
			return 'a'
	else:
		alph.pop(alph.index(prev_sym))
		alph.pop(alph.index(next_sym))
		return alph[0]
n = int(input())
for i in range(n):
	s = input()
	s = list(s)
	for j in range(len(s)):
		try:
			if s[j] == s[j + 1] and s[j] != '?':
				print(-1)
				break
		except IndexError:
			pass
		if s[j] == '?':
			try:
				if s[j + 1] != '?':
					if j != 0:
						s[j] = set_sym(s[j - 1], s[j + 1])
					else:
						s[j] = set_sym(next_sym=s[j + 1])
				else:
					s[j] = set_sym(s[j - 1])
			except IndexError:
				s[j] = set_sym(s[j - 1])
	else:
		print(''.join(s))


for i in range(int(input())):
	s = list(input())
	l = len(s)
	f = 0
	for j in range(l):
		st = ['a', 'b', 'c']
		if s[j] == '?':
			if j != 0:
				st.remove(s[j - 1])
			if j + 1 != l and s[j + 1] != '?':
				try:
					st.remove(s[j + 1])
				except:
					pass
			s[j] = st[0]
		elif j + 1 != l:
			if s[j] == s[j + 1]:
				print(-1)
				f = 1
				break
	if f == 0:
		print(''.join(s))


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


D = {}
D['aa'] = 'bca'
D['ab'] = 'cab'
D['ac'] = 'bac'
D['ba'] = 'cba'
D['bb'] = 'acb'
D['bc'] = 'abc'
D['ca'] = 'bca'
D['cb'] = 'acb'
D['cc'] = 'abc'
t = int(input())
for _ in range(t):
	s = list(input())
	A = []
	flag = False
	for i in range(0, len(s) - 1):
		if s[i] != '?' and s[i] == s[i + 1]:
			flag = True
			break
	for i in range(len(s)):
		if flag:
			break
		if s[i] == '?' and (i == 0 or i == len(s) - 1):
			A.append([i, '?'])
		if i != 0 and s[i] == '?' and (s[i - 1] != '?'):
			A.append([i, s[i - 1]])
		if i != len(s) - 1 and s[i] == '?' and (s[i + 1] != '?'):
			A.append([i, s[i + 1]])
	if len(A) == 1:
		s[0] = 'a'
	else:
		for i in range(0, len(A), 2):
			(ini, l1) = A[i]
			(fin, l2) = A[i + 1]
			if l1 == '?':
				l1 = l2
			if l2 == '?':
				l2 = l1
			if l1 == l2 == '?':
				l1 = l2 = 'a'
			letras = D[l1 + l2]
			if fin - ini == 1:
				s[ini] = letras[0]
				s[fin] = letras[1]
			else:
				s[ini] = letras[0]
				s[fin] = letras[0]
				for i in range(ini + 1, fin):
					s[i] = letras[1 + i % 2]
	if flag:
		print(-1)
	else:
		print(''.join(s))


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


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


for _ in range(int(input())):
	s = list(input())
	f = 0
	a = s
	for i in range(len(s) - 1):
		if a[i] == a[i + 1] and a[i] != '?':
			f = 1
			break
	if f == 1:
		print('-1')
		continue
	n = len(s)
	if n == 1:
		print('a')
		continue
	d = {'a', 'b', 'c'}
	for i in range(n):
		if a[i] == '?':
			p = set()
			if i == 0:
				if a[i + 1] != '?':
					p.add(a[i + 1])
			elif i == n - 1:
				if a[i - 1] != '?':
					p.add(a[i - 1])
			else:
				if a[i - 1] != '?':
					p.add(a[i - 1])
				if a[i + 1] != '?':
					p.add(a[i + 1])
			q = d - p
			q = list(q)
			a[i] = q[0]
	print(''.join(a))


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)):
			prv = 'd' if j == 0 else s[j - 1]
			nxt = 'd' if j == len(s) - 1 else s[j + 1]
			if s[j] == '?':
				for c in al:
					if prv != c and c != nxt:
						s[j] = c
			if prv == s[j]:
				u = False
		print(''.join(s) if u else -1)
solve()


n = int(input())
for _ in range(n):
	p = {'a', 'b', 'c'}
	s = list(input())
	if len(s) == 1 and s[0] == '?':
		print('a')
		continue
	for i in range(len(s)):
		if i >= 1:
			if s[i] == s[i - 1] and s[i] != '?':
				print(-1)
				break
		if s[i] == '?':
			if i == 0 and s[i + 1] == 'a':
				s[i] = 'b'
			elif i == 0 and s[i + 1] == 'b':
				s[i] = 'c'
			elif i == 0 and s[i + 1] == 'c':
				s[i] = 'a'
			if i == len(s) - 1 and s[i - 1] == 'a':
				s[i] = 'b'
			elif i == len(s) - 1 and s[i - 1] == 'b':
				s[i] = 'c'
			elif i == len(s) - 1 and s[i - 1] == 'c':
				s[i] = 'a'
			else:
				p1 = {s[i - 1], s[i + 1]}
				choice = ''.join(p - p1)
				s[i] = choice[0]
		if i == len(s) - 1:
			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


t = int(input())
for _ in range(t):
	i = input()
	arr = list(i)
	if 'aa' in i or 'bb' in i or 'cc' in i:
		print(-1)
		continue
	else:
		for j in range(len(arr) - 1):
			if arr[j] == '?':
				for item in ['a', 'b', 'c']:
					if item != arr[j - 1] and item != arr[j + 1]:
						arr[j] = item
		if arr[len(arr) - 1] == '?':
			for item in ['a', 'b', 'c']:
				if item != arr[len(arr) - 2]:
					arr[len(arr) - 1] = item
	print(''.join(arr))


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


from sys import stdin, stdout
import random
import time

def beautifulString(s):
	letters = set(('a', 'b', 'c'))
	for i in range(len(s)):
		if i < len(s) - 1:
			if s[i] != '?' and s[i] == s[i + 1]:
				return -1
		if s[i] == '?':
			usedLetters = set()
			if i < len(s) - 1:
				usedLetters.add(s[i + 1])
			if i > 0:
				usedLetters.add(s[i - 1])
			remaining = list(letters - usedLetters)
			new_character = random.choice(remaining)
			s[i] = new_character
	return ''.join(s)
n = int(input())
for i in range(n):
	s = [c for c in input()]
	print(beautifulString(s))

def decrypt(t, n):
	for i in range(2, n):
		if n % i == 0:
			t = t[i - 1::-1] + t[i:]
	t = t[::-1]
	return t


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


import random
from sys import stdin
t = int(input())
for _ in range(t):
	txt = list(input())
	for i in range(len(txt)):
		chars = ['a', 'b', 'c']
		if i < len(txt) - 1 and txt[i] != '?' and (txt[i] == txt[i + 1]):
			print(-1)
			break
		if txt[i] == '?':
			if i > 0 and txt[i - 1] != '?':
				chars.remove(txt[i - 1])
			if i < len(txt) - 1 and txt[i + 1] != '?' and (txt[i + 1] in chars):
				chars.remove(txt[i + 1])
			txt[i] = chars[0]
	else:
		print(*txt, sep='')


t = int(input())
error_message = '-1'
expected_chars = set(['a', 'b', 'c'])
input_strings = list()
result_list = list()

def select_char(ch_list):
	for ch in expected_chars - set(ch_list):
		return ch

def setup_chars(s):
	chars = list(s)
	prev_char = 'd'
	s_len = len(chars)
	for i in range(0, s_len - 1):
		if chars[i] == prev_char:
			return error_message
		if chars[i] == '?':
			chars[i] = select_char([prev_char, chars[i + 1]])
		prev_char = chars[i]
	if chars[s_len - 1] == prev_char:
		return error_message
	if chars[s_len - 1] == '?':
		chars[s_len - 1] = select_char([prev_char])
	return ''.join(chars)
for i in range(0, t):
	result_list.append(setup_chars(input()))
for result in result_list:
	print(result)


def f():
	s = input()
	l = len(s)
	s2 = ['']
	if s[0] == '?':
		s2.append('a')
	else:
		s2.append(s[0])
	for i in range(1, l):
		char = s[i]
		if char == '?':
			char = next[s2[i]]
		elif char == s2[i]:
			if s[i - 1] == '?':
				s2[i] = next[s2[i]]
			else:
				return -1
		s2.append(char)
	ans = ''.join(s2)
	return ans
next = {'a': 'b', 'b': 'c', 'c': 'a'}
t = int(input())
for i in range(t):
	print(f())


n = int(input())
for k in range(n):
	b = False
	s1 = input()
	s = []
	for elem in s1:
		s.append(elem)
	for i in range(len(s)):
		if i != len(s) - 1:
			if s[i] != '?' and s[i] == s[i + 1]:
				b = True
	for i in range(len(s)):
		if len(s) != 1:
			if i != 0 and i != len(s) - 1:
				if s[i] == '?':
					if s[i - 1] != 'b' and s[i + 1] != 'b':
						s[i] = 'b'
					elif s[i - 1] != 'a' and s[i + 1] != 'a':
						s[i] = 'a'
					else:
						s[i] = 'c'
				else:
					continue
			elif i == 0:
				if s[i] != '?':
					continue
				elif s[i + 1] != 'b':
					s[i] = 'b'
				elif s[i + 1] != 'a':
					s[i] = 'a'
				else:
					s[i] = 'c'
			elif s[i] != '?':
				continue
			elif s[i - 1] != 'b':
				s[i] = 'b'
			elif s[i - 1] != 'a':
				s[i] = 'a'
			else:
				s[i] = 'c'
		else:
			s[0] = 'a'
	if b:
		print('-1', end='')
	else:
		for elem in s:
			print(elem, end='')
	print()


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


def nextchr(c):
	return chr((ord(c) % 97 + 1) % 3 + 97)
t = int(input())
for you in range(t):
	l = input()
	n = len(l)
	li = [i for i in l]
	i = 0
	poss = 1
	while i < n:
		if l[i] == '?' and i == 0:
			start = 0
			li[start] = 'a'
			while l[i] == '?':
				li[i] = nextchr(li[i - 1])
				i += 1
				if i == n:
					break
			end = i
			if i != n:
				if li[end] == li[end - 1]:
					for j in range(start, end):
						li[j] = nextchr(li[j])
		elif l[i] == '?' and l[i - 1] != '?':
			start = i
			li[start] = nextchr(li[start - 1])
			while l[i] == '?':
				li[i] = nextchr(li[i - 1])
				i += 1
				if i == n:
					break
			end = i
			if i != n:
				if li[end] == li[end - 1]:
					for j in range(start, end):
						li[j] = nextchr(li[j])
		i += 1
	for i in range(1, len(li)):
		if li[i] == li[i - 1]:
			poss = 0
			break
	if poss == 0:
		print(-1)
	else:
		for i in li:
			print(i, end='')
		print()


def fix(q):
	p = {'a?b': 'c', 'a?a': 'c', 'a?c': 'b', 'b?a': 'c', 'b?b': 'a', 'b?c': 'a', 'c?a': 'b', 'c?b': 'a', 'c?c': 'b'}
	for (k, v) in p.items():
		if q == k:
			return v

def solve():
	s = input()
	if 'aa' in s or 'bb' in s or 'cc' in s:
		return -1
	ans = ['z']
	for i in range(len(s) - 1):
		if i == 0 and s[i] == '?' and (s[i + 1] in ('a', 'b', 'c')):
			ans.append('abc'.replace(s[i + 1], '')[0])
			continue
		if s[i] == '?' and s[i + 1] == s[i]:
			if i == 0:
				ans.append('a')
			else:
				ans.append('abc'.replace(ans[-1], '')[0])
		elif s[i] in ('a', 'b', 'c'):
			ans.append(s[i])
			continue
		else:
			ans.append(fix(''.join([ans[-1], s[i], s[i + 1]])))
	if s.endswith('?'):
		ans.append('abc'.replace(ans[-1], '')[0])
	else:
		ans.append(s[-1])
	return ''.join(ans).replace('z', '')

def main():
	t = int(input())
	for _ in range(t):
		print(solve())
main()


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


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


for _ in range(int(input())):
	s = list(' ' + input().strip())
	l = {'a', 'b', 'c'}
	flag = 0
	for i in range(1, len(s) - 1):
		if s[i] == '?':
			d = {s[i + 1], s[i - 1]}
			d = list(l - d - {'?'})
			s[i] = d[0]
		elif s[i] == s[i + 1]:
			flag = 1
			break
	if s[-1] == '?' and (not flag):
		d = {s[-2]}
		d = list(l - d - {'?'})
		s[-1] = d[0]
	if flag:
		print(-1)
	else:
		print(''.join(s[1:]))


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


T = int(input())
for cas in range(T):
	s = list(input())
	flag = 0
	a = ord('a')
	for i in range(len(s)):
		if i < len(s) - 1 and s[i] == s[i + 1] and (s[i] != '?'):
			flag = 1
		if s[i] == '?':
			for j in range(3):
				if (i == 0 or chr(a + j) != s[i - 1]) and (i == len(s) - 1 or chr(a + j) != s[i + 1]):
					s[i] = chr(a + j)
	if flag == 1:
		print(-1)
	else:
		for i in range(len(s)):
			print(s[i], end='')
		print()


t = int(input())
for _ in range(t):
	s = list(input())
	n = len(s)
	if n == 1:
		print('a')
	else:
		for i in range(n):
			if s[i] == '?':
				if i > 0 and i < n - 1:
					if (s[i - 1] == 'a' or s[i - 1] == 'c') and s[i + 1] != 'b':
						s[i] = 'b'
					elif (s[i - 1] == 'a' or s[i - 1] == 'b') and s[i + 1] != 'c':
						s[i] = 'c'
					elif (s[i - 1] == 'c' or s[i - 1] == 'b') and s[i + 1] != 'a':
						s[i] = 'a'
				elif 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 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'
		f = 1
		for i in range(1, n):
			if s[i] == s[i - 1]:
				f = 0
				break
		if f:
			ans = ''
			for i in range(n):
				ans = ans + s[i]
			print(ans)
		else:
			print(-1)


n = int(input())
t = 'abc' * 10
for i in range(n):
	s = input()
	ar = list(s)
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
	else:
		if ar[0] == '?':
			for j in range(len(t)):
				if len(ar) == 1:
					ar[0] = t[j]
					break
				if ar[1] == t[j]:
					pass
				else:
					ar[0] = t[j]
					break
		if ar[-1] == '?':
			for j in range(len(t)):
				if ar[-2] == t[j]:
					pass
				else:
					ar[-1] = t[j]
					break
		for i in range(1, len(ar) - 1):
			if ar[i] == '?':
				for j in range(len(t)):
					if ar[i - 1] == t[j] or ar[i + 1] == t[j]:
						pass
					else:
						ar[i] = t[j]
						break
		print(''.join(ar))


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())
result = ''
for n in range(t):
	fail = False
	text = list(input().strip(' '))
	for i in range(len(text)):
		if len(text) == 1:
			result += 'a\n'
			fail = True
			break
		if text[i] == '?':
			if i == 0:
				if text[i + 1] == 'a':
					text[i] = 'b'
				else:
					text[i] = 'a'
				continue
			if i == len(text) - 1:
				if text[i - 1] == 'a':
					text[i] = 'b'
				else:
					text[i] = 'a'
				continue
			if text[i - 1] == 'a':
				if text[i + 1] == '?' or text[i + 1] == 'a' or text[i + 1] == 'c':
					text[i] = 'b'
				if text[i + 1] == 'b':
					text[i] = 'c'
			if text[i - 1] == 'b':
				if text[i + 1] == '?' or text[i + 1] == 'b' or text[i + 1] == 'c':
					text[i] = 'a'
				if text[i + 1] == 'a':
					text[i] = 'c'
			if text[i - 1] == 'c':
				if text[i + 1] == '?' or text[i + 1] == 'a' or text[i + 1] == 'c':
					text[i] = 'b'
				if text[i + 1] == 'b':
					text[i] = 'a'
		elif i == 0:
			if text[i] == text[i + 1]:
				result += '-1\n'
				fail = True
				break
		elif i == len(text) - 1:
			if text[i] == text[i - 1]:
				result += '-1\n'
				fail = True
				break
		elif text[i - 1] == text[i] or text[i + 1] == text[i]:
			result += '-1\n'
			fail = True
			break
	if not fail:
		result += ''.join(text) + '\n'
print(result)


n = int(input())

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

def findchar(otherchar):
	if otherchar == '?':
		return 'a'
	elif otherchar == 'a':
		return 'b'
	return 'a'

def diffchar(c1, c2):
	chars = [c1, c2]
	if 'a' not in chars:
		return 'a'
	if 'b' not in chars:
		return 'b'
	return 'c'
for i in range(n):
	s = list(input())
	length = len(s)
	ans = None
	if not valid(s):
		print(-1)
	else:
		if len(s) == 1:
			if s[0] == '?':
				ans = ['a']
			else:
				ans = s
		else:
			if s[0] == '?':
				s[0] = findchar(s[1])
			if s[-1] == '?':
				s[-1] = findchar(s[-2])
			for i in range(1, length - 1):
				if s[i] == '?':
					s[i] = diffchar(s[i - 1], s[i + 1])
			ans = s
		print(''.join(ans))


def main():
	T = int(input())
	for tc in range(T):
		s = list(input().strip())
		n = len(s)
		letterSet: set = {'a', 'b', 'c'}
		i = 0
		while i < n:
			if s[i] == '?':
				if i == 0:
					prv = 'd'
				else:
					prv = s[i - 1]
				if i + 1 >= n:
					nxt = 'e'
				else:
					nxt = s[i + 1]
				for x in letterSet:
					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:
			print(''.join(s))
main()


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


t = int(input())
st = {'a', 'b', 'c'}
for _ in range(t):
	flag = 0
	l = []
	s = input()
	for i in s:
		l.append(i)
	for i in range(len(l)):
		if l[i] in st:
			if i + 1 < len(l):
				if l[i] == l[i + 1]:
					flag = 1
					break
			if i - 1 >= 0:
				if l[i - 1] == l[i]:
					flag = 1
					break
			continue
		ct = []
		if i + 1 < len(l):
			if l[i + 1] != '?':
				ct.append(l[i + 1])
		if i - 1 >= 0:
			if l[i - 1] != '?':
				ct.append(l[i - 1])
		for k in st:
			if k not in ct:
				l[i] = k
				break
	if flag == 1:
		print(-1)
	else:
		print(''.join(l))


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)


li = ['a', 'b', 'c']
for step in range(int(input())):
	A = list(input())
	flag = 0
	for i in range(len(A) - 1):
		if A[i] == A[i + 1] and A[i] != '?':
			flag = 1
			break
	if flag == 1:
		print(-1)
		continue
	for i in range(len(A)):
		if A[i] == '?':
			for j in li:
				if j != A[i - 1] and j != A[(i + 1) % len(A)]:
					A[i] = j
					break
	print(''.join(A))


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(''))
for _ in range(T):
	a = input('')
	n = len(a)
	res = True
	s = []
	for i in range(n - 1):
		if a[i] == a[i + 1] and a[i] != '?':
			res = False
			break
	if not res:
		print(-1)
		continue
	c = ['a', 'b', 'c']
	d = {'a': 0, 'b': 1, 'c': 2, '?': -1}
	for i in range(n):
		s.append(d[a[i]])
	t = 0
	for i in range(n):
		if s[i] == -1:
			s[i] = t
			if i < n - 1 and s[i + 1] == t:
				s[i] = (t + 1) % 3
				t = s[i]
			if i > 0 and s[i - 1] == t:
				s[i] = (t + 1) % 3
				t = s[i]
			if i < n - 1 and s[i + 1] == t:
				s[i] = (t + 1) % 3
				t = s[i]
			t = (t + 1) % 3
		else:
			continue
	for i in range(n):
		print(c[s[i]], end='')
	print('')


def soln() -> None:

	def logic() -> None:
		arr = list(input())
		if len(arr) == 1:
			if arr[0] != '?':
				print(arr[0])
			else:
				print('a')
				return
		for i in range(0, len(arr) - 1):
			if arr[i] == '?':
				continue
			if arr[i] == arr[i + 1]:
				print(-1)
				return
		if arr[0] == '?':
			if arr[1] != 'a':
				arr[0] = 'a'
			else:
				arr[0] = 'b'
		for i in range(1, len(arr) - 1):
			if arr[i] == '?':
				if arr[i + 1] == '?':
					x = chr(ord(arr[i - 1]) + 1)
					if x == 'd':
						arr[i] = 'a'
					else:
						arr[i] = x
				else:
					x = chr(ord(arr[i - 1]) + 1)
					if x == 'd':
						x = 'a'
					if x == arr[i + 1]:
						x = chr(ord(x) + 1)
						if x == 'd':
							x = 'a'
						arr[i] = x
					else:
						arr[i] = x
		n = len(arr)
		if arr[n - 1] == '?':
			x = chr(ord(arr[n - 2]) + 1)
			if x == 'd':
				x = 'a'
			arr[n - 1] = x
		print(''.join(arr))
	for _ in range(int(input())):
		logic()
soln()


start = None
end = None
t = int(input())
dic = {}
dic['a'] = 'b'
dic['b'] = 'c'
dic['c'] = 'a'
for _ in range(t):
	stri = input()
	st = []
	for i in stri:
		st.append(i)
	if len(st) == 1:
		if st[0] == '?':
			st[0] = 'a'
			print(''.join(st))
			continue
		else:
			print(''.join(st))
			continue
	for i in range(len(st)):
		if st[i] == '?':
			if i - 1 >= 0 and i + 1 < len(st):
				if dic[st[i - 1]] != st[i + 1]:
					st[i] = dic[st[i - 1]]
				else:
					st[i] = dic[st[i + 1]]
			elif i - 1 >= 0 and i + 1 >= len(st):
				st[i] = dic[st[i - 1]]
			elif i - 1 <= 0:
				if st[i + 1] == '?':
					st[i] = 'a'
				else:
					st[i] = dic[st[i + 1]]
	truth = True
	for i in range(len(st) - 1):
		if st[i] == st[i + 1]:
			truth = False
			break
	if truth == True:
		print(''.join(st))
	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()


k = int(input())
for _ in range(k):
	s = list(input())
	y = len(s)
	can = 1
	for i in range(1, y):
		if s[i] == s[i - 1] and s[i] != '?':
			can = 0
			break
	if can:
		if '?' in s:
			g = s.index('?')
			res = ''.join(s[:g])
			while g < y:
				t = ''
				r = 'ab'
				f = 0
				temp = g
				while s[g] == '?':
					t += r[f % 2]
					g += 1
					f += 1
					if g == y:
						break
				t = list(t)
				if temp == 0:
					if g == y:
						res += ''.join(t)
					else:
						if s[g] == t[-1]:
							t[-1] = 'c'
						res += ''.join(t)
				else:
					if s[temp - 1] == t[0]:
						t[0] = 'c'
					if g < y:
						if t[-1] == s[g]:
							t[-1] = 'c'
					if len(t) == 2:
						if t[0] == t[1]:
							if s[temp - 1] == 'a':
								t[0] = 'b'
							else:
								t[0] = 'a'
					elif len(t) == 1:
						if t[0] == 'c':
							if g < y:
								if s[g] == 'c':
									if res[-1] == 'a':
										t[0] = 'b'
									else:
										t[0] = 'a'
								elif res[-1] == 'c':
									if s[g] == 'a':
										t[0] = 'b'
									else:
										t[0] = 'a'
					res += ''.join(t)
				if g < y:
					while s[g] != '?':
						res += s[g]
						g += 1
						if g == y:
							break
			print(res)
		else:
			print(''.join(s))
	else:
		print(-1)


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)


t = int(input())
while t:
	l = list(input().strip())
	n = len(l)
	if l[0] == '?' and 1 < n:
		for i in ['a', 'b', 'c']:
			if l[1] != i:
				l[0] = i
				break
	elif l[0] == '?' and n == 1:
		l[0] = 'a'
	for i in range(1, len(l) - 1):
		if l[i] == '?':
			for j in ['a', 'b', 'c']:
				if j != l[i - 1] and j != l[i + 1]:
					l[i] = j
	if l[-1] == '?' and len(l) >= 2:
		for i in ['a', 'b', 'c']:
			if l[-2] != i:
				l[-1] = i
				break
	lol = 0
	for i in range(1, n):
		if l[i] == l[i - 1]:
			lol = 1
			break
	if lol == 0:
		print(''.join(l))
	else:
		print(-1)
	t -= 1


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


def solve():
	s = list(input())
	for i in range(len(s) - 1):
		if s[i] != '?' and s[i] == s[i + 1]:
			return '-1'
	for i in range(len(s)):
		if s[i] == '?':
			valid = {'a', 'b', 'c'}
			if i != 0:
				valid.discard(s[i - 1])
			if i != len(s) - 1:
				valid.discard(s[i + 1])
			s[i] = list(valid)[0]
	return ''.join(s)

def main():
	t = int(input())
	for i in range(t):
		print(solve())
main()


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	for i in range(int(input())):
		s = input()
		a = 0
		for i in range(len(s) - 1):
			if s[i] == s[i + 1] and s[i] != '?':
				a = 1
				break
		h = 0
		for i in range(len(s)):
			if s[i] == '?':
				h += 1
		b = []
		c = ['a', 'b', 'c']
		if a == 1:
			print(-1)
		elif len(s) == 1:
			print(c[0])
		elif h == len(s):
			b = h * c
			while len(b) > len(s):
				b.pop()
			b = ''.join(map(str, b))
			print(b)
		else:
			for i in range(len(s)):
				if s[i] != '?':
					b.append(s[i])
				elif len(b) != 0:
					d = b[-1]
					e = i
					while s[e] == '?':
						e += 1
						if e == len(s):
							break
					if e == len(s) and s[e - 1] == '?':
						g = 0
					else:
						g = s[e]
					c.remove(d)
					if g in c:
						c.remove(g)
					b.append(c[0])
					c.append(d)
					if g not in c:
						c.append(g)
				else:
					e = i
					while s[e] == '?':
						e += 1
					g = s[e]
					c.remove(g)
					b.append(c[0])
					c.append(g)
			b = ''.join(map(str, b))
			print(b)
main()


from collections import defaultdict
for _ in range(int(input())):
	s = list(input())
	l = ['a', 'b', 'c']
	n = len(s)
	rec = defaultdict(int)
	flag = 1
	for i in l:
		rec[i] = 0
	for i in range(n):
		if s[i] == '?':
			if i == n - 1:
				for j in l:
					if rec[j] == 0:
						s[i] = j
				break
			if s[i + 1] == '?':
				for j in l:
					if rec[j] == 0:
						s[i] = j
			else:
				rec[s[i + 1]] += 1
				for j in l:
					if rec[j] == 0:
						s[i] = j
				rec[s[i + 1]] -= 1
		elif i < n - 1 and s[i] == s[i + 1]:
			flag = 0
			break
		if i > 0:
			rec[s[i - 1]] -= 1
		rec[s[i]] += 1
	if flag:
		print(''.join(s))
	else:
		print(-1)


import math
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	s = input()
	e1 = s.count('bb')
	e2 = s.count('aa')
	e3 = s.count('cc')
	n = len(s)
	if e1 > 0 or e2 > 0 or e3 > 0:
		print(-1)
		continue
	elif len(s) == 1:
		print('a')
		continue
	else:
		l = list(s)
		w = ['a', 'b', 'c']
		o = set()
		for i in range(len(l)):
			if i == 0 and l[i] == '?':
				if l[i + 1] != '?':
					o.add(l[i + 1])
				for j in w:
					if j not in o:
						l[i] = j
						break
				o = set()
				continue
			if i == n - 1 and l[i] == '?':
				o.add(l[i - 1])
				for j in w:
					if j not in o:
						l[i] = j
						break
				o = set()
				continue
			if l[i] == '?':
				o.add(l[i - 1])
				if l[i + 1] != '?':
					o.add(l[i + 1])
				for j in w:
					if j not in o:
						l[i] = j
						break
				o = set()
		print(''.join(l))


import math
t = int(input())
for _ in range(t):
	arr = list(input().strip())
	non = 0
	if len(arr) == 1:
		if arr[0] == '?':
			arr[0] = 'a'
		print(''.join(arr))
	else:
		if arr[0] == '?':
			if arr[1] == 'a':
				arr[0] = 'b'
			elif arr[1] == 'b':
				arr[0] = 'c'
			else:
				arr[0] = 'a'
		for i in range(1, len(arr) - 1):
			if arr[i] == '?':
				if arr[i - 1] == 'a':
					if arr[i + 1] == 'b':
						arr[i] = 'c'
					else:
						arr[i] = 'b'
				elif arr[i - 1] == 'b':
					if arr[i + 1] == 'a':
						arr[i] = 'c'
					else:
						arr[i] = 'a'
				elif arr[i - 1] == 'c':
					if arr[i + 1] == 'b':
						arr[i] = 'a'
					else:
						arr[i] = 'b'
		if arr[len(arr) - 1] == '?':
			if arr[len(arr) - 2] == 'a':
				arr[len(arr) - 1] = 'b'
			elif arr[len(arr) - 2] == 'b':
				arr[len(arr) - 1] = 'c'
			else:
				arr[len(arr) - 1] = 'a'
		for i in range(1, len(arr)):
			if arr[i] == arr[i - 1]:
				non = 1
				break
		if non == 1:
			print('-1')
		else:
			print(''.join(arr))


x = int(input())
for i in range(x):
	y0 = input()
	y0 = '#' + y0 + '#'
	y = list(y0)
	f = 1
	for j in range(1, len(y)):
		if y[j] == y[j - 1] and y[j] != '?':
			print(-1)
			f = 0
			break
	if not f:
		continue
	l = 0
	a = '#'
	b = '#'
	for j in range(1, len(y)):
		if y[j] == '?':
			if not l:
				a = y[j - 1]
			l += 1
		elif l:
			b = y[j]
			c1 = ' '
			c2 = ' '
			if a == b:
				if a == 'c':
					c1 = 'a'
					c2 = 'b'
				if a == 'a':
					c1 = 'b'
					c2 = 'c'
				if a == 'b' or a == '#':
					c1 = 'a'
					c2 = 'c'
				k = j - l
				while k < j:
					y[k] = c1
					k += 1
					if k < j:
						y[k] = c2
					k += 1
			else:
				if a == 'c':
					c1 = 'a'
					c2 = 'b'
				if a == 'a':
					c1 = 'b'
					c2 = 'c'
				if a == 'b' or a == '#':
					c1 = 'a'
					c2 = 'c'
				if l % 2 == 1 and b == c1 or (l % 2 == 0 and b == c2):
					k = j - l
					while k < j:
						y[k] = c2
						k += 1
						if k < j:
							y[k] = c1
						k += 1
				else:
					k = j - l
					while k < j:
						y[k] = c1
						k += 1
						if k < j:
							y[k] = c2
						k += 1
			l = 0
	y[len(y) - 1] = '#'
	y0 = ''.join(y)
	y0 = y0.replace('#', '')
	print(y0)


import sys
from math import gcd
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin, stdout
from collections import defaultdict, deque
from math import log2, ceil, floor
inp = lambda : int(input())
sip = lambda : input()
mulip = lambda : map(int, input().split())
lst = lambda : list(map(int, input().split()))
slst = lambda : list(sip())
arr2d = lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x % 2 != 0, l)))
evens = lambda l: len(list(filter(lambda x: x % 2 == 0, l)))
mod = pow(10, 9) + 7
Judge = 0
if Judge:
	sys.stdin = open('input.in', 'r')
for _ in range(inp()):
	s = list(input())
	if len(s) == 1:
		print('a' if s[0] == '?' else s[0])
	else:
		for i in range(len(s)):
			if s[i] != '?':
				continue
			if i == 0:
				if s[i] != '?':
					continue
				elif s[i + 1] == 'a':
					s[i] = 'b'
				elif s[i + 1] == 'b':
					s[i] = 'c'
				else:
					s[i] = 'a'
			elif i > 0 and i < len(s) - 1:
				if s[i] == '?' and s[i + 1] != '?':
					if s[i - 1] == 'a' and s[i + 1] == 'b':
						s[i] = 'c'
					elif s[i - 1] == 'a' and s[i + 1] == 'c':
						s[i] = 'b'
					elif s[i - 1] == 'a' and s[i + 1] == 'a':
						s[i] = 'b'
					if s[i - 1] == 'b' and s[i + 1] == 'a':
						s[i] = 'c'
					elif s[i - 1] == 'b' and s[i + 1] == 'c':
						s[i] = 'a'
					elif s[i - 1] == 'b' and s[i + 1] == 'b':
						s[i] = 'a'
					if s[i - 1] == 'c' and s[i + 1] == 'b':
						s[i] = 'a'
					elif s[i - 1] == 'c' and s[i + 1] == 'c':
						s[i] = 'b'
					elif s[i - 1] == 'c' and s[i + 1] == 'a':
						s[i] = 'b'
				elif s[i] == '?' and s[i + 1] == '?':
					if s[i - 1] == 'a':
						s[i] = 'b'
					elif s[i - 1] == 'b':
						s[i] = 'c'
					elif s[i - 1] == 'c':
						s[i] = 'a'
			elif s[i - 1] == 'a':
				s[i] = 'b'
			elif s[i - 1] == 'b':
				s[i] = 'c'
			else:
				s[i] = 'a'
		f = 0
		for i in range(1, len(s)):
			if s[i - 1] == s[i]:
				f = 1
				break
		if f == 0:
			print(''.join(s))
		else:
			print(-1)


def apart(i):
	if i == '?':
		return 'a'
	abc = ['a', 'b', 'c']
	m = abc.index(i)
	return abc[m - 1]

def cpart(i, j):
	if i == j:
		return apart(i)
	else:
		lola = [i, j]
		if 'a' not in lola:
			return 'a'
		elif 'b' not in lola:
			return 'b'
		else:
			return 'c'
for _ in range(int(input())):
	s = input()
	lola = ''
	flag = 0
	if len(s) == 1:
		if s == '?':
			print('a')
		else:
			print(s)
		continue
	if s[0] == '?':
		s = apart(s[1]) + s[1:len(s)]
	for a in range(len(s) - 1):
		if s[a] == s[a + 1] and s[a] != '?':
			print(-1)
			flag = 1
			break
	if flag == 1:
		continue
	i = 0
	while i < len(s):
		if s[i] != '?':
			lola = lola + s[i]
			i += 1
			continue
		else:
			if i + 1 < len(s) and s[i + 1] != '?':
				lola += cpart(lola[i - 1], s[i + 1])
			else:
				lola += apart(lola[i - 1])
			i += 1
	print(lola)


t = int(input())
letters = 'abc'
for _ in range(t):
	s = input()
	n = len(s)
	if 'aa' in s or 'bb' in s or 'cc' in s:
		print(-1)
		continue
	ls = list(s)
	v = 0
	for i in range(n):
		if ls[i] == '?':
			if i == 0 and i < n - 1:
				while letters[v] == ls[i + 1]:
					v = (v + 1) % 3
			elif i < n - 1:
				while letters[v] == ls[i + 1] or letters[v] == ls[i - 1]:
					v = (v + 1) % 3
			else:
				while letters[v] == ls[i - 1]:
					v = (v + 1) % 3
			ls[i] = letters[v]
	print(''.join(ls))


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


def beautify_string(s_):
	valid_chars = {'a', 'b', 'c'}
	s = list(s_)
	n = len(s)
	for i in range(n):
		prev_ele = s[i - 1] if i > 0 else None
		next_ele = s[i + 1] if i < n - 1 else None
		if s[i] == '?':
			s[i] = (valid_chars - {prev_ele, next_ele}).pop()
		if next_ele == s[i]:
			return -1
	return ''.join(s)
for _ in range(int(input())):
	print(beautify_string(input()))


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


for _ in [0] * int(input()):
	tmp = input()
	ans = ['', *tmp]
	i = 0
	cur = ''
	for x in tmp:
		i += 1
		ans[i] = x == '?' and ({*'abc'} - {*ans[i - 1:i + 2]}).pop() or x
	print((''.join(ans), -1)[any((x * 2 in tmp for x in 'abc'))])


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)


t = int(input())
for i in range(t):
	s = input()
	s = list(s)
	possible = True
	if len(s) == 1:
		print('a')
	else:
		for j in range(1, len(s) - 1):
			if 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'
				elif s[j - 1] != 'c' and s[j + 1] != 'c':
					s[j] = 'c'
			elif s[j] == s[j + 1] or s[j] == s[j - 1]:
				possible = False
				break
		if possible == True:
			if s[0] == '?':
				if s[1] != 'a':
					s[0] = 'a'
				elif s[1] != 'b':
					s[0] = 'b'
				elif s[1] != 'c':
					s[0] = 'c'
			if s[-1] == '?':
				if s[-2] != 'a':
					s[-1] = 'a'
				elif s[-2] != 'b':
					s[-1] = 'b'
				elif s[-2] != 'c':
					s[-1] = 'c'
			print(''.join(s))
		else:
			print(-1)


from sys import stdin

def rl():
	return [int(w) for w in stdin.readline().split()]
(k,) = rl()
for _ in range(k):
	s = stdin.readline().strip()
	n = len(s)
	t = list(s)
	for i in range(n):
		if s[i] == '?':
			x = {'a', 'b', 'c'}
			if i > 0:
				x.discard(t[i - 1])
			if i < n - 1:
				x.discard(t[i + 1])
			t[i] = x.pop()
	t = ''.join(t)
	for i in range(n - 1):
		if t[i] == t[i + 1]:
			print(-1)
			break
	else:
		print(t)