#include #include using namespace std; int main() { map dp; dp["fishing"] = "alice"; dp["golf"] = "bob"; dp["hockey"] = "charlie"; int q; cin >> q; while(q--) { string a, b; cin >> a >> b >> b >> b >> b; if(dp[b] == a) cout << a << " already has " << b << "\n"; else { cout << a << " borrows " << b << " from " << dp[b] << "\n"; dp[b] = a; } } }