#include using namespace std; using lint = long long int; template ostream& operator<<(ostream& os, pair p) { return os << "{" << p.first << ", " << p.second << "}"; } template ostream& operator<<(ostream& os, vector v) { os << "["; for(int i = 0; i < v.size(); i++) { if(i) os << ", "; os << v[i]; } return os << "]"; } void solve() { int n, m, q; cin >> n >> m >> q; vector _desks_tmp(n + 1); vector _monitors_tmp(n + 1); for(int i = 1; i <= n; i++) cin >> _desks_tmp[i]; for(int i = 1; i <= n; i++) cin >> _monitors_tmp[i]; vector> edges(n + 1); for(int i = 0; i < m; i++) { int a, b; cin >> a >> b; edges[a].push_back(b); edges[b].push_back(a); } for(int i = 1; i <= n; i++) edges[i].push_back(i); vector desks(n + 1); vector monitors(n + 1); //cout << _desks_tmp << endl; //cout << _monitors_tmp << endl; //cout << edges << endl; for(int i = 1; i <= n; i++) { desks[i] = 0; for(auto dep : edges[i]) desks[i] += _desks_tmp[dep]; } for(int i = 1; i <= n; i++) { monitors[i] = 0; for(auto dep : edges[i]) monitors[i] += _monitors_tmp[dep]; } //cout << endl; //cout << desks << endl; //cout << monitors << endl; while(q--) { string cmd; cin >> cmd; if(cmd == "check") { int num; cin >> num; int dcnt = desks[num]; int mcnt = monitors[num]; if(dcnt > mcnt) cout << "desks" << endl; else if(dcnt < mcnt) cout << "monitors" << endl; else cout << "same" << endl; continue; } int cnt, room; cin >> cnt >> cmd >> room; if(cmd == "desk") for(auto t : edges[room]) desks[t] += cnt; else for(auto t : edges[room]) monitors[t] += cnt; } } int main() { ios::sync_with_stdio(false); int t = 1; //cin >> t; while(t--) solve(); return 0; }