#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y % 2 == 1) res *= x;
    y /= 2;
    x *= x;
  }
  return res;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  int test;
  cin >> test;
  while (test--) {
    string s;
    cin >> s;
    long long flag = 0;
    for (long long i = 0; i < s.length() - 1; i++) {
      if (s[i] == s[i + 1] && s[i] != '?') {
        flag = 1;
        break;
      } else if (s[i] == '?' && i >= 1) {
        for (long long j = 'a'; j < 'd'; j++) {
          if (j != s[i - 1] && j != s[i + 1]) {
            s[i] = char(j);
          }
        }
      }
    }
    if (s[0] == '?') {
      for (long long i = 'a'; i < 'd'; i++) {
        if (i != s[1]) {
          s[0] = char(i);
        }
      }
    }
    if (s[s.length() - 1] == '?') {
      for (long long i = 'a'; i < 'd'; i++) {
        if (s[s.length() - 2] != i) s[s.length() - 1] = char(i);
      }
    }
    if (flag == 1)
      cout << -1 << "\n";
    else
      cout << s << endl;
  }
}
