#include using namespace std; #define rep(i, a, b) for(int i = a; i < (b) ; ++i) #define all(x) std::begin(x), std::end(x) #define sz(x) ((int) x.size()) typedef long long ll; #define int ll typedef pair pii; typedef vector vi; const ll mod = 1'000'000'007; ll modpow(ll b, ll e) { ll ans = 1; for (; e; b = b * b % mod, e /= 2) { if (e & 1) ans = ans * b % mod; } return ans; } signed main() { cin.tie(0)->sync_with_stdio(0); int vrcholy, edges, queries; cin >> vrcholy >> edges >> queries; vector> next(vrcholy); // desk,mon diff, add Q count vector>> stats(vrcholy); for (auto &[d, cache]: stats) { int k; cin >> k; d -= k; } for (auto &[d, cache]: stats) { int k; cin >> k; d += k; auto &[sum, addPlus, addMinus] = cache; addPlus = -1; } for (int i = 0; i < edges; ++i) { int in, to; cin >> in >> to; in--; to--; next[in].push_back(to); next[to].push_back(in); } int addsPlus = 0; int addsMinus = 0; for (int i = 0; i < queries; ++i) { string word; cin >> word; if (word == "check") { int index; cin >> index; index--; auto &[my, cache] = stats[index]; auto &[sum, addPlus, addMinus] = cache; if (addPlus == -1 || (sum >= 0 && sum - addsMinus + addMinus <= 0) || (sum <= 0 && sum + addsPlus - addPlus >= 0)) { sum = my; for (auto nigh: next[index]) { sum += get<0>(stats[nigh]); } addMinus = addsMinus; addPlus = addsPlus; } if (sum == 0) { cout << "same\n"; } else if (sum > 0) { cout << "monitors\n"; } else { cout << "desks\n"; } } else { int count; string word; int vrchol; cin >> count >> word >> vrchol; vrchol--; if (word == "monitor") { get<0>(stats[vrchol]) += count; addsPlus += count; } else { addsMinus += count; get<0>(stats[vrchol]) -= count; } } } cout << flush; return 0; }