#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long power(long long b, long long e, long long m) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b % m, e / 2, m) % m;
  return power(b * b % m, e / 2, m);
}
long long power(long long b, long long e) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b, e / 2);
  return power(b * b, e / 2);
}
vector<int> m(2 * 1e7 + 5, 0);
void hack() {
  string s;
  cin >> s;
  char p = 'a';
  long long t = 0;
  for (long long i = 1; i < s.size(); i++) {
    if (s[i - 1] == s[i] & s[i] != '?') {
      t = 1;
      break;
    }
  }
  if (t) {
    cout << "-1"
         << "\n";
    return;
  }
  for (unsigned long long i = 0; i < s.size(); i++) {
    if (s[i] == '?') {
      char l = 'c';
      for (long long j = i; j < s.size(); j++) {
        if (s[j] != '?') {
          l = s[j];
          break;
        }
      }
      char u, v, w;
      if ((p == 'c' | p == 'b') & (l == 'c' | l == 'b')) {
        u = 'a';
        v = 'b';
        w = 'c';
      }
      if ((p == 'c' | p == 'a') & (l == 'c' | l == 'a')) {
        u = 'b';
        v = 'a';
        w = 'c';
      }
      if ((p == 'a' | p == 'b') & (l == 'a' | l == 'b')) {
        u = 'c';
        v = 'b';
        w = 'a';
      }
      s[i] = u;
      if (s[i + 1] == '?')
        for (long long j = i + 1; j < s.size(); j++) {
          if (s[j + 1] != '?') {
            if (s[j + 1] != u & s[j - 1] != u)
              s[j] = u;
            else if (s[j + 1] != v & s[j - 1] != v)
              s[j] = v;
            else
              s[j] = w;
            break;
          } else {
            if (j % 2 == 0)
              s[j] = v;
            else
              s[j] = w;
          }
        }
    } else
      p = s[i];
  }
  cout << s << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long x = 0;
  for (int i = 2; i < 2 * 1e7 + 1; i += 1) {
    if (m[i] == 0) {
      for (int j = i * 2; j < 2 * 1e7 + 1; j += i) m[j]++;
      m[i] = 1;
    }
  }
  int t = 1;
  cin >> t;
  while (t--) {
    hack();
  }
  return 0;
}
