#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>

using namespace std;

struct package
{
    uint16_t year, month, day;
    uint16_t hour, minute, second;
    string command;
    string name;
    string old_version, new_version;
};

istream& operator>> (ifstream &stream, package &pack)
{
    string s;
    stringstream ss;
    getline(stream, s, '-');
    ss << s;
    cout << s << " ";
    ss >> pack.year;
    ss.clear();
    getline(stream, s, '-');
    ss << s;
    cout << s << " ";
    ss >> pack.month;
    ss.clear();
    getline(stream, s, ' ');
    ss << s;
    cout << s << " ";
    ss >> pack.day;
    ss.clear();
    getline(stream, s, ':');
    ss << s;
    cout << s << " ";
    ss >> pack.hour;
    ss.clear();
    getline(stream, s, ':');
    ss << s;
    cout << s << " ";
    ss >> pack.minute;
    ss.clear();
    getline(stream, s, ' ');
    ss << s;
    cout << s << " ";
    ss >> pack.second;
    getline(stream,s,' ');
    pack.command = s;
    cout << s << " ";
    getline(stream,s,' ');
    pack.name = s;
    cout << s << " ";
    getline(stream,s,' ');
    pack.old_version = s;
    getline(ss,s);
    cout << s << " ";
    pack.new_version = s;
    return stream;
}

void readfile(vector<package> &v)
{
    ifstream f ("log1.txt");
    package temp;
    if (f.is_open())
    {
    while (!f.eof())
        {
            f >> temp;
            v.push_back(temp);
        }
    f.close();
    }
}

void print(vector<package> &v, uint16_t year, uint16_t month, uint16_t day)
{
    /*for (unsigned int i = 0; i < v.size(); i++)
    {
        if (year < v[i].year ||  (year = v[i].year && (month < v[i].month || (month = v[i].month && day <= v[i].day))))
            cout << v[i].name << endl;
    }*/
    for (unsigned int i = 0; i < 50; i++)
    {
        cout << " " << v[i].year << " " << v[i].month << " " << v[i].day << " " << v[i].name  << endl;
    }
}

int main()
{
    vector<package> log;
    readfile(log);
    cout << log[0].new_version;
    print(log, 2012, 10, 5);
    return 0;
}
