#include <bits/stdc++.h>
using namespace std;
map<pair<char, char>, char> a;
map<char, char> b;
int main() {
  int n;
  string s;
  cin >> n;
  a[{'a', 'a'}] = 'b';
  a[{'a', 'b'}] = 'c';
  a[{'a', 'c'}] = 'b';
  a[{'a', '?'}] = 'b';
  a[{'b', 'a'}] = 'c';
  a[{'b', 'b'}] = 'a';
  a[{'b', 'c'}] = 'a';
  a[{'b', '?'}] = 'a';
  a[{'c', 'a'}] = 'b';
  a[{'c', 'b'}] = 'a';
  a[{'c', 'c'}] = 'b';
  a[{'c', '?'}] = 'a';
  b['a'] = 'b';
  b['b'] = 'a';
  b['c'] = 'a';
  b['?'] = 'a';
  for (int i = 0; i < n; i++) {
    cin >> s;
    bool f = true;
    for (int j = 1; j < s.length(); j++) {
      if (s[j] == s[j - 1]) {
        if (s[j] == '?') {
          continue;
        }
        f = false;
        break;
      }
    }
    if (!f) {
      cout << -1 << endl;
      continue;
    }
    if (s[0] == '?') {
      if (s.length() > 1) {
        s[0] = b[s[1]];
      } else {
        s[0] = 'a';
      }
    }
    if (s[s.length() - 1] == '?') {
      s[s.length() - 1] = b[s[s.length() - 2]];
    }
    for (int j = 1; j < s.length() - 1; j++) {
      if (s[j] == '?') {
        s[j] = a[{s[j - 1], s[j + 1]}];
      }
    }
    cout << s << endl;
  }
  return 0;
}
