#include #include using namespace std; int main() { int t; cin >> t; while (t--) { int n, m; string s1, s2; cin >> n >> m >> s1 >> s2; bool found = false; int pos = -1; for (int i = 0; i + m <= n; i++) { bool match = true; for (int j = 0; j < m; j++) { if (s1[i+j] != s2[j] && s1[i+j] != '?') { match = false; break; } } if (match) { found = true; pos = i; break; } } if (!found) { continue; } for (int i = 0; i < n; i++) { if (i >= pos && i < pos + m) { cout << s2[i-pos]; } else if (s1[i] == '?') { cout << 'a'; } else { cout << s1[i]; } } cout << endl; } return 0; }