#include <bits/stdc++.h>   using namespace std;   long long int dx[4] = {-1, 0, 0, +1};   long long int dy[4] = {0, -1, +1, 0};   const long long int LINF = 1e18;   const long long int INF = 1e9;   const long long int mod = 1e9 + 7;   long long int power(long long int a, long long int b, long long int m) {     if (b == 0) return 1;     if (b == 1) return a % m;     long long int t = power(a, b / 2, m);     t = (t * t) % m;     if (b & 1) t = (t * a) % m;     return t;   }   long long int modInverse(long long int a, long long int m) {     return power(a, m - 2, m);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int t;     cin >> t;     while (t--) {       long long int n, ans = 0, i, j;       string ip;       cin >> ip;       long long int sz = ip.size();       if (ip[0] ==  ? ) {         if (sz >= 2 && ip[1] ==  a )           ip[0] =  b ;         else           ip[0] =  a ;       }       for (long long int i = 1; i <= -1 + ip.size(); i++) {         if (ip[i] ==  ? ) {           if (ip[i - 1] ==  a ) {             if ((i + 1) < sz && ip[i + 1] ==  b )               ip[i] =  c ;             else               ip[i] =  b ;           } else if (ip[i - 1] ==  b ) {             if ((i + 1) < sz && ip[i + 1] ==  a )               ip[i] =  c ;             else               ip[i] =  a ;           } else if (ip[i - 1] ==  c ) {             if ((i + 1) < sz && ip[i + 1] ==  a )               ip[i] =  b ;             else               ip[i] =  a ;           } else             ip[i] =  a ;         }       }       bool poss = true;       for (long long int i = 1; i <= sz - 1; i++) {         if (ip[i] == ip[i - 1]) {           cout << -1 << endl;           poss = false;           break;         }       }       if (poss) cout << ip << endl;     }     return 0;   }   