#include using namespace std; typedef long long ll; typedef vector vll; #define fr(n) for (ll i = 0; i> n >> m >> q; vector monitors; vector desks; vector neighbours; neighbours.reserve(n); monitors.reserve(n); desks.reserve(n); fr(n){ int x; cin >> x; desks.push_back(x); } fr(n){ int x; cin >> x; monitors.push_back(x); } while(m--) { int a, b; cin >> a >> b; neighbours[a-1].push_back(b-1); neighbours[b-1].push_back(a-1); } // queries ll index; while (q--){ string s; cin >> s; if (s == "check"){ cin >> index; ll summ = 0, sumt = 0; summ += monitors[index-1]; sumt += desks[index-1]; for (const ll neigh : neighbours[index-1]){ summ += monitors[neigh]; sumt += desks[neigh]; } if (summ > sumt) cout << "monitors" << endl; else if (sumt > summ) cout << "desks" << endl; else cout << "same" << endl; }else{ int added; cin >> added; string thing; cin >> thing >> index; if (thing == "desk") desks[index-1] += added; else monitors[index-1] += added; } } }