#pragma GCC diagnostic warning "-Wextra" #pragma GCC diagnostic warning "-Wshadow" #include <bits/stdc++.h> using namespace std; template <class A, class B> bool cmin(A& a, B b) { return a > b && (a = b, true); } template <class A, class B> bool cmax(A& a, B b) { return a < b && (a = b, true); } template <class A, class B> ostream& operator<<(ostream& os, pair<A, B>& p) { return os << '(' << p.first << ", " << p.second << ')'; } static bool debug = false; void dump() {} template <class A, class... B> void dump(A&& a, B&&... b) { if (debug) cout << a << (sizeof...(b) ? ' ' : '\n'), dump(b...); } template <class A> void dump1D(A& a) { if (debug) for (auto i = a.begin(); i != a.end(); i++) cout << *i << (next(i) != a.end() ? ' ' : '\n'); } template <class A> void dump2D(A& a) { if (debug) for (auto i = a.begin(); i != a.end(); i++) dump1D(*i), cout << (next(i) != a.end() ? "" : "\n"); } signed main() { cin.tie(nullptr)->sync_with_stdio(false); debug = true; int N; cin >> N; string S, T; cin >> S >> T; int Q; cin >> Q; vector<tuple<char, int, char>> V(Q); for (int i = 0; i < Q; i++) { char a, c; int b; cin >> a >> b >> c, b--; V.at(i) = {a, b, c}; } vector<int> A(N); for (int i = 0; i < N; i++) { A.at(i) = S.at(i) - T.at(i); } for (const auto& [a, b, c] : V) { if (a == 'S') { A.at(b) -= S.at(b); A.at(b) += c; S.at(b) = c; } else { A.at(b) += T.at(b); A.at(b) -= c; T.at(b) = c; } if (S == T) { cout << '=' << '\n'; continue; } for (const auto& a : A) { if (a < 0) { cout << '<' << '\n'; goto next; } if (a > 0) { cout << '>' << '\n'; goto next; } } next:; } }