#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
bool correct(string s) {
  for (int i = 0; i < s.length() - 1; i++) {
    if (s[i] == s[i + 1]) return false;
  }
  return true;
}
char getChar(char a, char b) {
  for (char i = 'a'; i <= 'c'; i++) {
    if (i != a && i != b) return i;
  }
  return 'b';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  while (n--) {
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
      if (s[0] == '?' && i == 0) {
        s[0] = getChar(s[1], s[1]);
        continue;
      }
      if (s[s.length() - 1] == '?' && i == s.length() - 1) {
        s[s.length() - 1] = getChar(s[s.length() - 2], s[s.length() - 2]);
        continue;
      }
      if (s[i] == '?') {
        s[i] = getChar(s[i - 1], s[i + 1]);
      }
    }
    if (correct(s)) {
      cout << s << endl;
    } else {
      cout << -1 << endl;
    }
  }
  return 0;
}
