#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,tuple>>> stats(vrcholy); for(auto & [d,cache]:stats) { cin >> d.first; } for(auto & [d, cache]:stats) { cin >> d.second; } 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 addQsCounter = 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 & [diff,addQs, sum] = cache; if(addQs == 0 || abs(diff/99) + addQs <= addQsCounter) { sum = my; for(auto nigh:next[index]) { auto & [values,cache] = stats[nigh]; sum.first += values.first; sum.second += values.second; } addQs = addQsCounter; } diff = sum.first - sum.second; if(diff == 0) { cout << "same" << endl; } else if(diff < 0) { cout << "monitors" << endl; } else { cout << "desks" << endl; } } else { addQsCounter ++; int count; string word; int vrchol; cin >> count >> word >> vrchol; vrchol--; if(word == "monitor") { get<0>(stats[vrchol]).second += count; } else { get<0>(stats[vrchol]).first += count; } } } return 0; }