#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 100100;
bool dp[N][3];
void Solve() {
  string s;
  cin >> s;
  const int n = s.size();
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < 3; j++) {
      dp[i][j] = 0;
    }
  }
  if (s[0] != '?') {
    dp[0][s[0] - 'a'] = true;
  } else {
    dp[0][0] = dp[0][1] = dp[0][2] = true;
  }
  for (int i = 1; i < n; i++) {
    if (s[i] == '?') {
      int pre = 0;
      for (int j = 0; j < 3; j++) {
        pre += dp[i - 1][j];
      }
      if (pre >= 2) {
        for (int j = 0; j < 3; j++) {
          dp[i][j] = true;
        }
      } else if (pre == 1) {
        for (int j = 0; j < 3; j++) {
          dp[i][j] = dp[i - 1][j] ^ 1;
        }
      }
    } else {
      for (int j = 0; j < 3; j++) {
        if (s[i] - 'a' == j) continue;
        dp[i][s[i] - 'a'] |= dp[i - 1][j];
      }
    }
  }
  string answer = "";
  int cur = -1;
  for (int i = 0; i < 3; i++) {
    if (dp[n - 1][i]) {
      cur = i;
    }
  }
  if (cur == -1) {
    cout << cur << "\n";
    return;
  }
  answer.push_back('a' + cur);
  for (int itr = n - 2; itr >= 0; itr--) {
    for (int j = 0; j < 3; j++) {
      if (j != cur && dp[itr][j]) {
        cur = j;
        break;
      }
    }
    answer.push_back('a' + cur);
  }
  reverse((answer).begin(), (answer).end());
  cout << answer << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    Solve();
  }
}
