#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    string st;
    cin >> st;
    string ans;
    char last = 'd';
    int ct = 0;
    for (auto c : st) {
      if (c == '?')
        ct += 1;
      else {
        int idx = last - 97 + 1;
        while (ct != 0) {
          idx %= 3;
          if (idx == c - 97) idx++;
          idx %= 3;
          ans += char(97 + idx);
          last = char(97 + idx);
          idx += 1;
          ct--;
        }
        if (c == last) break;
        ans += c;
        last = c;
      }
    }
    char c = 'c';
    int idx = last - 97 + 1;
    while (ct--) {
      idx %= 3;
      if (idx == c - 97) idx++;
      idx %= 3;
      ans += char(97 + idx);
      last = char(97 + idx);
      idx += 1;
    }
    if (ans.size() != st.size())
      cout << -1 << endl;
    else
      cout << ans << endl;
  }
}
