
#include <iostream>
#include <string>
#include <vector>
using namespace std;

class Player {
public:
    string name;

    Player(string n) : name(n) {}
};

class Team {
private:
    vector<Player*> players;

public:
    void addPlayer(Player& p) {
        players.push_back(&p);
    }

    void showPlayers() {
        for (Player* p : players) {
            cout << p->name << endl;
        }
    }
};

int main() {
    Player p1("Ahmed");
    Player p2("Omar");

    {
        Team team;
        team.addPlayer(p1);
        team.addPlayer(p2);

        team.showPlayers();
    } // Team is destroyed here

    cout << p1.name << " still exists\n";

    return 0;
}
