#include<bits/stdc++.h>
using namespace std;
class passenger{
private:
    int m;
    string to, from, type_p;
    bool inBus=false, h, isNecB=true, paid=false;
public:
    passenger(int money, string _from, string _to, bool health)
    {
        m=money;
        //type_p=p;
        from=_from;
        to=_to;
        h=health;

    }
    int M()
    {
        return m;
    }
    bool H()
    {
        return h;
    }
    void InBus()
    {
        inBus=1;
    }
    bool state()
    {
        return inBus;
    }
    void pay()
    {
        m-=1400;
        paid=1;
    }
    bool chpay()
    {
        return paid;
    }
    bool isNec()
    {
        return isNecB;
    }
    void leftBus()
    {
        isNecB=0;
        inBus=0;
    }
    string From()
    {
        return from;
    }
    string To()
    {
        return to;
    }

};
class conductor{
private:
    bool h;
    int m;
public:
    conductor(bool health, int money)
    {
        h=health;
        m=money;
    }
    bool H()
    {
        return h;
    }
    void MforT()
    {
        m+=1400;
    }

};
class driver{
private:
    bool h, s;
public:
    driver(bool health, bool safety)
    {
        h=health;
        s=safety;
    }
    bool H()
    {
        return h;
    }
    bool S()
    {
        return s;
    }

};
class Route{
private:
    passenger student;
    conductor c;
    driver d;
    string BusStop[7]={"Beltepa","ToshMI","Karima","Beruniy","Huvaydo","Tinchlik","Chorsu"};
public:
    void input()
    {

        int money;
        string from, to;
        bool health, safety;
        cout<<"Input student's money, from, to, health:\n";
        cin>>money>>from>>to>>health;
        student(money,from,to,health);
        cout<<"Input conductor's health, money:\n";
        cin>>money>>health;
        c(health,money);
        cout<<"Input driver's health, safety\n";
        cin>>health>>safety;
        d(health,safety);
    }
    void route()
    {
        if(!(c.H()&&d.H()))cout<<"Service doesn't satisfy for route\n";
        else{
            cout<<"Driver and conductor are healthy and bus is safe\n";
            for(int i=0; i<BusStop.size(); i++)
            {
                cout<<"Bus stop #"<<i+1<<": "<<BusStop[i]<<endl;
                if(BusStop[i]==student.From())
                {
                    cout<<"A student has got on the bus\n";
                    student.inBus();
                    if(student.H())
                    {
                        cout<<"The student is healthy\n";
                        if(student.M()>=1400)
                        {
                            cout<<"The student has got enough money. He can use public transport\n";
                            student.pay();
                            c.MforT();
                        }
                        else {
                            cout<<"The student has got neither a travel card nor money. He has to leave bus immediately\n";
                            student.leftBus();
                        }
                    }
                }
                else if(student.inBus()&&BusStop[i]==student.To())
                {
                    cout<<"The student arrived to destination\n";
                    student.leftBus();
                }
            }
        }
    }
};
int main()
{

    Route obj;
    obj.input();
    obj.route();
}
