#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 1e6 + 10;
int main(){
LL t;
while(t--){
int n, q;
string s1, s2;
cin >> n >> q;
cin >> s1 >> s2;
while(q--){
if(s1 == s2) puts("Yes");
else puts("No");
int o, p;
char c;
cin >> o >> p >> c;
if(o == 0) s1[p - 1] = c;
else if(o == 1)s2[p - 1] = c;
}
}
return 0;
}