/** * @FileName a.cpp * @Author kanpurin * @Created 2021.03.28 15:47:39 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; template< typename T > struct BinaryIndexedTree { std::vector< T > data; BinaryIndexedTree() {} BinaryIndexedTree(int sz) { data.assign(++sz, 0); } BinaryIndexedTree(vector< T > vec) { data.assign(vec.size()+1,0); copy(vec.begin(), vec.end(), data.begin()+1); for (int i = 1; i < data.size(); i++) data[i + (i & -i)] += data[i]; } inline T sum(int k) const { T ret = 0; for (k; k > 0; k -= k & -k) ret += data[k]; return (ret); } inline T sum(int left, int right) const { return sum(right) - sum(left); } inline void add(int k, T x) { for (++k; k < data.size(); k += k & -k) data[k] += x; } int lower_bound(T k) const { if (k <= 0) return 0; int res = 0; int N = 1; while (N < (int)data.size()) N *= 2; for (int i = N / 2; i > 0; i /= 2) { if (res + i < (int)data.size() && data[res + i] < k) { k -= data[res + i]; res += i; } } return res; } friend std::ostream& operator<<(std::ostream &os, const BinaryIndexedTree &bit) { os << "[ "; for (int i = 0; i < bit.data.size() - 1; i++) { os << bit.sum(i, i + 1); if (i < bit.data.size() - 2) os << ", "; } os << " ]"; return os; } }; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n;cin >> n; string s,t;cin >> s >> t; int q;cin >> q; vector a(n); for (int i = 0; i < n; i++) a[i] = s[i] != t[i]; BinaryIndexedTree bit(a); while(q--) { char c; int x,y; cin >> c >> x >> y; if (c == 'S') s[x-1] = char(y+'0'); else t[x-1] = char(y+'0'); if (s[x-1] == t[x-1]) bit.add(x-1,0-a[x-1]), a[x-1] = 0; else bit.add(x-1,1-a[x-1]), a[x-1] = 1; int k = bit.lower_bound(1); if (k == n) cout << '=' << endl; else if (s[k] < t[k]) cout << '<' << endl; else cout << '>' << endl; } return 0; }