#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long t;
  cin >> t;
  for (long long tt = 0; tt < t; ++tt) {
    string c;
    cin >> c;
    if (c[0] == '?' && c.size() > 1 && c[1] != 'a')
      c[0] = 'a';
    else if (c[0] == '?')
      c[0] = 'b';
    bool boo = false;
    for (long long i = 1; i < c.size() - 1; ++i) {
      if (c[i] != '?' && c[i] == c[i - 1]) {
        cout << -1 << endl;
        boo = true;
        break;
      }
      if (c[i] != '?') continue;
      if (c[i - 1] != 'a' && c[i + 1] != 'a') c[i] = 'a';
      if (c[i - 1] != 'b' && c[i + 1] != 'b') c[i] = 'b';
      if (c[i - 1] != 'c' && c[i + 1] != 'c') c[i] = 'c';
    }
    if (!boo) {
      if (c.size() > 1 && c[c.size() - 1] == c[c.size() - 2]) {
        cout << -1 << endl;
        continue;
      }
      if (c[c.size() - 1] == '?' && c.size() > 1 && c[c.size() - 2] != 'a')
        c[c.size() - 1] = 'a';
      else if (c[c.size() - 1] == '?' && c.size() > 1)
        c[c.size() - 1] = 'b';
      cout << c << endl;
    }
  }
  return 0;
}
