import java.util.Scanner;
import java.lang.*;
public class Main {
public static void main(String [] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
String chef = “CHEF”;
for(int k=0;k<t;k++) {
StringBuilder S = new StringBuilder(sc.next());
int j=0;
while(j<S.length()) {
if(S.charAt(j) == '?' || S.charAt(j) == 'C') {
int i=j;
int value =0;
while(j<S.length() && value<chef.length() &&(S.charAt(j) == '?'||S.charAt(j) == chef.charAt(value))) {
j++;
value++;
}
if(value == chef.length()) {
String newStr = S.substring(0,i)+chef;
if(i+chef.length() < S.length()) {
newStr += S.substring(i+chef.length(),S.length());
}
S= new StringBuilder(newStr);
} else {
if(S.charAt(i) == '?') {
S.setCharAt(i,'A');
}
j= i+1;
}
} else {
j++;
}
}
System.out.println(S);
}
}
}