#include <bits/stdc++.h>
using namespace std;
int t, pos, len, flag, cnt;
string s, ts;
map<char, string> method;
int main(void) {
  method['a'] = "bc";
  method['b'] = "ac";
  method['c'] = "ab";
  method['d'] = "abc";
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> s;
    ts = s;
    s += 'd';
    flag = cnt = 0;
    len = s.length();
    for (int i = 0; i < len; i++) {
      if (s[i] == '?') {
        if (!flag) {
          pos = i;
          while (s[i] == '?' && i < len) {
            i++;
          }
          if (s[pos - 1] == method[s[i]][(++cnt) % 2]) {
            ts[pos] = method[s[i]][(++cnt) % 2];
          } else {
            ts[pos] = method[s[i]][(cnt) % 2];
          }
          for (int k = pos + 1; k < i; k++) {
            ts[k] = method[s[i]][(++cnt) % 2];
          }
        }
      }
    }
    for (int i = 1; i < len; i++) {
      if (ts[i] == ts[i - 1]) {
        flag = -1;
        break;
      }
    }
    if (flag == -1) {
      cout << -1 << endl;
    } else {
      cout << ts << endl;
    }
  }
}
