#include <iostream>
using namespace std;
#include <list>
struct Student
{
	string lastname;
	int course;
	int mathAn;
	int mathAl;
};
void printlist(list<Student> &lst){
	for(list<Student>::iterator it = lst.begin(); it != lst.end(); it++)
	 cout<< (*it).lastname<<" "<< (*it).course<<" "<<(*it).mathAn<<" "<<(*it).mathAl<<" ";
	cout<<endl;
}
bool compareLastname(const Student& a, const Student& b){
    return a.lastname < b.lastname;
}
bool compareCourse(const Student& a, const Student& b){
    return a.course < b.course;
}
bool lowMark(const Student& s){
    return (s.mathAn < 60 || s.mathAl < 60);
}
int main() {
	 list<Student> lst;
    lst.push_back({"Ivanov", 1, 75, 80});
    lst.push_back({"Frolov", 2, 55, 70});
    lst.push_back({"Cheprazov", 1, 90, 95});
    lst.push_back({"Pinti", 2, 61, 62});
    lst.push_back({"Georgiev", 1, 45, 88});
    lst.push_back({"Bondar", 2, 78, 85});
    cout << "Початковий список:" << endl;
    printlist(lst);
    lst.sort(compareLastname);
    cout << "sort lastname" << endl;
    printlist(lst);
    lst.sort(compareCourse);
    cout << "sort coyrse" << endl;
    printlist(lst);
    for(list<Student>::iterator it = lst.begin(); it != lst.end(); it++){
        if(it->mathAn > 60 && it->mathAl > 60){
            it->course++;
        }
    }
    cout << "next course" << endl;
    printlist(lst);
    lst.remove_if(lowMark);

    cout << "<60:" << endl;
    printlist(lst);
	return 0;
}