#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i, N) for (int i = 0; i < (int)N; i++) #define FOR(i, a, b) for (int i = a; i < (int)b; i++) #define ALL(x) (x).begin(), (x).end() using namespace std; constexpr int inf = 1 << 30; constexpr long long llinf = 1LL << 62; constexpr int mod = 1000000007; // 998244353; constexpr int dy[4] = {-1, 0, 1, 0}, dx[4] = {0, -1, 0, 1}; using ll = long long; using Pii = pair; using Pll = pair; inline int popcount(ll x) { return __builtin_popcountll(x); } inline int div2num(ll x) { return __builtin_ctzll(x); } inline bool bit(ll x, int b) { return (x >> b) & 1; } template bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } template string to_string(T s); template string to_string(pair p); string to_string(char c) { return string(1, c); } string to_string(string s) { return s; } string to_string(const char s[]) { return string(s); } template string to_string(T v) { if (v.empty()) return "{}"; string ret = "{"; for (auto x : v) ret += to_string(x) + ","; ret.back() = '}'; return ret; } template string to_string(pair p) { return "{" + to_string(p.first) + ":" + to_string(p.second) + "}"; } void debug() { cerr << endl; } template void debug(Head head, Tail... tail) { cerr << to_string(head) << " "; debug(tail...); } template vector makev(int n, T v) { return vector(n, v); } struct IO { #ifdef _WIN32 inline char getchar_unlocked() { return getchar(); } inline void putchar_unlocked(char c) { putchar(c); } #endif std::string separator = " "; template inline void read(T& x) { char c; do { c = getchar_unlocked(); } while (c != '-' && (c < '0' || '9' < c)); bool minus = 0; if (c == '-') { minus = 1; c = getchar_unlocked(); } x = 0; while ('0' <= c && c <= '9') { x *= 10; x += c - '0'; c = getchar_unlocked(); } if (minus) x = -x; } inline void read(std::string& x) { char c; do { c = getchar_unlocked(); } while (c == ' ' || c == '\n'); x.clear(); do { x += c; c = getchar_unlocked(); } while (c != ' ' && c != '\n' && c != EOF); } template inline void read(std::vector& v) { for (auto& x : v) read(x); } template inline void read(std::pair& p) { read(p.first); read(p.second); } template inline void read(Head& head, Tail&... tail) { read(head); read(tail...); } template inline void write(T x) { char buf[32]; int p = 0; if (x < 0) { x = -x; putchar_unlocked('-'); } if (x == 0) putchar_unlocked('0'); while (x > 0) { buf[p++] = (x % 10) + '0'; x /= 10; } while (p) { putchar_unlocked(buf[--p]); } } inline void write(std::string x) { for (char c : x) putchar_unlocked(c); } inline void write(const char s[]) { for (int i = 0; s[i] != 0; ++i) putchar_unlocked(s[i]); } template inline void write(std::vector v) { if (v.empty()) return; for (auto itr = v.begin(); itr + 1 != v.end(); ++itr) { write(*itr); write(separator); } write(v.back()); } template inline void write(Head head, Tail... tail) { write(head); write(separator); write(tail...); } template inline void writeln(Head head, Tail... tail) { write(head, tail...); write("\n"); } void set_separator(std::string s) { separator = s; } } io; struct Prime { int n; vector table; vector primes; Prime(int _n = 100000) { n = _n + 1; table.resize(n, -1); table[0] = 0; table[1] = -1; for (int i = 2; i * i < n; ++i) { if (table[i] == -1) { for (int j = i * i; j < n; j += i) { table[j] = i; } } } } void enumerate_primes() { primes.clear(); for (int i = 2; i < n; ++i) { if (table[i] == -1) primes.push_back(i); } } vector> prime_factor(long long x) { map mp; long long div = 2; int p = 0; while (n <= x && div * div <= x) { if (x % div == 0) { mp[div]++; x /= div; } else { if (p + 1 < primes.size()) { div = primes[++p]; } else { div++; } } } if (x < n) { while (table[x] != -1) { mp[table[x]]++; x /= table[x]; } } if (x > 1) mp[x]++; vector> ret; for (auto p : mp) ret.push_back(p); return ret; } }; template struct Math { vector fact, factinv, inv; Math(int n = 100000) { fact.resize(n + 1); factinv.resize(n + 1); inv.resize(n + 1); fact[0] = fact[1] = 1; factinv[0] = factinv[1] = 1; inv[1] = 1; for (int i = 2; i <= n; ++i) { fact[i] = fact[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; factinv[i] = factinv[i - 1] * inv[i] % MOD; } } long long C(int n, int r) { if (n < r || n < 0 || r < 0) { return 0; } else { return fact[n] * (factinv[r] * factinv[n - r] % MOD) % MOD; } } long long P(int n, int r) { if (n < r || n < 0 || r < 0) { return 0; } else { return fact[n] * factinv[n - r] % MOD; } } long long H(int n, int r) { return C(n + r - 1, r); } }; struct UnionFind { vector data; vector> groups; UnionFind(int n) : data(n, -1) {} int root(int v) { return data[v] < 0 ? v : data[v] = root(data[v]); } bool unite(int u, int v) { if ((u = root(u)) == (v = root(v))) { return 1; } else { if (-data[u] < -data[v]) swap(u, v); data[u] += data[v]; data[v] = u; return 0; } } int size(int v) { return -data[root(v)]; } void make_groups() { map> mp; for (int i = 0; i < data.size(); ++i) mp[root(i)].push_back(i); groups.clear(); for (auto p : mp) groups.push_back(p.second); } }; namespace phc { long long modpow(long long a, long long n) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } long long modinv(long long a) { long long b = mod, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= mod; if (u < 0) u += mod; return u; } long long gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } } // namespace phc template struct ModInt { int x; ModInt() : x(0) {} ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} ModInt& operator+=(const ModInt& p) { if ((x += p.x) >= mod) x -= mod; return *this; } ModInt& operator-=(const ModInt& p) { if ((x += mod - p.x) >= mod) x -= mod; return *this; } ModInt& operator*=(const ModInt& p) { x = (int)(1LL * x * p.x % mod); return *this; } ModInt& operator/=(const ModInt& p) { *this *= p.inverse(); return *this; } ModInt operator-() const { return ModInt(-x); } ModInt operator+(const ModInt& p) const { return ModInt(*this) += p; } ModInt operator-(const ModInt& p) const { return ModInt(*this) -= p; } ModInt operator*(const ModInt& p) const { return ModInt(*this) *= p; } ModInt operator/(const ModInt& p) const { return ModInt(*this) /= p; } ModInt inverse() const { int a = x, b = mod, u = 1, v = 0, t; while (b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); } return ModInt(u); } ModInt pow(int64_t n) const { ModInt ret(1), mul(x); while (n > 0) { if (n & 1) ret *= mul; mul *= mul; n >>= 1; } return ret; } friend ostream& operator<<(ostream& os, const ModInt& p) { return os << p.x; } friend istream& operator>>(istream& is, ModInt& a) { int64_t t; is >> t; a = ModInt(t); return (is); } static int get_mod() { return mod; } }; template struct RangeFold { int n; vector dat; using F = function; const F f; const T id; RangeFold(int _n, const F _f, const T _id) : n(1), f(_f), id(_id) { while (n < _n) n <<= 1; dat.resize(2 * n, id); } void update(int i, T x) { dat[i += n] = x; while (i >>= 1) dat[i] = f(dat[i * 2], dat[i * 2 + 1]); } T query(int l, int r) { T xl = id, xr = id; for (l += n, r += n; l < r; l >>= 1, r >>= 1) { if (l & 1) xl = f(xl, dat[l++]); if (r & 1) xr = f(dat[--r], xr); } return f(xl, xr); } T& operator[](const int i) { return dat[n + i]; } }; template struct KthNext { array, L> next; KthNext(int n, function f) { for (int i = 0; i < L; ++i) next[i].resize(n); for (int i = 0; i < n; ++i) next[0][i] = f(i); for (int i = 0; i < L - 1; ++i) for (int j = 0; j < n; ++j) next[i + 1][j] = next[i][next[i][j]]; } int get(int x, long long k) { for (int i = 0; i < L; ++i) if ((k >> i) & 1) x = next[i][x]; return x; } }; long long inv_count(vector& vec) { int n = vec.size(); vector bit(n + 1); long long ret = 0; for (int i = n - 1; i >= 0; --i) { int x = vec[i]; while (x > 0) { ret += bit[x]; x -= x & -x; } x = vec[i] + 1; while (x < n + 1) { bit[x] += 1; x += x & -x; } } return ret; } using modint = ModInt; int main() { int N; string S, T; int Q; io.read(N, S, T, Q); set diff; REP(i, N) if (S[i] != T[i]) diff.insert(i); REP(q, Q) { string c; int x, y; io.read(c, x, y); x--; if (S[x] != T[x]) diff.erase(x); if (c == "S") S[x] = '0' + y; else T[x] = '0' + y; if (S[x] != T[x]) diff.insert(x); if (diff.empty()) io.writeln("="); else { int tp = *diff.begin(); if (S[tp] < T[tp]) io.writeln("<"); else io.writeln(">"); } } return 0; }