#include using namespace std; struct RollingHash { public: static const long long B1 = 10007; static const long long B2 = 10009; static const long long MOD = 1000000007; vector hash1, hash2, pow1, pow2; RollingHash() : RollingHash("") {} RollingHash(const string& s) : n_(s.size()), hash1(s.size() + 1), hash2(s.size() + 1), pow1(s.size() + 1), pow2(s.size() + 1) { hash1[0] = hash2[0] = 0; pow1[0] = pow2[0] = 1; for (int i = 0; i < (int)s.size(); i++) { hash1[i + 1] = (hash1[i] * B1 + s[i]) % MOD; hash2[i + 1] = (hash2[i] * B2 + s[i]) % MOD; pow1[i + 1] = pow1[i] * B1 % MOD; pow2[i + 1] = pow2[i] * B2 % MOD; } } long long get(int l, int r) const { long long res1 = (hash1[r] - hash1[l] * pow1[r - l]) % MOD; if (res1 < 0) res1 += MOD; long long res2 = (hash2[r] - hash2[l] * pow2[r - l]) % MOD; if (res2 < 0) res2 += MOD; return res1 * MOD + res2; } private: int n_; }; int main() { // 毎回ロリハ更新すれば // O(NQ) int n, q; cin >> n >> q; string s; cin >> s; while (q--) { int t; cin >> t; if (t == 1) { int i; cin >> i; --i; char c; cin >> c; s[i] = c; } else { string t; cin >> t; RollingHash rs(s); RollingHash rt(t); bool ok = false; long long hash_t = rt.get(0, t.size()); for (int i = 0; i < n - t.size() + 1; ++i) { long long hash = rs.get(i, i + t.size()); if (hash == hash_t) ok = true; } cout << (ok ? "Yes" : "No") << endl; } } }