#include <bits/stdc++.h>
using namespace std;
int t;
string sir;
char pick[] = {'a', 'b', 'c'};
int main() {
  cin >> t;
  while (t--) {
    cin >> sir;
    bool ok = true;
    if (sir.size() == 1) {
      if (sir[0] == '?')
        cout << 'a' << '\n';
      else
        cout << sir << '\n';
      continue;
    }
    if (sir[0] == '?')
      sir[0] = pick[(sir[1] - 'a' + 302) % 3];
    else if (sir[0] == sir[1])
      ok = false;
    if (ok == true)
      for (int i = 1; i <= sir.size() - 2; i++)
        if (sir[i] == '?') {
          for (int k = 0; k <= 2; k++)
            if (pick[k] != sir[i - 1] && pick[k] != sir[i + 1]) {
              sir[i] = pick[k];
              break;
            }
        } else if (sir[i - 1] == sir[i] || sir[i] == sir[i + 1]) {
          ok = false;
          break;
        }
    if (sir[sir.size() - 1] == '?')
      sir[sir.size() - 1] = pick[(sir[sir.size() - 2] - 'a' + 302) % 3];
    if (ok == true)
      cout << sir << '\n';
    else
      cout << -1 << '\n';
  }
  return 0;
}
