#include <bits/stdc++.h>
using namespace std;
const long MaxN = 1e5 + 5;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (long i = 0; i < n; i++) {
    string s;
    cin >> s;
    bool stop = 0;
    for (long j = 1; j < s.length(); j++) {
      if (s[j] == s[j - 1] && s[j] != '?') {
        stop = 1;
        cout << -1 << endl;
        break;
      }
    }
    if (s[0] == '?') {
      if (s[1] == 'a')
        s[0] = 'b';
      else
        s[0] = 'a';
    }
    char prev = s[0];
    for (long j = 1; j < s.length(); j++) {
      bool a = true;
      bool b = true;
      bool c = true;
      if (s[j] == '?') {
        if (s[j + 1] == 'a' || prev == 'a') a = false;
        if (s[j + 1] == 'b' || prev == 'b') b = false;
        if (s[j + 1] == 'c' || prev == 'c') c = false;
        if (a) s[j] = 'a';
        if (b) s[j] = 'b';
        if (c) s[j] = 'c';
      }
      prev = s[j];
    }
    if (!stop) cout << s << endl;
  }
  return 0;
}
