#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e9 + 7;
void solve();
void sieve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed;
  cout << setprecision(10);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
long long int pr[1001];
vector<long long int> prime;
void sieve() {
  pr[0] = -1;
  pr[1] = -1;
  long long int i, j;
  for (i = 2; i < 1001; i++) {
    if (pr[i] != -1) {
      pr[i] = 1;
      for (j = 2; j < 1001 / i + 1; j++) {
        if (i * j < 1001) pr[i * j] = -1;
      }
    }
  }
  for (i = 2; i < 1001; i++) {
    if (pr[i] == 1) prime.push_back(i);
  }
}
bool pal(string s) {
  string t = s;
  reverse(s.begin(), s.end());
  return (t == s);
}
long long int countdig(long long int x) {
  long long int c = 0;
  if (x == 0) return 1;
  while (x != 0) {
    c++;
    x /= 10;
  }
  return c;
}
bool isprime(long long int x) {
  bool flag = true;
  for (long long int i = 2; i <= sqrt(x) + 1; i++) {
    if (x % i == 0) {
      flag = false;
      break;
    }
  }
  if (x == 1) flag = false;
  return flag;
}
void swap(long long int& a, long long int& b) {
  long long int t = a;
  a = b;
  b = t;
}
char f(char a, char b) {
  long long int t[150];
  for (long long int i = 0; i < 150; i++) t[i] = 0;
  t[a - 0] = 1;
  t[b - 0] = 1;
  if (t['a' - 0] == 0)
    return 'a';
  else if (t['b' - 0] == 0)
    return 'b';
  else
    return 'c';
}
char f(char a) {
  if (a == 'a')
    return 'b';
  else if (a == 'b')
    return 'c';
  else
    return 'b';
}
void solve() {
  string s;
  cin >> s;
  long long int n, i;
  n = s.length();
  if (n == 1) {
    if (s[0] != '?')
      cout << s;
    else
      cout << 'a';
  } else {
    bool flag = false;
    for (i = 1; i < n; i++) {
      if (s[i] == s[i - 1] && s[i] != '?') {
        flag = true;
        break;
      }
    }
    if (flag)
      cout << -1;
    else {
      for (i = 0; i < n; i++) {
        if (s[i] == '?') {
          if (i - 1 >= 0 && i + 1 < n)
            s[i] = f(s[i - 1], s[i + 1]);
          else if (i - 1 >= 0)
            s[i] = f(s[i - 1]);
          else
            s[i] = f(s[i + 1]);
        }
      }
      cout << s;
    }
  }
  cout << endl;
}
