#include <bits/stdc++.h>
using namespace std;
vector<long long> fact(1001, 1);
long long ncr_2(long long n, long long k) {
  if (k > n) return 0;
  if (k * 2 > n) k = n - k;
  if (k == 0) return 1;
  long long result = n;
  for (long long i = 2; i <= k; ++i) {
    result = result * (n - i + 1);
    result /= i;
  }
  return result;
}
long long pow(long long x, unsigned long long y, long long p) {
  long long res = 1LL;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long _pow(int a, int b) {
  if (!b) return 1;
  long long temp = _pow(a, b / 2);
  temp = (temp * temp);
  if (b % 2) return (a * temp);
  return temp;
}
long long invmod(int a, int m) { return pow(a, m - 2, m); }
long long ncr(int n, int r) {
  if (n < r) return 0;
  long long ans = fact[n];
  ans *= invmod(fact[n - r], 1000000007);
  ans %= 1000000007;
  ans *= invmod(fact[r], 1000000007);
  ans %= 1000000007;
  return ans;
}
bool comp(const pair<int, int>& a, const pair<int, int>& b) {
  return a.second < b.second;
}
int summ(string s) {
  int sum = 0;
  for (long long i = 0; i < s.length(); i++) {
    sum += s[i] - '0';
  }
  return sum;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int tc = 1;
  cin >> tc;
  for (long long ti = 0; ti < tc; ti++) {
    string s;
    cin >> s;
    char last = s[0];
    if (s[0] == '?') {
      if (s.length() == 1) {
        cout << 'a' << '\n';
        continue;
      } else {
        if (s[1] == 'a') {
          s[0] = 'b';
          last = 'b';
        } else if (s[1] == 'c') {
          s[0] = 'b';
          last = 'b';
        } else {
          s[0] = 'a';
          last = 'a';
        }
      }
    }
    int flag = 0;
    for (long long i = 1; i < s.length(); i++) {
      if (s[i] != '?' && s[i] == last) {
        flag = 1;
        break;
      } else if (s[i] != '?' && s[i] != last) {
        last = s[i];
      } else {
        if (i != s.length() - 1) {
          if (s[i + 1] == '?') {
            if (s[i - 1] == 'a') {
              s[i] = 'b';
              last = 'b';
            } else if (s[i - 1] == 'c') {
              s[i] = 'b';
              last = 'b';
            } else {
              s[i] = 'c';
              last = 'c';
            }
          } else {
            if (s[i - 1] == s[i + 1] && s[i - 1] == 'a') {
              s[i] = 'b';
              last = 'b';
              continue;
            }
            if (s[i - 1] == s[i + 1] && s[i - 1] == 'b') {
              s[i] = 'a';
              last = 'a';
              continue;
            }
            if (s[i - 1] == s[i + 1] && s[i - 1] == 'c') {
              s[i] = 'b';
              last = 'b';
              continue;
            }
            if ((s[i - 1] == 'a' && s[i + 1] == 'b') ||
                s[i + 1] == 'a' && s[i - 1] == 'b') {
              s[i] = 'c';
              last = 'c';
            } else if ((s[i - 1] == 'c' && s[i + 1] == 'a') ||
                       (s[i - 1] == 'a' && s[i + 1] == 'c')) {
              s[i] = 'b';
              last = 'b';
            } else {
              s[i] = 'a';
              last = 'a';
            }
          }
        } else {
          if (s[i - 1] == 'a') {
            s[i] = 'b';
          } else {
            s[i] = 'a';
          }
        }
      }
    }
    if (flag) {
      cout << -1 << '\n';
    } else {
      cout << s << '\n';
    }
  }
}
