#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL),
      cout << fixed, cout << setprecision(10);
  int t;
  cin >> t;
  while (t--) {
    string n;
    cin >> n;
    for (int i = 0; i < int(n.size()); ++i) {
      if (n[i] == '?') {
        for (char j = 'a'; j <= 'c'; j++) {
          if (n[i - 1] != j && n[i + 1] != j) n[i] = j;
        }
      } else if (n[i] == n[i + 1]) {
        n = "-1";
      }
    }
    cout << n << endl;
  }
  return 0;
}
