#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long SIZE = 100000;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const long double PI = acos(-1);
const long long MAXN = numeric_limits<long long>::max();
template <class T>
T maxT(T a, T b) {
  return (a > b ? a : b);
}
template <class T>
T minT(T a, T b) {
  return (a < b ? a : b);
}
template <class T>
void setmin(T &a, T b) {
  a = (a > b ? a : b);
}
template <class T>
void setmax(T &a, T b) {
  a = (a < b ? a : b);
}
void fileio() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("debug.txt", "w", stderr);
}
void ofileio() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
void clock_out() {
  cerr << "\nTime Elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}
bool chk(string s, char a, char b, int i) {
  return ((s[i - 1] == a) && (s[i + 1] == b));
}
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  if (n == 1) {
    cout << 'a';
    return;
  } else {
    if (s[0] == '?') {
      if (s[1] == '?')
        s[0] = 'a';
      else {
        if (s[1] == 'a')
          s[0] = 'b';
        else if (s[1] == 'b')
          s[0] = 'c';
        else if (s[1] == 'c')
          s[0] = 'a';
      }
    }
    for (int i = 1; i < n - 1; i++) {
      if (s[i] == '?') {
        if (s[i + 1] == '?') {
          if (s[i - 1] == 'a')
            s[i] = 'b';
          else if (s[i - 1] == 'b')
            s[i] = 'c';
          else if (s[i - 1] == 'c')
            s[i] = 'a';
        } else {
          if (chk(s, 'a', 'b', i) || chk(s, 'b', 'a', i))
            s[i] = 'c';
          else if (chk(s, 'b', 'c', i) || chk(s, 'c', 'b', i))
            s[i] = 'a';
          else if (chk(s, 'c', 'a', i) || chk(s, 'a', 'c', i))
            s[i] = 'b';
          else if (chk(s, 'a', 'a', i))
            s[i] = 'b';
          else if (chk(s, 'b', 'b', i))
            s[i] = 'c';
          else if (chk(s, 'c', 'c', i))
            s[i] = 'a';
        }
      }
    }
    if (s[n - 1] == '?') {
      if (s[n - 2] == 'a')
        s[n - 1] = 'b';
      else if (s[n - 2] == 'b')
        s[n - 1] = 'c';
      else if (s[n - 2] == 'c')
        s[n - 1] = 'a';
    }
    for (int i = 1; i < n; i++) {
      if (s[i] == s[i - 1]) {
        cout << -1;
        return;
      }
    }
    cout << s;
    return;
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  1;
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  1;
  return 0;
}
