#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    if (s.size() == 1) {
      if (s[0] == '?')
        printf("a\n");
      else
        cout << s << "\n";
    } else {
      int f = 0;
      for (int i = 0; i < s.size(); i++) {
        if (s[i] == s[i + 1] && s[i] != '?') {
          f = 1;
          break;
        }
      }
      if (f == 1)
        printf("-1\n");
      else {
        char ch = 'a';
        for (int i = 0; i < s.size() - 1; i++) {
          if (s[i] == '?' && i == 0) {
            for (char c = 'a'; c <= 'c'; c++) {
              if (s[i + 1] != c) {
                s[i] = c;
                break;
              }
            }
          } else if (s[i] == '?') {
            for (char c = 'a'; c <= 'c'; c++) {
              if (s[i + 1] != c && s[i - 1] != c) {
                s[i] = c;
                break;
              }
            }
          }
        }
        if (s[s.size() - 1] == '?') {
          for (char c = 'a'; c <= 'c'; c++) {
            if (s[s.size() - 2] != c) {
              s[s.size() - 1] = c;
              break;
            }
          }
        }
        cout << s << "\n";
      }
    }
  }
}
